Overview

This section describes how to collect profile data using APIs in offline inference scenarios. The following collection methods are supported.

Table 1 Collection methods

Collection Method

Description

Method 1: Collecting and flushing profile data

Write the collected profile data to a file, parse the file by using the msprof tool, and display the profile data analysis result.

Method 2: Using the msproftx APIs to collect and flush profile data

To locate the performance bottleneck of your application or the upper-layer framework application, call the msproftx APIs during the profiling process (between the aclprofStart and aclprofStop calls). msproftx is used to record the time span of specific events during application running and write data to a profile data file. You can use the profiling tool to parse the file and export the profile data.

Method 3: Subscribing to operator information

Parse the collected profile data and write it to a pipeline. Then, users read the data to the memory and call APIs to obtain it.

  • Before using the APIs to collect profile data, you need to develop, build, and run an application project. For details, see Application Development Guide (C&C++).
  • If an operator is being executed during initialization (aclprofInit + aclprofStart), error logs may be generated because related resources have not been initialized. However, this does not affect service functions. You are advised to perform stream synchronization before enabling profiling.
  • Methods 1 and 2 cannot be used with method 3.