Overview

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 Data Profiling.

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

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

Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest.

APIs

Specific APIs are listed below.

Table 1 Profiling 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

Encapsulated profiling statement.