record子命令
命令功能
采集指定进程的数据,包括CPU微架构性能事件、函数调用链追踪信息以及内存访问数据,生成数据文件。
命令格式
./devopt.sh record [-h] -p/--pid PID [-d <sec>] [-I <msec>] [-f <freq>] [-o OUTPUT] [-t <sec>] [-m] [-i INPUT]
参数说明
参数 |
参数选项 |
说明 |
|---|---|---|
-h/--help |
- |
可选参数,获取帮助信息。 |
-p/--pid |
- |
必选参数,指定采集的进程 |
-d/--duration |
- |
可选参数,指定采集时长,单位为s,取值范围为1 ~ 2,147,483,647,默认值为10s。 |
-f/--frequency |
- |
可选参数,指定采样频率,单位为Hz,取值范围为1 ~ 2,147,483,647,默认值为1000Hz。 |
-I/--interval |
- |
可选参数,指定读取采样数据的间隔,单位为ms,取值范围为1 ~ 2,147,483,647,默认为1000ms。 |
-o/--output |
- |
可选参数,指定数据文件的存放路径,默认为当前命令执行的路径。 |
-t/--trace |
- |
可选参数,指定函数调用链追踪时长,单位为s,取值范围为1 ~ 2,147,483,647,默认值为1s。 |
-m/--memory |
- |
可选参数,用于启用精细化内存采集模式,进行伪共享检测。 说明:
启用精细化内存采集模式时必须选择参数“-i”,不支持选择参数“-f”和参数“-o”。 |
-i/--input |
- |
可选参数,用于启用精细化内存采集模式时,指定输入的数据文件。 |
使用示例
- 执行以下命令,查看record命令支持的功能信息:
./devopt.sh record -h
返回信息如下:
USAGE devopt.sh record [-h] -p/--pid PID [-d <sec>] [-I <msec>] [-f <freq>] [-o OUTPUT] [-t <sec>] [-m] [-i INPUT] DESCRIPTION Collects data of a specified process and generates a data file. OPTIONS -h, --help Displays help information and exits. -p PID, --pid PID Specifies the process ID. -d <sec>, --duration <sec> Specifies the collection duration, in seconds. The default value is 10s. -f <freq>, --frequency <freq> Specifies the sampling frequency. The default value is 1,000. -I <msec>, --interval <msec> Specifies the interval for reading sampled data, in milliseconds. The default value is 1,000. -o OUTPUT, --output OUTPUT Specifies the data file output directory. It defaults to the current directory. -t <sec>, --trace <sec> Specifies the function tracing duration, in seconds. The default value is 1s. -m, --memory Enables the refined memory collection mode. -i INPUT, --input INPUT Specifies the original data file. This parameter is mandatory for the refined memory collection mode. EXAMPLES # Collect the function-level top-down data, time consumption, and tracing information of a specified process. devopt.sh record -p pid -d 1 -f 4000 -o /home/output # Enable the refined memory collection mode to collect data and detect false cache sharing. devopt.sh record -p pid -d 1 -m -i /home/output/devopt_pid_timestamp.rawdata NOTES # If false-sharing results in memory collection mode are unexpectedly low and cpuidle driver is not none, # temporarily disable CPU deep idle before ARM SPE collection to avoid possible SPE data loss: # for f in $(find /sys/devices/system/cpu -path "*/cpuidle/state*/disable" ! -path "*/state0/*"); do echo 1 > "$f"; done # Restore after collection by replacing `echo 1` with `echo 0` in the command above. BIOS LPI settings can also be modified; see the FAQ for details.
- 采集指定进程的基础性能数据。
1./devopt.sh record -p 3315674 -f 4000 -d 5 -o /home/output
进程PID为3315674,采样频率指定为4000Hz,采集时间指定为5s,在“/home/output”下生成数据文件。
返回信息如下:
Saved the record data to /home/output/devopt_3315674_20260513155321.rawdata
- 启用精细化内存采集模式,基于数据文件进行精细化内存分析。
./devopt.sh record -p 3315674 -d 5 -m -i /home/output/devopt_3315674_20260513155321.rawdata
执行上述命令会读取数据文件中的基础性能数据,启动伪共享检测工具进行精细化内存采集,分析检测伪共享问题,将检测结果追加到原始数据文件中。
返回信息如下:
Possible false sharing detected
显示结果表明分析成功,检测到可能的伪共享问题。
父主题: 命令及参数说明