Profiling msproftx Data

Use the following APIs to locate the bottlenecks of your application or the upper-layer framework.

You can use either mstx or msproftx APIs. The mstx APIs are recommended.

Track event durations during application runtime and save them to the profile data file.

Procedure (mstx APIs)

  1. Call the mstx APIs in the user application.

    The APIs track event durations during application runtime and save them to the profile data file.

  2. Log in as the running user to the environment where the CANN Toolkit package and ops operator package are located and run the following commands to collect profile data:
    • Collect all profile data (including the data in the default and custom domains):
      msprof --msproftx=on /home/projects/MyApp/out/main
    • To collect the profile data of specific domains, add --mstx-domain-include or --mstx-domain-exclude.
      # The user application calls the APIs prefixed by mstxDomain to profile domains. You can configure -- mstx-domain-include to output data of required domains.
      msprof --msproftx=on --mstx-domain-include=a,b,c /home/projects/MyApp/out/main
      # a, b, and c indicate the domains to be profiled. Use commas (,) to separate them.

      Or

      # The user application calls the APIs prefixed by mstxDomain to profile domains. You can configure --mstx-domain-exclude to filter out data of unnecessary domains.
      msprof --msproftx=on --mstx-domain-exclude=a,b,c /home/projects/MyApp/out/main
      # a, b, and c indicate the domains you do not want to profile. Use commas (,) to separate them.

      The profiling of mstx data requires the passing of a user application.

Procedure (msproftx APIs)

  1. Call the msproftx APIs within the profiling process (between the aclprofStart and aclprofStop calls).

    The APIs track event durations during application runtime and save them to the profile data file.

  2. Log in as the running user to the environment where the CANN Toolkit package and ops operator package are located and run the following commands to collect profile data:
    msprof --msproftx=on /home/projects/MyApp/out/main

    The profiling of msproftx data requires the passing of a user application.

Options

Table 1 Options

Option

Description

Required/Optional

--msproftx

Switch that controls the msproftx user application and upper-layer framework to output profile data, either on or off (default).

Required

--mstx-domain-include

Outputs data of required domains. When the user application calls the APIs prefixed by mstxDomain, you can configure this option to output only the data of the specified domains.

Set the switch to the name of the mstxDomainCreateA API. You can specify multiple domains and separate them with commas (,). default indicates the default domain.

Configure --msproftx=on.

This option is mutually exclusive with --mstx-domain-exclude. Do not configure both options.

If neither this option nor --mstx-domain-exclude is configured, data of all domains is profiled.

If a domain that does not exist in the program is configured, the profiling result does not contain data of this domain.

Optional

--mstx-domain-exclude

Filters out data of unnecessary domains. When the user application calls the APIs prefixed by mstxDomain, you can configure this option to filter out the data of the specified domains.

Set the switch to the name of the mstxDomainCreateA API. You can specify multiple domains and separate them with commas (,). default indicates the default domain.

Configure --msproftx=on.

This option is mutually exclusive with --mstx-domain-include. Do not configure both options.

If neither this option nor --mstx-domain-include is configured, data of all domains is profiled.

Optional

For the profile data generated after options for collecting the msproftx data are configured, see msproftx Data Description and MSTX_EVENTS in the .db file.