Profiling the Host System

msprof supports profiling the host system data, including the CPU usage, memory usage, disk I/O usage, and network I/O usage. It automatically parses the profile data and flush files to the disk.

Command Example (Depending on AI Task Runtime Profiling)

Log in as a running user to the environment where the CANN Toolkit package and ops operator package are installed, and run the profiling command.

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

Command Example (Depending on Ascend AI Processor System Profiling)

Log in as a running user to the environment where the CANN Toolkit package and ops operator package are installed, and run the profiling command.

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

Options

Table 1 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 layer in msprof_*.json and the host_cpu_usage_*.csv file

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

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

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

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

CPU_USAGE in the .db file

HOST_MEM_USAGE in the .db file

HOST_DISK_USAGE in the .db file

HOST_NETWORK_USAGE in the .db file

OSRT_API in the .db 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 is not required and will be ignored for profiling depending on AI task runtime.

Optional

-

--host-sys-usage-freq

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

Optional

-