winIDEA SDK
isys::CProfilerController Class Reference

Description

Deprecated - Use isys::CProfilerController2 instead.

This class controls winIDEA profiler.

Example:

    profiler.startConfiguration(isystem.connect.IConnectProfiler.cfTimeStampTime, "targetInit")
    profiler.addFunction("Type_Simple")
    profiler.start()
Deprecated:
This class is provided for backward compatibility only. Use isys::CProfilerController2 instead.


#include <CProfilerController.h>

Inheritance diagram for isys::CProfilerController:
isys::WrapperBase

Public Types

typedef std::vector< CProfilerStatisticStatisticsVector
 List of profiler statistic records.
 
typedef std::vector< CProfilerHistoryHistoryVector
 List of profiler history records.
 

Public Member Functions

 CProfilerController (std::shared_ptr< ConnectionMgr > connectionMgr)
 Instantiates object. More...
 
IConnectProfiler2getIConnectProfiler ()
 Returns the isystem.connect profiler interface. More...
 
CProfilerCapabilities getCapabilities ()
 Returns profiler capabilities. More...
 
void startConfiguration (IConnectProfiler::EConfigFlags startConfigFlags)
 Configures profiler for start without waiting for trigger. More...
 
void startConfiguration (IConnectProfiler::EConfigFlags startConfigFlags, BYTE memArea, ADDRESS address)
 Configures profiler for start when the instruction on the specified address will be executed. More...
 
void startConfiguration (IConnectProfiler::EConfigFlags startConfigFlags, const std::string &functionName)
 Configures profiler for start when execution of the specified function starts. More...
 
void startConfiguration (IConnectProfiler::EConfigFlags startConfigFlags, const SProfilerStartingPoint &pStartingPoint)
 Sets the given configuration for profiler. More...
 
void addFunction (const std::string &functionName, bool isIncludeFunctionLines=false)
 Adds function area to the current profiler configuration. More...
 
void addVariable (const std::string &variableName, bool isTaskId=false, bool isSingleData=false)
 Adds variable area to the current profiler configuration. More...
 
void addRegion (const std::string &name, bool isTaskId, bool isSingleData, BYTE byMemArea, DWORD aAddress, DWORD aSize)
 Adds memory region to the current profiler configuration. More...
 
void addRoutine (const std::string &name, BYTE byMemArea, DWORD aAddress, DWORD aSize, iconnect::AddressVector &exits)
 Adds profiler area as a low level routine. More...
 
int getNumAreas ()
 Returns the number of result areas. More...
 
CAreaProperties getAreaProperties (const std::string &areaName)
 Returns area properties, such as handle and address. More...
 
CAreaProperties getAreaProperties (DWORD handle)
 Returns area properties, such as name and address. More...
 
CAreaProperties getAreaProperties (DWORD dwResultAreaFlags, ADDRESS aAddress)
 Returns area properties, such as name and handle. More...
 
void start ()
 Starts profiler.
 
bool stop ()
 Stops profiler. More...
 
CProfilerStatus getStatus (::IConnectProfiler::EGetStatusFlags statusFlags=::IConnectProfiler::gsfNumRecorded)
 Polls the profiler status. More...
 
void getStatisticsAll (size_t expectedSize, CProfilerController::StatisticsVector &statisticsList)
 Retrieves statistic results for all areas. More...
 
void getStatisticsForHandle (DWORD handle, size_t expectedSize, CProfilerController::StatisticsVector &statisticsList)
 Retrieves statistic results for area with the given handle. More...
 
void getStatisticsForTask (DWORD taskID, size_t expectedSize, CProfilerController::StatisticsVector &statisticsList)
 Retrieves statistic results for task with the given ID, for all areas. More...
 
void getStatisticsForTask (DWORD handle, DWORD taskId, size_t expectedSize, CProfilerController::StatisticsVector &statisticsList)
 Retrieves statistic results for task with the given profiler area handle. More...
 
void getStatisticsForValue (DWORD handle, DWORD value, size_t expectedSize, CProfilerController::StatisticsVector &statisticsList)
 Retrieves statistic results for data area with the given handle and value. More...
 
void getHistoryAll (DWORD startIDx, DWORD len, HistoryVector &historyList)
 Retrieves history of invocations for all areas. More...
 
bool waitUntilLoaded (int timeout=0, DWORD pollingInterval=100)
 This method polls profiler status with the given polling interval and returns when profiler stops loading samples from the hardware, or timeout expires. More...
 

Constructor & Destructor Documentation

◆ CProfilerController()

isys::CProfilerController::CProfilerController ( std::shared_ptr< ConnectionMgr connectionMgr)

Instantiates object.

Parameters
connectionMgrclass which maintains connection to winIDEA. Connection must be established before this call.

Member Function Documentation

◆ addFunction()

void isys::CProfilerController::addFunction ( const std::string &  functionName,
bool  isIncludeFunctionLines = false 
)

Adds function area to the current profiler configuration.

Parameters
functionNamename of the function to profile
isIncludeFunctionLinesif true, profiles also each line of a function, however accuracy of these results may be low on some systems. Results for each line are currently not accessible from isystem.connect interface.

◆ addRegion()

void isys::CProfilerController::addRegion ( const std::string &  name,
bool  isTaskId,
bool  isSingleData,
BYTE  byMemArea,
DWORD  aAddress,
DWORD  aSize 
)

Adds memory region to the current profiler configuration.

Parameters
namearea name
isTaskIdset this to true, if area is task ID
isSingleDataset this to true, if area is the 'single data' (OTM style) object.
byMemAreamemory area of the start address
aAddressstart address of the area
aSizesize of the area

◆ addRoutine()

void isys::CProfilerController::addRoutine ( const std::string &  name,
BYTE  byMemArea,
DWORD  aAddress,
DWORD  aSize,
iconnect::AddressVector exits 
)

Adds profiler area as a low level routine.

Parameters
namearea name
byMemAreamemory area of the start address
aAddressstart address of the area
aSizesize of the area
exitspoints to a vector of ADDRESS_64 type objects, each specifying an exit point from afTypeRoutine object

◆ addVariable()

void isys::CProfilerController::addVariable ( const std::string &  variableName,
bool  isTaskId = false,
bool  isSingleData = false 
)

Adds variable area to the current profiler configuration.

Parameters
variableNamename of the variable to profile
isTaskIdset this to true, if variable is task ID
isSingleDataset this to true, if variable is the 'single data' (OTM style) object.

◆ getAreaProperties() [1/3]

CAreaProperties isys::CProfilerController::getAreaProperties ( const std::string &  areaName)

Returns area properties, such as handle and address.

Parameters
areaNamename of the area, which properties should be returned

◆ getAreaProperties() [2/3]

CAreaProperties isys::CProfilerController::getAreaProperties ( DWORD  dwResultAreaFlags,
ADDRESS  aAddress 
)

Returns area properties, such as name and handle.

Parameters
dwResultAreaFlagsshould be IConnectProfiler2::grafTypeExec or IConnectProfiler2::grafTypeData, depending on address type
aAddressaddress of the area, which properties should be returned

◆ getAreaProperties() [3/3]

CAreaProperties isys::CProfilerController::getAreaProperties ( DWORD  handle)

Returns area properties, such as name and address.

Parameters
handlehandle of the area, which properties should be returned

◆ getCapabilities()

CProfilerCapabilities isys::CProfilerController::getCapabilities ( )

Returns profiler capabilities.

Exceptions
IOExceptionin case of an error

◆ getHistoryAll()

void isys::CProfilerController::getHistoryAll ( DWORD  startIDx,
DWORD  len,
HistoryVector historyList 
)

Retrieves history of invocations for all areas.

Parameters
startIDxstart index of array of data to retrieve
lennumber of history items to retrieve
historyListvector to contain data on return

◆ getIConnectProfiler()

IConnectProfiler2 * isys::CProfilerController::getIConnectProfiler ( )

Returns the isystem.connect profiler interface.

Use this method only when some functionality of the IConnectProfiler2 interface is not accessible from this wrapper.

◆ getNumAreas()

int isys::CProfilerController::getNumAreas ( )

Returns the number of result areas.

Area handles have values in the range [0, numAreas - 1], so we can easily iterate all areas.

◆ getStatisticsAll()

void isys::CProfilerController::getStatisticsAll ( size_t  expectedSize,
CProfilerController::StatisticsVector statisticsList 
)

Retrieves statistic results for all areas.

If output vector size equals expectedSize, it means that there is more data to retrieve. Increase expected size and call this method again to get all data.

Parameters
expectedSizeexpected number of statistics items to be returned. If it is to small only the specified number of items will be returned. If it is to big, to much memory is allocated for local buffer.
statisticsListthe vector, which will contain results on return

◆ getStatisticsForHandle()

void isys::CProfilerController::getStatisticsForHandle ( DWORD  handle,
size_t  expectedSize,
CProfilerController::StatisticsVector statisticsList 
)

Retrieves statistic results for area with the given handle.

If output vector size equals expectedSize, it means that there is more data to retrieve. Increase expected size and call this method again to get all data.

Parameters
handleprofiler area handle
expectedSizeexpected number of statistics items to be returned. If it is to small only the specified number of items will be returned. If it is to big, to much memory is allocated for local buffer.
statisticsListthe vector, which will contain results on return

◆ getStatisticsForTask() [1/2]

void isys::CProfilerController::getStatisticsForTask ( DWORD  handle,
DWORD  taskId,
size_t  expectedSize,
CProfilerController::StatisticsVector statisticsList 
)

Retrieves statistic results for task with the given profiler area handle.

If output vector size equals expectedSize, it means that there is more data to retrieve. Increase expected size and call this method again to get all data.

Parameters
handleprofiler area handle
taskIdID of the task
expectedSizeexpected number of statistics items to be returned. If it is to small only the specified number of items will be returned. If it is to big, to much memory is allocated for local buffer.
statisticsListthe vector, which will contain results on return

◆ getStatisticsForTask() [2/2]

void isys::CProfilerController::getStatisticsForTask ( DWORD  taskID,
size_t  expectedSize,
CProfilerController::StatisticsVector statisticsList 
)

Retrieves statistic results for task with the given ID, for all areas.

If output vector size equals expectedSize, it means that there is more data to retrieve. Increase expected size and call this method again to get all data.

Parameters
taskIDID of the task
expectedSizeexpected number of statistics items to be returned. If it is to small only the specified number of items will be returned. If it is to big, to much memory is allocated for local buffer.
statisticsListthe vector, which will contain results on return

◆ getStatisticsForValue()

void isys::CProfilerController::getStatisticsForValue ( DWORD  handle,
DWORD  value,
size_t  expectedSize,
CProfilerController::StatisticsVector statisticsList 
)

Retrieves statistic results for data area with the given handle and value.

If output vector size equals expectedSize, it means that there is more data to retrieve. Increase expected size and call this method again to get all data.

Parameters
handleprofiler area handle
valuevalue of the task
expectedSizeexpected number of statistics items to be returned. If it is to small only the specified number of items will be returned. If it is to big, to much memory is allocated for local buffer.
statisticsListthe vector, which will contain results on return

◆ getStatus()

CProfilerStatus isys::CProfilerController::getStatus ( ::IConnectProfiler::EGetStatusFlags  statusFlags = ::IConnectProfiler::gsfNumRecorded)

Polls the profiler status.

Parameters
statusFlagsdefine the type of information returned in CProfilerStatus. See IConnectProfiler::EGetStatusFlags.

◆ startConfiguration() [1/4]

void isys::CProfilerController::startConfiguration ( IConnectProfiler::EConfigFlags  startConfigFlags)

Configures profiler for start without waiting for trigger.

Parameters
startConfigFlagsdefine profiler resolution

◆ startConfiguration() [2/4]

void isys::CProfilerController::startConfiguration ( IConnectProfiler::EConfigFlags  startConfigFlags,
BYTE  memArea,
ADDRESS  address 
)

Configures profiler for start when the instruction on the specified address will be executed.

Parameters
startConfigFlagsdefine profiler resolution
memAreamemory area of the profiler start address
addressprofiler start address

◆ startConfiguration() [3/4]

void isys::CProfilerController::startConfiguration ( IConnectProfiler::EConfigFlags  startConfigFlags,
const SProfilerStartingPoint &  pStartingPoint 
)

Sets the given configuration for profiler.

Use this method only if other overloaded variants do not support some settings in configuration.

Parameters
startConfigFlagsdefine profiler resolution
pStartingPointthe starting point

◆ startConfiguration() [4/4]

void isys::CProfilerController::startConfiguration ( IConnectProfiler::EConfigFlags  startConfigFlags,
const std::string &  functionName 
)

Configures profiler for start when execution of the specified function starts.

Parameters
startConfigFlagsdefine profiler resolution
functionNamename of the profiler trigger function

◆ stop()

bool isys::CProfilerController::stop ( )

Stops profiler.

Returns
true, is profiler was running, false if profiler was stopped

◆ waitUntilLoaded()

bool isys::CProfilerController::waitUntilLoaded ( int  timeout = 0,
DWORD  pollingInterval = 100 
)

This method polls profiler status with the given polling interval and returns when profiler stops loading samples from the hardware, or timeout expires.

Parameters
timeouttimeout in milliseconds. 0 means infinite timeout
pollingIntervaltime between two readings of the profiler status
Returns
true if CPU is in stopped state, false if timeout expired