Using a Full Compressed Package or an RPM Package
The Link Latency Detection tool can collect runtime data in Attach mode. This capability is used to load the user-mode function time consumption collection library into a running process. The tool analyzes the collected data, displays the network overview data by analyzing the network I/O characteristics of the application, and locates network issues. It can also analyze and display compatibility information for K-NET.
Prerequisites
- You have installed the Affinity Analyzer tool. For details, see Installing the Tool.
- If you have installed the tool using a compressed package, extract the package and switch to the tool directory. Then run the command in ./ mode, for example, ./devkit advisor knet -h. If you have installed the tool using an RPM package, run devkit advisor knet -h. This section uses an RPM package as an example.
Command Function
- attach command: collects data in Attach mode. After you start an application and specify its PID, the tool collects the application running data.
- compat command: analyzes collected data and displays compatibility information for K-NET.
Syntax
- Viewing the help information:
1devkit advisor knet [-h | --help]
- Collecting data:
1devkit advisor knet {attach} {-p PROCESS_ID} {-o OUTPUT_DIR_PATH} [-i CONF_FILE_PATH] [--hotspot] [-d <duration>] [-n <top_n>] [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]
- Analyzing and displaying compatibility information:
1devkit advisor knet {compat} {-d DIR_OF_RECORDED_DATA} {-c JSON_CONF_FILE_PATH} [-l {0,1,2,3} | --log-level {0,1,2,3}] [--set-timeout TIMEOUT]
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. This parameter is optional. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 1. This parameter is optional.
|
--set-timeout |
- |
Timeout interval of a task, in minutes. If the execution duration exceeds the timeout interval, the task exits. This parameter is optional. By default, there is no timeout interval. The task will be executed until it is complete. |
Parameter |
Description |
|---|---|
-p |
Application PID. This parameter is mandatory. |
-i |
Configuration file, which specifies the path to the configuration file of the functions to be recorded. This parameter is optional. For details about the configuration file format, see Configuration File (RECORD_CONF). NOTE:
Use at least one of the -i and --hotspot parameters. If the specified function in the configuration file is the same as the automatically collected hotspot function, the output results will be deduplicated. |
-o |
Data file output directory. This parameter is mandatory. For details about the data file format, see 5. |
--hotspot |
Automatically identifies and collects hotspot functions of the application. This parameter is optional. NOTE:
Use at least one of the -i and --hotspot parameters. If the specified function in the configuration file is the same as the automatically collected hotspot function, the output results will be deduplicated. |
-d |
Hotspot collection duration, which defaults to 5 seconds. This parameter is optional. NOTE:
It takes effect when the --hotspot parameter is used. |
-n |
Top N hotspot functions to be collected. This parameter is optional and its default value is 5. If more than five hotspot functions are collected, only the top five are displayed. If no more than five hotspot functions are collected, the actual number of hotspot functions is displayed. NOTE:
It takes effect when the --hotspot parameter is used. |
Parameter |
Description |
|---|---|
-d |
Data file directory. This parameter is mandatory. |
-c |
Path to the compatibility configuration file in JSON format. This parameter is mandatory. NOTE:
The tool provides the configuration file template compat_conf.json, which is stored in the /path/to/DevKit-CLI/advisor/devkitplugins/affinity/tools/compileopt/templates/compat_conf.json directory. /path/to/DevKit-CLI/ indicates the installation path of the command line tool. |
Example
- Collect data based on the PID.
1devkit advisor knet attach -p 17979 -i /home/my_app.conf -o /home/data
The -p option specifies the ID of the process to be collected, the -i option specifies the configuration file path, and the -o parameter specifies the directory for storing the collected data file.
- Analyze and display compatibility information.
1devkit advisor knet compat -d /home/data -c /home/demo/compat_conf.json
You can obtain the compat_conf.json file template from advisor/devkitplugins/affinity/tools/compileopt/templates/compat_conf.json in the tool installation path.