winIDEA SDK
isys::CTraceData Class Reference

Description

This class provides access to trace measurements.

It parses XML or binary export files, and returns the parsed data through method calls. Since trace export files may be very large - hundreds of megabytes or even gigabytes, this class parses one sample per iterator function call.

To get instance of this class call one of createInstance() factory methods.

#include <CTraceData.h>

Public Member Functions

CTraceBinExportFormatSPtr getBinaryExportConfig ()
 Returns file format. More...
 
std::string getParserWarnings ()
 This method returns warnings related to input document. More...
 
void closeParser ()
 This method releases parser resources and closes document file. More...
 
CTraceTimelineIterator getTimelineIterator ()
 Returns iterator, which will iterate trace samples. More...
 

Static Public Member Functions

static CTraceDataSPtr createInstance (CTraceControllerSPtr traceCtrl, const std::string &exportFileName, int64_t startTime, int64_t endTime, bool isBinaryExport)
 This factory method exports data to file, and returns initialized object for parsing of trace files. More...
 
static CTraceDataSPtr createInstance (const std::string &fileName)
 This factory method returns initialized object for parsing of XML trace files. More...
 
static CTraceDataSPtr createInstance (const std::string &fileName, CTraceBinExportFormatSPtr exportFormat)
 This factory method returns initialized object for parsing of binary trace files. More...
 

Member Function Documentation

◆ closeParser()

void isys::CTraceData::closeParser ( )

This method releases parser resources and closes document file.

It is recommended to call this method always after CTraceTimelineIterator is no longer used.

Python example: test_trace_get_timeline_iterator.py

◆ createInstance() [1/3]

static CTraceDataSPtr isys::CTraceData::createInstance ( const std::string &  fileName)
static

This factory method returns initialized object for parsing of XML trace files.

Use this method when trace data was exported to XML file.

Parameters
fileNamename of the file with trace XML export. If you use relative file path, be aware that script working directory is used as a starting point, not winIDEA workspace directory.

Python example: test_get_binary_export_config.py

◆ createInstance() [2/3]

static CTraceDataSPtr isys::CTraceData::createInstance ( const std::string &  fileName,
CTraceBinExportFormatSPtr  exportFormat 
)
static

This factory method returns initialized object for parsing of binary trace files.

Use this method when trace data was exported to binary file.

Parameters
fileNamename of the file with trace binary export. If you use relative file path, be aware that script working directory is used as a starting point, not winIDEA workspace directory.
exportFormatthis object is used to obtain information about export format. First the header presence and version are obtained. If there is no header or the version is less than 2, then other flags in this object are used to get the exact file format. If header is present and version is 2, then exact format is retrieved from the file and other settings in this object are ignored.

Python example: test_get_binary_export_config.py

◆ createInstance() [3/3]

static CTraceDataSPtr isys::CTraceData::createInstance ( CTraceControllerSPtr  traceCtrl,
const std::string &  exportFileName,
int64_t  startTime,
int64_t  endTime,
bool  isBinaryExport 
)
static

This factory method exports data to file, and returns initialized object for parsing of trace files.

Use it, when you've just recorded data (have CTraceController2 object available), and have not exported it yet. Note also that this method is not as flexible as direct export and method createInstance(fileName) or createInstance(fileName, exportConfig).

Note: if exportFileName is relative, it is saved relative to winIDEA working directory, not the script working directory. This method tries to do its best to open the saved file, but if winIDEA is on remote host, it will fail. In such cases try to export the trace data with CTraceController2::exportData() and use the overloaded method createInstance(fileName, isBinaryTimeline) instead.

Parameters
traceCtrltrace document controller which will be used to obtain data.
exportFileNamename of the file to export data to
startTimestart time for trace export. If startTime and endTime are set to 0, then all data is exported.
endTimeend time for trace export. If startTime and endTime are set to 0, then all data is exported.
isBinaryExportif true, trace data is exported in binary format. If false, XML format is used.

Python example: test_get_binary_export_config.py

◆ getBinaryExportConfig()

CTraceBinExportFormatSPtr isys::CTraceData::getBinaryExportConfig ( )

Returns file format.

If header version 2 was specified in call to createInstance(file, exportConfig), then this object is filled with information form the header. Otherwise it is returned unchanged. If binary parser is not active, an exception is thrown.

Python example: test_get_binary_export_config.py

◆ getParserWarnings()

std::string isys::CTraceData::getParserWarnings ( )

This method returns warnings related to input document.

If there were no warnings, an empty string is returned. Always call this method after createInstance().

Python example: test_trace_get_parser_warnings.py

◆ getTimelineIterator()

CTraceTimelineIterator isys::CTraceData::getTimelineIterator ( )

Returns iterator, which will iterate trace samples.

Python example: test_trace_get_timeline_iterator.py