winIDEA SDK
|
This class enables recording and export of program trace.
It extends the existing class CAnalyzerDocController.
This class can be used to configure trace trigger, run recording, and export the recorded data. However, it has no methods for retrieving recorded information. For this purpose a separate class called CTraceData should be used.
Advanced trace configuration
Most settings for trace are implemented by setting of winIDEA options. Since there are many options, and most of them are target dependent, this class provides methods for accessing only the most often used options. To see all trace options, open trace document in winIDEA, then select Help | Display Option...
. In the opened dialog select all check-boxes, and radio button 'Document'. Then select trace document in the combo box next to the radio button. Click the Display'
button to see all trace options as shown in the image below:
These options can be set with method CIDEController::setOption(). This approach should be used for advanced configurations, which are target dependent. Another possibility is to create and configure a trace document manually in winIDEA, and use it as a template in scripts.
Python example with recording and simple data reading.
uses only class CTraceData.
#include <CTraceController.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. More... | |
void | applyTriggerWizard (isys::CTraceConfigWizardSPtr &traceWizardConfig, int triggerIdx) |
This method applies the given trace trigger configuration to the actual trigger of this document. More... | |
void | close () |
Closes the document. More... | |
void | closeAll () |
Closes all documents. More... | |
void | closeDiscard () |
Closes the document and discards any unsaved changes. More... | |
int | createTrigger (const std::string &triggerName) |
Creates a new trace trigger. More... | |
CTraceController (std::shared_ptr< ConnectionMgr > connectionMgr, const std::string &fileName, const std::string &mode) | |
Instantiates object and opens or creates analyzer document in winIDEA . More... | |
void | exportData (isys::CTraceExportConfigSPtr exportConfig) |
Exports trace data according to the given configuration. More... | |
int | getActiveTriggerIndex () |
Returns index of the currently active trigger. More... | |
CAnalyzerSessionStatus | getAnalyzerSessionStatus () |
Returns analyzer session status. More... | |
std::string | getDocumentOptionURL (const std::string &postfix) |
This utility method returns path of analyzer document option. More... | |
CDocumentStatus | getDocumentStatus () |
Returns analyzer document status. | |
CIDEControllerSPtr | getIConnectIDE () |
Returns the isystem.connect IDE interface. More... | |
int | getNumberOfTriggers () |
Returns the number of triggers defined in the opened document. More... | |
int | getTriggerIndex (const std::string &triggerName, bool isThrowException=true) |
Returns the index of the trigger with the given name. More... | |
std::string | getTriggerOption (int index, const std::string &triggerOption) |
Returns value of trigger option, for example trigger name, buffer size, trigger position, ... More... | |
bool | isActive () |
Returns true if the document start action is still running, false otherwise. More... | |
bool | isBusy () |
Returns true if the document is still changing, either because recording or loading/analysis is still running. More... | |
int | removeTrigger (const std::string &triggerName) |
Removes profiler or trace trigger. More... | |
void | reset (IConnectIDE::EDocumentResetParameter resetScope) |
Resets contents of the document. More... | |
void | save () |
Saves the document. More... | |
void | saveAs (const std::string &fileName, bool isForceOverwrite=false) |
Saves the document with a new name. More... | |
void | saveAsPrompt () |
Saves the document, winIDEA prompts the user for a new name. More... | |
void | saveCopy (const std::string &newFileName) |
Saves copy of the document under a given file name. More... | |
void | select (const std::string &triggerName) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA (the one with a hammer and text) More... | |
void | select (int index) |
Selects trigger from 'Analyzer Configuration' toolbar drop down list in winIDEA (the one with a hammer and text) More... | |
void | setAnalysisType (int triggerIndex, EAnalysisType analysisType) |
This method sets analysis type on the given trigger. More... | |
void | setDirty (bool isDirty) |
Sets dirty status of the document. More... | |
void | setMarker () |
Not available for analyzer documents - does nothing. | |
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, ... More... | |
void | setTriggerOption (int index, const std::string &triggerOption, DWORD newValue) |
Sets value of the trigger option, for example trigger name, buffer size, trigger position, ... More... | |
void | start () |
Starts default document action. More... | |
void | start1 () |
Starts alternate document action. More... | |
void | stop () |
Stops document action. More... | |
void | stopAnalyzing () |
Stops analysis of analyzer data. More... | |
void | stopLoadingOrSaving () |
Stops load or save operation. | |
void | stopSampling () |
Stops sampling (recording) operation. More... | |
void | stopUploading () |
Stops transfer of data to PC. More... | |
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. More... | |
Static Public Attributes | |
static const std::string | exportCCAsCSV |
Export coverage document as CSV file. More... | |
static const std::string | exportCCAsGCOV |
Export coverage document as GNU coverage file. More... | |
static const std::string | exportCCAsHTML |
Export coverage document as HTML file. More... | |
static const std::string | exportCCAsReviewHTML |
Export coverage document as HTML file in format suitable for code review. More... | |
static const std::string | exportCCAsReviewText |
Export coverage document as text file in format suitable for code review. More... | |
static const std::string | exportCCAsText |
Export coverage document as text file. More... | |
static const std::string | exportCCAsXML |
Export coverage document as XML file. More... | |
static const std::string | exportCCAsXML2 |
Export coverage document as XML file. More... | |
static const std::string | exportProfilerAsBTF |
Export profiler document as BTF file. More... | |
static const std::string | exportProfilerAsHTML |
Export profiler document as HTML file. More... | |
static const std::string | exportProfilerAsMDF |
Export profiler document as MDF file. More... | |
static const std::string | exportProfilerAsText1 |
Export profiler document as customized text file. More... | |
static const std::string | exportProfilerAsXML |
Export profiler document as XML file. More... | |
static const std::string | exportTrcAsBinary |
Export trace document as binary file. More... | |
static const std::string | exportTrcAsCSV |
Export trace document as CSV file. More... | |
static const std::string | exportTrcAsText |
Export trace document as text file. More... | |
static const std::string | exportTrcAsXML |
Export trace document as XML file. More... | |
|
inherited |
|
inherited |
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::CTraceController::CTraceController | ( | std::shared_ptr< ConnectionMgr > | connectionMgr, |
const std::string & | fileName, | ||
const std::string & | mode | ||
) |
Instantiates object and opens or creates analyzer document in winIDEA
.
connectionMgr | class which maintains connection to winIDEA. Connection must be established before this call. |
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. |
fileName | Absolute or relative path to trd file. 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. |
Python example: test_create_instance.py
|
inherited |
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.
void isys::CTraceController::applyTriggerWizard | ( | isys::CTraceConfigWizardSPtr & | traceWizardConfig, |
int | triggerIdx | ||
) |
This method applies the given trace trigger configuration to the actual trigger of this document.
traceWizardConfig | trigger configuration. |
triggerIdx | index of trigger configuration will be applied to. |
Python example: test_apply_trigger_wizard.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::CTraceController::createTrigger | ( | const std::string & | triggerName | ) |
Creates a new trace trigger.
Trigger contains parameters for trace recording (when to start, buffer size, ...). See CTraceConfigWizard for simplified trigger configuration.
triggerName | name of the trigger |
IllegalArgumentException | if the trigger already exists |
Python example: test_create_trigger.py
void isys::CTraceController::exportData | ( | isys::CTraceExportConfigSPtr | exportConfig | ) |
Exports trace data according to the given configuration.
Example:
trace = CTraceController(connectionMgr, "trace.trd", "w"); ... cfg = CTraceExportConfig().setFileName('traceResult.xml') .setExportFormat(CTraceExportConfig::EFmtXML); trace.exportData(cfg);
Python example: test_export_data.py
|
inherited |
Returns index of the currently active trigger.
If you want to get the active trigger name, call method:
triggerName = getTriggerOption(index, "Name").
|
inherited |
Returns analyzer session status.
Use this method to check for analyzer status and recording errors.
|
inherited |
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.
|
inherited |
Returns the number of triggers defined in the opened document.
Python example: profiler_controller.py
|
inherited |
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
|
inherited |
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
|
inherited |
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
|
inherited |
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. |
|
inherited |
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 |
|
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
|
inherited |
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
|
inherited |
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
|
inherited |
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.
|
inherited |
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.
|
inherited |
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
|
inherited |
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
|
inherited |
Stops analysis of analyzer data.
To unconditionally stop analyzer immediately, call stopUploading() before this call.
|
inherited |
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
|
inherited |
Stops transfer of data to PC.
Continues with analysis of data already transferred to PC. To completely stop analyzer, call stopAnalyzing() after this call.
|
inherited |
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
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.
|
staticinherited |
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.