Collecting msproftx Data

To locate performance bottlenecks of an application or an upper-layer framework program, you can use specific APIs to track event durations during application execution and save them to the profile data file.

You can use the mstx or msproftx API for profiling. The mstx API is recommended.

The Ascend PyTorch Profiler API does not support profiling via the msprof command-line tool with --msproftx=on. Use the MSTX API of Ascend PyTorch Profiler directly.

Prerequisites

Call the mstx or msproftx API in the user application code to record the time span of specific events during application execution.

Command Format

Log in to the operating environment and run the following command:

msprof [options] <app>
Or msprof [options] --application=<app>

To collect MSTX data, a user program must be passed in. For details about app, see app Parameters. For details about options, see Command-line Options.

Command-line Options

Example

Log in to the operating environment and run the following command in any directory:
msprof --msproftx=on /home/projects/MyApp/out/main

The PROF_XXX directory is generated in the directory specified by --output to store the automatically parsed performance data. For details about the result files, see the msproftx Data Description and MSTX_EVENTS table in the .db file.