winIDEA SDK
|
This class is a base class for analyzer documents (trace, coverage and profiler).
Clients should not instantiate this class directly, but should use one of derived classes instead (CTraceController, CCoverageController2, or CProfilerController2).
#include <CDocumentController.h>
Public Types | |
enum | EAnalysisType { ETraceOnly , ECoverage , EProfiler , EBoth } |
Which type of analysis should be performed on recording. More... | |
enum | EDocumentType { ANALYZER , CODE_COVERAGE , PROFILER } |
new enum type introduced, to limit the allowed values More... | |
Public Member Functions | |
void | abort () |
Aborts loading of document contents from a file. | |
CAnalyzerDocController (std::shared_ptr< ConnectionMgr > connectionMgr, EDocumentType type, const std::string &fileName, const std::string &mode, bool createObjectOnly=false) | |
Creates a new document or opens an existing one. | |
void | clearMarker () |
Clears the existing marker - implemented only for text documents. | |
void | close () |
Closes the document. | |
void | closeAll () |
Closes all documents. | |
void | closeDiscard () |
Closes the document and discards any unsaved changes. | |
int | createTrigger (const std::string &triggerName) |
Creates trigger with the given name. | |
void | exportAs (IConnectIDE::EDocumentExportParameter scope, const std::string &fileName, const std::string &format) |
void | exportAs (IConnectIDE::EDocumentExportParameter scope, const std::string &fileName, DWORD format) |
void | exportAsAndLaunchViewer (IConnectIDE::EDocumentExportParameter scope, const std::string &fileName, DWORD format) |
int | getActiveTriggerIndex () |
Returns index of the currently active trigger. | |
CAnalyzerSessionStatus | getAnalyzerSessionStatus () |
Returns analyzer session status. | |
std::string | getDocumentOptionURL (const std::string &postfix) |
This utility method returns path of analyzer document option. | |
CDocumentStatus | getDocumentStatus () |
Returns analyzer document status. | |
CIDEControllerSPtr | getIConnectIDE () |
Returns the isystem.connect IDE interface. | |
int | getNumberOfTriggers () |
Returns the number of triggers defined in the opened document. | |
CAnalyzerStatus | getStatus () |
int | getTriggerIndex (const std::string &triggerName, bool isThrowException=true) |
Returns the index of the trigger with the given name. | |
std::string | getTriggerOption (int index, const std::string &triggerOption) |
Returns value of trigger option, for example trigger name, buffer size, trigger position, ... | |
bool | isActive () |
Returns true if the document start action is still running, false otherwise. | |
bool | isBusy () |
Returns true if the document is still changing, either because recording or loading/analysis is still running. | |
int | removeTrigger (const std::string &triggerName) |
Removes profiler or trace trigger. | |
void | reset (IConnectIDE::EDocumentResetParameter resetScope) |
Resets contents of the document. | |
void | resume () |
Starts recording but keeps existing coverage data. | |
void | save () |
Saves the document. | |
void | saveAs (const std::string &fileName, bool isForceOverwrite=false) |
Saves the document with a new name. | |
void | saveAsPrompt () |
Saves the document, winIDEA prompts the user for a new name. | |
void | saveCopy (const std::string &newFileName) |
Saves copy of the document under a given file name. | |
void | select (const std::string &triggerName) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA (the one with a hammer and text) | |
void | select (int index) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA (the one with a hammer and text) | |
void | setAnalysisType (int triggerIndex, EAnalysisType analysisType) |
This method sets analysis type on the given trigger. | |
void | setDirty (bool isDirty) |
Sets dirty status of the document. | |
void | setExportFormat (const std::string &exportFormat) |
void | setFocus (int lineNumber) |
Sets focus to the view containing the document. | |
void | setMarker () |
Not available for analyzer documents - does nothing. | |
void | setMarker (int lineNumber) |
Sets marker at the given line - implemented only for text documents. | |
void | setTriggerOption (int index, const std::string &triggerOption, const std::string &newValue) |
Sets value of the trigger option, for example trigger name, buffer size, trigger position, ... | |
void | setTriggerOption (int index, const std::string &triggerOption, DWORD newValue) |
Sets value of the trigger option, for example trigger name, buffer size, trigger position, ... | |
void | start () |
Starts default document action. | |
void | start1 () |
Starts alternate document action. | |
void | stop () |
Stops document action. | |
void | stopAnalyzing () |
Stops analysis of analyzer data. | |
void | stopLoadingOrSaving () |
Stops load or save operation. | |
void | stopSampling () |
Stops sampling (recording) operation. | |
void | stopUploading () |
Stops transfer of data to PC. | |
bool | waitUntilLoaded (int timeoutMs=0, DWORD pollingIntervalMs=100, bool isThrow=false) |
This method polls analyzer status with the given polling interval and returns when analyzer stops loading samples from the hardware, or timeout expires. | |
Static Public Attributes | |
static const std::string | exportCCAsCSV |
Export coverage document as CSV file. | |
static const std::string | exportCCAsGCOV |
Export coverage document as GNU coverage file. | |
static const std::string | exportCCAsHTML |
Export coverage document as HTML file. | |
static const std::string | exportCCAsReviewHTML |
Export coverage document as HTML file in format suitable for code review. | |
static const std::string | exportCCAsReviewText |
Export coverage document as text file in format suitable for code review. | |
static const std::string | exportCCAsText |
Export coverage document as text file. | |
static const std::string | exportCCAsXML |
Export coverage document as XML file. | |
static const std::string | exportCCAsXML2 |
Export coverage document as XML file. | |
static const std::string | exportProfilerAsBTF |
Export profiler document as BTF file. | |
static const std::string | exportProfilerAsHTML |
Export profiler document as HTML file. | |
static const std::string | exportProfilerAsMDF |
Export profiler document as MDF file. | |
static const std::string | exportProfilerAsText1 |
Export profiler document as customized text file. | |
static const std::string | exportProfilerAsXML |
Export profiler document as XML file. | |
static const std::string | exportTrcAsBinary |
Export trace document as binary file. | |
static const std::string | exportTrcAsCSV |
Export trace document as CSV file. | |
static const std::string | exportTrcAsText |
Export trace document as text file. | |
static const std::string | exportTrcAsXML |
Export trace document as XML file. | |
new enum type introduced, to limit the allowed values
Enumerator | |
---|---|
ANALYZER | trace document |
CODE_COVERAGE | code coverage document. For internal use only, instantiate class CCoverageController instead. |
PROFILER | profiler document. For internal use only, instantiate class CProfilerController2 instead. |
isys::CAnalyzerDocController::CAnalyzerDocController | ( | std::shared_ptr< ConnectionMgr > | connectionMgr, |
EDocumentType | type, | ||
const std::string & | fileName, | ||
const std::string & | mode, | ||
bool | createObjectOnly = false ) |
Creates a new document or opens an existing one.
If existing document is opened for writing, (mode = 'w'), then document contents is erased, but other data, for example triggers, is not cleared.
connectionMgr | class which maintains connection to winIDEA. Connection must be established before this call. |
type | defines the type of document to open. Usage of CODE_COVERAGE for this parameter is deprecated. Instantiate class CCodeCoverage instead. |
fileName | if not an empty string, it is used, otherwise the user is prompted for fileName by winIDEA. In the later case this object can not be used, because the file name is known only in winIDEA. It is highly recommended to use extension * .trd for trace documents and * .ccv for coverage documents. |
mode | document open mode. 'u' opens existing file for update (file must exist), 'w' opens existing file and deletes recordings, or creates a new file, 'a' opens existing file and keeps contents, or creates a new file if it does not exist. |
createObjectOnly | bool |
IOException | in case of an error. |
void isys::CAnalyzerDocController::abort | ( | ) |
Aborts loading of document contents from a file.
Use this method only when opening a really large documents and contents is not needed, otherwise call waitUntilLoaded() and wait until document contents is loaded. Has no effect when analyzer is running.
|
inherited |
Clears the existing marker - implemented only for text documents.
IOException | in case of an error. |
Python example: test_marker.py
|
inherited |
Closes the document.
If the document is changed but not saved, winIDEA prompts user if he would like to save the file.
IOException | in case of an error. |
Python example: test_doc_close.py
|
inherited |
Closes all documents.
If there are no documents opened via isystem.connect, CIDEController::closeAllDocuments() can also be used.
IOException | in case of an error. |
Python example: test_doc_close.py
|
inherited |
Closes the document and discards any unsaved changes.
IOException | in case of an error. |
Python example: test_doc_close.py
int isys::CAnalyzerDocController::createTrigger | ( | const std::string & | triggerName | ) |
Creates trigger with the given name.
Call method setAnalysisType() to define analysis type.
void isys::CAnalyzerDocController::exportAs | ( | IConnectIDE::EDocumentExportParameter | scope, |
const std::string & | fileName, | ||
const std::string & | format ) |
Exports data to the given file and in the given format.
scope | export all or selection only, see IConnectIDE::EDocumentExportParameter |
fileName | name of the file to export the document to |
format | name of the export format as written in combo box in the winIDEA's export dialog. Supported values are also available as static members of this class. See CAnalyzerDocController::exportCCAsHTML, CAnalyzerDocController::exportCCAsText, ... For analyzer documents the method CProfilerController2::exportData() should be used. |
IOException | in case of an error. |
void isys::CAnalyzerDocController::exportAs | ( | IConnectIDE::EDocumentExportParameter | scope, |
const std::string & | fileName, | ||
DWORD | format ) |
Exports data to the given file and in the given format.
scope | export all or selection only, see IConnectIDE::EDocumentExportParameter |
fileName | name of the file to export the document to |
format | index of the format in combo box in the winIDEA's export dialog. If it is set to 0xFFFFFFFF, the currently selected export format is used. See setExportFormat(). For analyzer documents the method CProfilerController2::exportData() should be used. |
IOException | in case of an error. |
void isys::CAnalyzerDocController::exportAsAndLaunchViewer | ( | IConnectIDE::EDocumentExportParameter | scope, |
const std::string & | fileName, | ||
DWORD | format ) |
Exports the document and launches the system default viewer for the specified document type, for example web browser for HTML documents.
scope | export all or selection only, see IConnectIDE::EDocumentExportParameter |
fileName | name of the file to export the document to |
format | index of the format in combo box in the winIDEA's export dialog. If it is set to 0xFFFFFFFF, the currently selected export format is used. See setExportFormat(). For analyzer documents the method CProfilerController2::exportData() should be used. |
IOException | in case of an error. |
int isys::CAnalyzerDocController::getActiveTriggerIndex | ( | ) |
Returns index of the currently active trigger.
If you want to get the active trigger name, call method:
triggerName = getTriggerOption(index, "Name").
CAnalyzerSessionStatus isys::CAnalyzerDocController::getAnalyzerSessionStatus | ( | ) |
Returns analyzer session status.
Use this method to check for analyzer status and recording errors.
std::string isys::CAnalyzerDocController::getDocumentOptionURL | ( | const std::string & | postfix | ) |
This utility method returns path of analyzer document option.
The returned path is composed as '/Document/' + fileName + '/' + postfix
. Use this method when you have to set some option, which is not accessible with methods of this class or derived classes.
Python example: test_set_profiling_sections.py
|
inherited |
Returns the isystem.connect IDE interface.
Use this method only when some functionality of the IConnectIDE interface regarding workspace handling is not accessible from this wrapper.
int isys::CAnalyzerDocController::getNumberOfTriggers | ( | ) |
Returns the number of triggers defined in the opened document.
Python example: profiler_controller.py
CAnalyzerStatus isys::CAnalyzerDocController::getStatus | ( | ) |
Returns analyzer status. Use this method to check for analyzer status and recording errors.
int isys::CAnalyzerDocController::getTriggerIndex | ( | const std::string & | triggerName, |
bool | isThrowException = true ) |
Returns the index of the trigger with the given name.
triggerName | name of analyzer trigger as specified in 'Analyzer Configuration' toolbar drop down list in winIDEA analyzer window (the one with a settings icon). It is also accessible as winIDEA option path /Document/<fileName>/Trigger.Items[<index>].Name . where <index> is the value returned by this method. |
isThrowException | if trigger with the given name is not found, and:
|
Python example: profiler_controller.py
std::string isys::CAnalyzerDocController::getTriggerOption | ( | int | index, |
const std::string & | triggerOption ) |
Returns value of trigger option, for example trigger name, buffer size, trigger position, ...
triggerOption | part of the winIDEA option path, which is following the Items[] part. For example, name of the trigger at index 0 for analyzer file Sample5554_profiler.trd is specified with winIDEA option path /Document/Sample5554_profiler.trd/Trigger.Items[0].Name . To get it by this method, we define index as 0 and triggerOption as 'Name'.Another example - to get sampling starting point, we call this method as: getTriggerOption(0, "HW.Recorder.Start"); |
index | trigger index, see methods getTriggerIndex() and getNumberOfTriggers() |
Python example: profiler_controller.py
bool isys::CAnalyzerDocController::isActive | ( | ) |
Returns true
if the document start action is still running, false
otherwise.
When recording stops, this method returns false, even if loading and analysis of data is still in progress.
IOException | in case of an error. |
Python example: test_coverage_get_status.py
bool isys::CAnalyzerDocController::isBusy | ( | ) |
Returns true
if the document is still changing, either because recording or loading/analysis is still running.
Returns false
otherwise.
IOException | in case of an error. |
int isys::CAnalyzerDocController::removeTrigger | ( | const std::string & | triggerName | ) |
Removes profiler or trace trigger.
triggerName | name of the trigger to remove |
Python example: profiler_controller.py
|
inherited |
Resets contents of the document.
resetScope | defines which part of the document to reset. |
Python example: test_reset.py
|
inherited |
Starts recording but keeps existing coverage data.
Works on coverage analyzer documents only.
IOException | in case of an error. |
Python example: test_doc_control.py
|
inherited |
|
inherited |
Saves the document with a new name.
IOException | in case of an error. |
Python example: test_save.py
|
inherited |
Saves the document, winIDEA prompts the user for a new name.
IOException | in case of an error. |
Python example: test_save.py
|
inherited |
Saves copy of the document under a given file name.
The name of the opened document does not change. If the destination file already exists, it is overwritten. Use this method to save intermediate results, for example coverage between several runs.
IOException | in case of an error. |
Python example: test_save.py
void isys::CAnalyzerDocController::select | ( | const std::string & | triggerName | ) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA
(the one with a hammer and text)
triggerName | name of the trigger in the list |
Python example: profiler_controller.py
void isys::CAnalyzerDocController::select | ( | int | index | ) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA
(the one with a hammer and text)
index | index of the trigger in the list |
Python example: profiler_controller.py
void isys::CAnalyzerDocController::setAnalysisType | ( | int | triggerIndex, |
EAnalysisType | analysisType ) |
This method sets analysis type on the given trigger.
If trigger is created with CProfilerController2, it is set to profiler only analysis by default. Similar is true for coverage. To perform both types of analysis on the same recording, call this method with analysisType set to EBoth.
void isys::CAnalyzerDocController::setDirty | ( | bool | isDirty | ) |
Sets dirty status of the document.
Normally this method is used when dirty flag is not set after configuring the document via API, but we want to save the document.
void isys::CAnalyzerDocController::setExportFormat | ( | const std::string & | exportFormat | ) |
Sets export format for trace and coverage documents.
exportFormat | name of the export format as written in combo box in the winIDEA's export dialog. Supported values are also available as static members of this class. See CAnalyzerDocController::exportCCAsHTML, CAnalyzerDocController::exportCCAsText, ... |
IOException | in case of an error. |
|
inherited |
Sets focus to the view containing the document.
lineNumber | line number in text document to be displayed. |
IOException | in case of an error. |
Python example: test_focus.py
|
inherited |
Sets marker at the given line - implemented only for text documents.
IOException | in case of an error. |
Python example: test_marker.py
void isys::CAnalyzerDocController::setTriggerOption | ( | int | index, |
const std::string & | triggerOption, | ||
const std::string & | newValue ) |
Sets value of the trigger option, for example trigger name, buffer size, trigger position, ...
index | trigger index, see methods getTriggerIndex() and getNumberOfTriggers() |
triggerOption | part of the winIDEA option path, which is following the Items[] part. For example, the name of the trigger at index 0 for analyzer file Sample5554_profiler.trd is specified with winIDEA option path: /Document/Sample5554_profiler.trd/Trigger.Items[0].Name To set the trigger name we call this method as: setTriggerOption(0, "Name", "myTrig"); Another example - to set sampling starting point, we call this method as: setTriggerOption(0, "HW.Recorder.Start", "Immediately"); |
newValue | new value of the config. property, see the Options dialog in winIDEA for the list of options and possible values of each option. |
Python example: profiler_controller.py
void isys::CAnalyzerDocController::setTriggerOption | ( | int | index, |
const std::string & | triggerOption, | ||
DWORD | newValue ) |
Sets value of the trigger option, for example trigger name, buffer size, trigger position, ...
triggerOption | part of the winIDEA option path, which is following the Items[] part. For example, the name of the trigger at index 0 for analyzer file Sample5554_profiler.trd is specified with winIDEA option path: /Document/Sample5554_profiler.trd/Trigger.Items[0].Name . To set the trigger name we call this method as: setTriggerOption(0, "Name", "myTrig"); Another example - to set sampling starting point, we call this method as: setTriggerOption(0, "HW.Recorder.Start", "Immediately"); |
index | trigger index, see methods getTriggerIndex() and getNumberOfTriggers() |
newValue | new value of the config. property, see the Options dialog in winIDEA for the list of options and possible values of each option. |
|
inherited |
Starts default document action.
Starts recording if the document type is coverage, profiler or trace, or executes the script if it is a script document. Existing contents of analyzer document is always deleted when this method is called. It is possible to preserve existing coverage information by calling method resume(), instead of this method.
Note: If analyzer is started, then option 'Reactivate session after CPU stop' has no effect. Analyzer will not be automatically started.
IOException | in case of an error. |
Python example: test_doc_control.py
|
inherited |
Starts alternate document action.
Repeats analysis on a previously recorded data if the document type is analyzer. Usage example: if document is recorded as trace (trace trigger is used), but we want to perform profiler analysis later (with profiler trigger).
IOException | in case of an error. |
Python example: test_doc_control.py
|
inherited |
Stops document action.
For analyzer documents this action is deprecated. Use one of stop...() methods of CAnalyzerController instead.
This method triggers the following state transitions on analyzer document:
For script document this method terminates the script.
IOException | in case of an error. |
Python example: test_doc_control.py
void isys::CAnalyzerDocController::stopAnalyzing | ( | ) |
Stops analysis of analyzer data.
To unconditionally stop analyzer immediately, call stopUploading() before this call.
void isys::CAnalyzerDocController::stopSampling | ( | ) |
Stops sampling (recording) operation.
After this action loading of data starts. Does nothing if sampling has already finished.
IOException | in case of an error. |
Python example: test_coverage_all_code.py
void isys::CAnalyzerDocController::stopUploading | ( | ) |
Stops transfer of data to PC.
Continues with analysis of data already transferred to PC. To completely stop analyzer, call stopAnalyzing() after this call.
bool isys::CAnalyzerDocController::waitUntilLoaded | ( | int | timeoutMs = 0, |
DWORD | pollingIntervalMs = 100, | ||
bool | isThrow = false ) |
This method polls analyzer status with the given polling interval and returns when analyzer stops loading samples from the hardware, or timeout expires.
timeoutMs | timeout in milliseconds. 0 means infinite timeout |
pollingIntervalMs | time in milliseconds between two readings of the analyzer status |
isThrow | if true and timeout occurs, an exception is thrown |
Python example: profiler_controller.py
|
static |
Export coverage document as CSV file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as GNU coverage file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as HTML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as HTML file in format suitable for code review.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as text file in format suitable for code review.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as text file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as XML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export coverage document as XML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CCoverageFormatBase instead.
|
static |
Export profiler document as BTF file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CProfilerFormatBase instead.
|
static |
Export profiler document as HTML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CProfilerFormatBase instead.
|
static |
Export profiler document as MDF file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CProfilerFormatBase instead.
|
static |
Export profiler document as customized text file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CProfilerFormatBase instead.
|
static |
Export profiler document as XML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CProfilerFormatBase instead.
|
static |
Export trace document as binary file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CTraceFormatBase instead.
|
static |
Export trace document as CSV file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CTraceFormatBase instead.
|
static |
Export trace document as text file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CTraceFormatBase instead.
|
static |
Export trace document as XML file.
Can be used to set document option Export.Type
, but it is recommended to use classes derived from CTraceFormatBase instead.