Collecting Host-side System Data

msprof supports the collection of host-side system data, including the CPU usage, memory usage, disk I/O usage, and network I/O usage. After the collection, it automatically parses the profile data and flush corresponding files to disks.

Command Example (Depending on AI Job Runtime Profiling)

Log in to the environment where the Ascend-CANN-Toolkit is located as the running user and run the profile data collection command after operations in Environment Setup are complete.

msprof --output=/home/projects/output --host-sys=cpu /home/projects/MyApp/out/main

Command Example (Depending on Ascend AI Processor System Data Collection)

Log in to the environment where the Ascend-CANN-Toolkit is located as the running user and run the profile data collection command after operations in Environment Setup are complete.

msprof --output=/home/projects/output --sys-devices=<ID> --sys-period=<period> --sys-hardware-mem=on --host-sys-pid=<pid> --host-sys=cpu

Command-line Options

Table 1 Command-line options

Option

Description

Required/Optional

Result File

--host-sys

Host-side system profile data collection option (or options separated by commas), selected from cpu, mem, disk, network, and osrt. To set this option, you must set host-sys-pid or pass a user application. The arguments are as follows:

  • cpu: process CPU usage
  • mem: process memory usage
  • disk: process disk I/O usage
  • network: network I/O usage
  • osrt: process syscall and pthreadcall

Example: --host-sys=cpu,mem,disk,network

NOTE:
  • To collect host-side disk profile data, install the third-party open-source tool iotop. To collect osrt profile data, install the third-party open-source tools perf and ltrace. For details about how to install the tools, see Installing perf, iotop, and ltrace. After the installation is complete, refer to Configuring User Permissions to configure user permissions. You need to reconfigure the permissions each time you reinstall the CANN software package.
  • Using ltrace to collect the osrt profile data may cause high CPU usage. In addition, using this tool is related to the application's pthread locking and unlocking, which may affect the process running speed.
  • Kylin V10 SP1 of the x86_64 architecture supports the --host-sys=osrt option, while Kylin V10 SP1 of the AArch64 architecture does not.
  • The --host-sys=network option is not supported in the virtualization environment of EulerOS 2.9.

Either --host-sys or --host-sys-usage must be specified.

The CPU Usage level in msprof_*.json and the host_cpu_usage_*.csv file

The Memory Usage level in msprof_*.json and the host_mem_usage_*.csv file

The Disk Usage level in msprof_*.json and the host_disk_usage_*.csv file

The Network Usage level in msprof_*.json and the host_network_usage_*.csv file

The OS Runtime API level in msprof_*.json and the os_runtime_statistic_*.csv file

--host-sys-usage

Host-side system and process profile data collection option (or options separated by commas), selected from cpu and mem. If the host-sys-pid option is also configured, the CPU or memory usage of a specified process on the host is collected. The values are described as follows:

  • cpu: CPU usage of the system and all processes.
  • mem: memory usage of the system and all processes.

Example: --host-sys-usage=cpu,mem

Either --host-sys or --host-sys-usage must be specified.

System CPU usage on the host

CPU usage of processes on the host

System memory usage on the host

Memory usage of processes on the host

--host-sys-pid

PID of the host-side application to profile.

This option does not need to be set in collection depending on AI job runtime Profiling.

Optional

-

--host-sys-usage-freq

CPU and memory usage sampling frequency (Hz). Defaults to 50. Must be in the range [1, 50].

Optional

-