1. Attribute

1.1. Prof

This section describes the TOPSPTI prof api.

const char *TopsptiGetResultString(TopsptiResult res)

get the descriptive string for a TopsptiResult

Parameters

res – the result to get the string for

Returns

result string

const char *TopsptiGetProductName(int32_t dev = 0)

get the name of product

Returns

product name string

TopsptiResult TopsptiConfig(const TopsptiProfileConfig &config, int32_t dev = 0)

save configuration into config file

Parameters

config – software profiling configuration

Returns

TopsptiResult

TopsptiResult TopsptiGetVersion(uint32_t *version)

get the TOPSPTI API version

Parameters

version[out] the API version

Returns

TopsptiResult

TopsptiResult TopsptiGetVersion(uint64_t *version)

get the TOPSPTI API version

Parameters

version[out] the API version

Returns

TopsptiResult

class topspti::prof::TopsProfiler
#include <topspti_prof_api.h>

topspti prof profiler definition

Public Functions

bool Init()

Init.

Returns

bool

TopsptiResult Start()

start profiling

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_OPERATION if in wrong state

TopsptiResult Stop()

stop profiling

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_OPERATION if in wrong state

TopsptiResult WaitOnProfile(int milliseconds)

wait on runtime process profiling

Returns

TopsptiResult

TopsptiResult Suspend()

suspend profiling

Returns

TopsptiResult

TopsptiResult Resume()

resume profiling

Returns

TopsptiResult

TopsptiResult Cancel()

cancel profiling

Returns

TopsptiResult

TopsptiResult EventEnum(RawStrToStrsMap &events)

enumerate event kinds supported

Parameters

events[out] the event kinds supported

Returns

TopsptiResult

TopsptiResult ActivityEnum(RawStrToStrsMap &acts)

enumerate software prof activity kinds supported

Parameters

acts[out] the activity kinds supported

Returns

TOPSPTI_SUCCESS

TopsptiResult MetricEnum(RawStrToStrsMap &metrics)

enumerate metrics kinds supported

Parameters

metrics[out] the metrics kinds supported

Returns

TopsptiResult

TopsptiResult ActivityGetIdFromName(TopsptiActivityKind &kind, const char *name)

find an activity by name

Example:

TopsptiActivityKind kind = TOPSPTI_ACTIVITY_UNKNOWN;
TopsptiResult ret = ActivityGetIdFromName(kind, "Operator");

Parameters
  • kind[out] the ID of the found activity or undefined if unable to find the activity

  • name – the name of activity to find

Returns

TopsptiResult

TopsptiResult EventGetIdFromName(TopsptiEventKind &kind, const char *name)

find an event by name

Example:

TopsptiEventKind kind = TOPSPTI_EVENT_UNKNOWN;
TopsptiResult ret = EventGetIdFromName(kind, "SIP Busy With Wait");

Warning

experimental API and maybe change later

Parameters
  • kind[out] the ID of the found event or undefined if unable to find the event

  • name – the name of event to find

Returns

TOPSPTI_SUCCESS if success, and TOPSPTI_ERROR_INVALID_PARAMETER if specified name is unrecognized

TopsptiResult ActivityEnable(TopsptiActivityKind kind)

enable collection of a specific kind of activity record

Example:

TopsptiResult ret = ActivityEnable(TOPSPTI_ACTIVITY_GENERAL_OPERATOR);

Parameters

kind – the kind of activity record to enable collecting

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_METRIC if the specified activity kind is unrecognized, and TOPSPTI_ERROR_INVALID_OPERATION if the activity has been enabled already

TopsptiResult ActivityDisable(TopsptiActivityKind kind)

disable collection of a specific kind of activity record

Example:

TopsptiResult ret = ActivityDisable(TOPSPTI_ACTIVITY_GENERAL_OPERATOR);

Parameters

kind – the kind of activity record to disable collecting

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_METRIC if the specified activity kind is unrecognized, and TOPSPTI_ERROR_INVALID_OPERATION if the activity has been disabled already

TopsptiResult ActivityEnable(const char *kind)

enable collection of a specific kind of activity record

Example:

TopsptiResult ret = ActivityEnable("Operator");

Parameters

kind – the kind of activity record to enable collecting

Returns

TopsptiResult

TopsptiResult ActivityDisable(const char *kind)

disable collection of a specific kind of activity record

Example:

TopsptiResult ret = ActivityDisable("Operator");

Parameters

kind – the kind of activity record to disable collecting

Returns

TopsptiResult

TopsptiResult traceDomainEnable(TopsptiTraceDomainKind kind)

enable collection of a specific domain of topstx trace record

Example:

TopsptiResult ret = traceDomainEnable(TOPSPTI_TRACE_DOMAIN_TOPSTX);

Parameters

kind – the domain of topstx trace record to enable collecting

Returns

TopsptiResult

TopsptiResult traceDomainDisable(TopsptiTraceDomainKind kind)

disable collection of a specific domain of topstx trace record

Example:

TopsptiResult ret = traceDomainDisable(TOPSPTI_TRACE_DOMAIN_TOPSTX);

Parameters

kind – the domain of topstx trace record to disable collecting

Returns

TopsptiResult

TopsptiResult EventEnable(TopsptiEventKind kind)

enable collection of a specific kind of event record

Example:

TopsptiResult ret = EventEnable(TOPSPTI_EVENT_SIP_PMC_SIP_BUSY_WITH_WAIT);

Warning

experimental API and maybe change later

Parameters

kind – the kind of event record to enable collecting

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_EVENT if the specified event kind is unrecognized, and TOPSPTI_ERROR_INVALID_OPERATION if the event has been enabled already

TopsptiResult EventDisable(TopsptiEventKind kind)

disable collection of a specific kind of event record

Example:

TopsptiResult ret = EventDisable(TOPSPTI_EVENT_SIP_PMC_SIP_BUSY_WITH_WAIT);

Warning

experimental API and maybe change later

Parameters

kind – the kind of event record to disable collecting

Returns

TOPSPTI_SUCCESS if success, TOPSPTI_ERROR_INVALID_EVENT if the specified event kind is unrecognized, and TOPSPTI_ERROR_INVALID_OPERATION if the event has been disabled already

TopsptiResult EventEnable(const char *kind)

enable collection of a specific kind of event record

Example:

TopsptiResult ret = EventEnable("SIP Busy With Wait");

Warning

experimental API and maybe change later

Parameters

kind – the kind of event record to enable collecting

Returns

TopsptiResult

TopsptiResult EventDisable(const char *kind)

disable collection of a specific kind of event record

Example:

TopsptiResult ret = EventDisable("SIP Busy With Wait");

Warning

experimental API and maybe change later

Parameters

kind – the kind of event record to disable collecting

Returns

TopsptiResult

TopsptiResult Config(const TopsptiProfileConfig &config)

configure profiling

Example:

TopsptiProfileConfig config;
config.output = "/tmp/test.data";
TopsptiResult ret = Config(config);

Parameters

config – software profiling configuration

Returns

TOPSPTI_SUCCESS

TopsptiResult Process(const char *path)

parse raw profiling data from file and compute profiling results

Parameters

path – file path to process from

Returns

TopsptiResult

TopsptiResult Query(RawStrVec *results, const char *table, const char *column)

get the profiling string type results depends on table and column

Parameters
  • results[out] the profiling results

  • table – table name from vpd.

  • column – column name form vpd.

Returns

TopsptiResult

TopsptiResult Query(std::vector<uint64_t> *results, const char *table, const char *column)

get the profiling int type results depends on table and column

Warning

experimental API and maybe change later

Parameters
  • results[out] the profiling results

  • table – table name from vpd.

  • column – column name form vpd.

Returns

TopsptiResult

TopsptiResult Query(::topspti::database::DataBase *&db)

get the profiling results of database proto format

Parameters

db[out] profiling results

Returns

TopsptiResult

1.2. Misc

This section describes the TOPSPTI misc api.

class TopsptiProfileConfig
#include <topspti_obj.h>

profiling software configuration