Overview

API Description

The msServiceProfiler module offers C++ APIs for profiling inference services.

For details about the functions and usage examples of these APIs, see Data Collection.

Header file: $\{INSTALL_DIR\}/include/msServiceProfiler.h

Library file: $\{INSTALL_DIR\}/lib64/libms_service_profiler.so

Replace $\{INSTALL\_DIR\} with the CANN software installation path. For example, if the installation is performed by the root user, the path is /usr/local/Ascend/cann.

API List

APIs are listed below.

Table 1 msServiceProfiler APIs (C++)

API Description
IsEnable Determines whether to enable profiling.
SpanStart Records the start point of a process.
SpanEnd Records the end point of a process.
Metric Records a metric value.
MetricInc Records an incremental metric value.
MetricScope Defines a metric scope.
MetricScopeAsReqID Sets the metric scope to the request level.
MetricScopeAsGlobal Defines the scope of a metric class as global.
Launch Flushes the request record to the disk.
Event Records an event.
Link Records the association between different resources.
Attr series Adds an attribute and returns the current object, allowing multiple method calls to be chained together.
ArrayResource Adds key attributes of array resources.
Resource Assigns a resource ID, where data and timeline are associated based on the resource ID.
Domain Specifies a domain for the data, where records with the same domain are grouped together in trace data.
NumArrayAttr Adds an array attribute that accepts only numeric values.
ArrayAttr Adds an array attribute through a callback function.
GetMsg Obtains the currently recorded data.
Macro Definitions Encapsulated profiling statement.