Data Parsing

Function

Parse the serving profile data.

Precautions

  • During profiling, the flushed files are locked. Parsing can be started only after the profiling is complete, or the error message "db is lock" will be displayed.
  • Do not enable dynamic profiling again before data parsing is complete, as this may deteriorate profiling performance.
  • The following versions are required for data parsing:
    • Python 3.10 or later
    • pandas 2.2 or later
    • NumPy 1.24.3 or later
    • psutil 5.9.5 or later
    • Matplotlib 3.7.5 or later
    • SciPy 1.7.2 or later

Command Format

python3 -m ms_service_profiler.parse --input-path <input-path> [options]

For details about the options, see Options.

Options

Table 1 Options

Option

Description

Required (Yes/No)

--input-path

Path to profile data. All databases named msproftx.db, ascend_service_profiler_*.db, and ms_service_*.db in the path will be read.

Yes

--output-path

Output path for parsed files. It defaults to the output directory in the current path.

No

--log-level

Log level. The options are as follows:

  • debug: debug level. Logs at this level record the debugging information for developers or maintenance personnel to locate faults.
  • info: normal level. Logs at this level record information about proper tool running. This is the default value.
  • warning: warning level. Logs of this level record information when the tool does not run in an expected state, but the running of the process is not affected.
  • error: minor error level.
  • fatal: fatal error level.
  • critical: critical error level.

No

--format

Format of the exported profile data file. The options are as follows:

  • csv: Export only result files in .csv format. This format is used when the amount of flushed raw data is too large (> 10 GB). Exporting result files in this format can reduce the data parsing time. The files contain the request scheduling time, model execution duration, and KV cache memory usage of each round.
  • json: Export only result files in .json format. This format only is used when the trace data is used for analysis. Exporting result files in this format can reduce the data parsing time. The files contain the timeline of the entire inference process of the serving framework.
  • db: Export only result files in .db format. This format is only used when MindStudio Insight is used to analyze result data. The files contain the full data parsing result and can be directly displayed in MindStudio Insight.

If this parameter is not specified, all result files are exported by default. You can specify one or more formats. For example, --format db or --format db csv.

NOTE:

If acl_task_time is set to 2 during profiling, the parsing result files can be exported only in .json or .db format.

No

Example

Run the following command to perform basic parsing on profile data:

python3 -m ms_service_profiler.parse --input-path ${PATH}/prof_dir/

In addition to basic parsing, performance data can be parsed from multiple dimensions (request, batch, and overall service), and data of different batches can be parsed into fine-grained performance data.

Output Description

After the parsing command is executed, the files are generated in the path specified by --output-path. For details about the files, see Parsing Results.