Overview

This section describes how to use APIs to perform profiling in offline inference scenarios. The following methods are supported.

Table 1 Profiling methods

Profiling 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 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 acl.prof.start and acl.prof.stop 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 msprof 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.

Note: For details about the APIs, see Profiling Data Collection.

  • Before using the APIs to collect profile data, you need to develop, build, and run an application project.
  • Methods 1 and 2 cannot be used together with method 3.