Overview

API Introduction

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

For details about the functions and usage examples of the inference service profiling APIs, see Profiling.

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

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

Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.

API List

Specific APIs are listed below.

Table 1 msServiceProfiler APIs (C++)

API

Description

IsEnable

Determines whether to enable profiling.

SpanStart

Records the start node of a process.

SpanEnd

Records the end node of a process.

Metric

Records the value of a metric class.

MetricInc

Records the increment of a metric class.

MetricScope

Defines the scope of a metric class.

MetricScopeAsReqID

Defines the scope of a metric class as the request ID.

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. Chain calls are supported.

ArrayResource

Adds key attributes of array resources.

Resource

Assigns a unique resource ID to link the data with its corresponding timeline.

Domain

Defines the domain of the data. Entries in the same domain form a category in the trace data.

NumArrayAttr

Adds an array attribute that accepts only numeric values.

ArrayAttr

Adds an array attribute through a callback function.

GetMsg

Obtains the current record data.

Macro definition

Encapsulates profiling statements.