访存统计分析
访存单元是CPU逻辑中逻辑控制最复杂的单元,该单元负责了处理Load和Store等访存指令执行过程中的各类问题,确保其能够高速完成。访存统计分析提供访存数据统计能力,便于用户查看可能出现性能问题的流程。
命令功能
基于CPU访问缓存和内存的PMU事件,分析存储的访问次数、命中率、带宽等相关情况。
命令格式
1 | devkit tuner memory [-h] [-d <sec>] [-l {0, 1, 2, 3}] [-i <sec>] [-o] [-m {1, 2, 3, 4}] [-P {100, 1000}] [-c {n,m | n-m}] [--package] |
参数说明
参数 |
参数选项 |
说明 |
---|---|---|
-h/--help |
- |
获取帮助信息。 |
-d/--duration |
- |
设置采集时长,单位为秒,最小值为1秒,默认一直采集,可使用Ctrl+\取消任务或Ctrl+C停止采集并进入分析。 |
-l/--log-level |
0/1/2/3 |
设置日志级别,默认为1。
|
-i/--interval |
- |
设置任务的采集间隔(以秒为单位)。最小值为1秒,最大值不能超过采集时长,默认为采集时长。如果不指定间隔,不生成子报告。每个子报告中收集数据的时间取决于间隔参数。 |
-m/--metric |
1/2/3/4 |
设置采样类型,默认为1。
|
-o/--output |
- |
设置报告数据压缩包名称和输出路径,仅输入名称时默认生成在当前所在目录;需和--package配合使用。 |
-c/--cpu |
- |
指定采集的CPU核数,如“0”、“0,1,2”、“0-2”。默认采集所有CPU核。 |
-P/--period |
100/1000 |
设置实际数据采集的间隔。默认为1000毫秒,可选100毫秒和1000毫秒;若采集时长选择1秒,采集间隔的默认值将自动调整为100毫秒。 |
--package |
- |
设置是否在生成报告数据压缩包,不指定压缩包名称和路径时默认在当前所在目录生成memory-时间戳.tar。 |
使用示例
1 | devkit tuner memory -d 2 -o /home/memory_result -m 1 --package |

- 命令参数-d为采集时长2秒,参数-o /home/memory_result和--package生成以memory_result命名的报告数据压缩包至指定路径,参数-m 1为采集所有缓存、DDR访问数据和HBM带宽信息(环境支持采集HBM信息才呈现,不支持则不呈现)。
返回信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | Memory Summary Report-ALL Time:2024/07/22 15:30:16 ================================================================================ System Information ──────────────────────────────────────────────────────────────────── Linux Kernel Version 4.19.25-203.el7.bclinux.aarch64 Cpu Type Kunpeng 920 NUMA NODE(cpus) 0(0-31) 1(32-63) 2(64-95) 3(96-127) Percentage of core Cache miss ──────────────────────────────────────────────────────────────────── L1D 3.47% L1I 0.01% L2D 58.88% L2I 35.26% DDR Bandwidth ──────────────────────────────────────────────────────────────────── ddrc_write 658.03MB/s ddrc_read 16900.26MB/s Memory metrics of the Cache ──────────────────────────────────────────────────────────────────── 1. L1/L2/TLB Access Bandwidth and Hit Rate Value Format: X|Y = Bandwidth | Hit Rate ───────────────────────────────────────────────────────────────────── CPU L1D L1I L2D L2I L2D_TLB L2I_TLB ──────────────────────────────────────────────────────────────────── all 81581.38MB/s|96.53% 201888.73MB/s|99.99% 35588.65MB/s|41.12% 72.89MB/s|64.74% N/A|57.10% N/A|94.37% ──────────────────────────────────────────────────────────────────── 2. L3 Read Bandwidth and Hit Rate ───────────────────────────────────────────────────────────────── NODE Read Hit Bandwidth Read Bandwidth Read Hit Rate ───────────────────────────────────────────────────────────────── 0 369.95MB/s 21079.22MB/s 1.76% 1 10.93MB/s 181.49MB/s 6.02% 2 23.75MB/s 296.73MB/s 8.00% 3 4.17MB/s 110.28MB/s 3.78% ───────────────────────────────────────────────────────────────── Memory metrics of the DDRC ──────────────────────────────────────────────────────────────────── 1. DDRC_ACCESS_BANDWIDTH Value Format: X|Y = DDR read | DDR write DDRC Read Bandwidth Bottleneck: 12500MB/s (for reference only) Exceeding the bottleneck will significantly increase latency. Please refer to README_ZH.md(Chapter 6.7) for specific bottleneck testing configurations. DDRC exceeding bottleneck: [Node 0, DDRC_2, DDR READ] ──────────────────────────────────────────────────────────────────── NODE DDRC_0 DDRC_1 DDRC_2 DDRC_3 Total ──────────────────────────────────────────────────────────────────── 0 0.00MB/s|0.00MB/s 0.00MB/s|0.00MB/s 16779.55MB/s|616.21MB/s 0.00MB/s|0.00MB/s 16779.55MB/s|616.21MB/s 1 0.00MB/s|0.00MB/s 0.00MB/s|0.00MB/s 0.00MB/s| 0.00MB/s 7.55MB/s|5.24MB/s 7.55MB/s| 5.24MB/s 2 0.00MB/s|0.00MB/s 0.00MB/s|0.00MB/s 85.35MB/s| 27.01MB/s 0.00MB/s|0.00MB/s 85.35MB/s| 27.01MB/s 3 0.00MB/s|0.00MB/s 0.00MB/s|0.00MB/s 0.00MB/s| 0.00MB/s 27.80MB/s|9.56MB/s 27.80MB/s| 9.56MB/s ──────────────────────────────────────────────────────────────────── The report /home/memory_result.tar is generated successfully. To view summary report. you can run: devkit report -i /home/memory_result.tar To view detail report. you can import the report to the WebUI or IDE to view details. |
输出报告说明:
报告由七个部分组成,自上而下分别为系统信息、L1/L2缓存平均未命中率信息、总DDR带宽信息、L1/L2缓存带宽和命中率信息、L3缓存读带宽和命中率信息和DDRC带宽信息。
- 系统信息
- L1/L2缓存平均未命中率信息
- 总DDR带宽信息
- L1/L2缓存带宽和命中率信息
如果用户通过-c指定了采集的CPU核,会显示每个CPU核的L1/L2缓存带宽和CPU命中率信息。如果用户未指定-c则默认采集所有CPU核的平均L1/L2缓存带宽和命中率信息。
- L3缓存读带宽和命中率信息
- DDRC带宽信息
显示所有DDR控制器(DDRC)的读写带宽,通常每个NUMA节点会有4个DDRC。
- 访存分析在鲲鹏920服务器测试得到了一组DDR读带宽瓶颈点,用于提示用户当前DDRC读带宽是否达到瓶颈,当DDRC读带宽到达瓶颈时,CPU和DDRC间的时延显著上升。各服务器的DDRC配置基于标准配置测试,其中920服务器的DDRC速率为2933MT/s(仅供参考)。
- 结果中DDRC Bandwidth Bottleneck为带宽瓶颈值(仅供参考),若DDRC_ACCESS_BANDWIDTH表格中有数据超过瓶颈值,将新增一行数据DDRC exceeding bottleneck,以Node_n+DDRC_n+读写类型的方式指明数据位置。
- 当启动BIOS设置中的“one numa per socket”时,一个NUMA节点具有8个DDRC通道,结果报告中带宽显示的DDRC带宽实际对应了两个DDRC带宽,分别属于两个合并后的CPU Die(1个CPU socket下具有2个CPU Die)。