cache_calibrator
cache_calibrator 可以测量 cache 相关的性能参数。
安装 cache_calibrator:
apt install -y cache-calibrator
ICE-EVB 开发板测试:
cache_calibrator 1200 10M file
在 ICE-EVB 开发板上运行结果如下:
Calibrator v0.9e
(by Stefan.Manegold@cwi.nl, http://www.cwi.nl/~manegold/)
e16a9010 274364796944 4096 16
e16a9fff 274364801023 4096 4095
e16aa000 274364801024 4096 0
MINTIME = 10000
analyzing cache throughput...
range stride spots brutto- netto-time
10485760 8 1310720 17472 273
analyzing cache latency...
range stride spots brutto- netto-time
10485760 8 1310720 139776 273
analyzing TLB latency...
range stride spots brutto- netto-time
1474560 1152 1280 18176 1136
CPU loop + L1 access: 2.50 ns = 3 cy
( delay: 0.00 ns = 0 cy )
caches:
level size linesize miss-latency replace-time
1 64 KB 128 bytes 9.19 ns = 11 cy 9.16 ns = 11 cy
2 2 MB 128 bytes 19.05 ns = 23 cy 19.09 ns = 23 cy
TLBs:
level #entries pagesize miss-latency
1 20 4 KB 3.34 ns = 4 cy
# ls
file.cache-replace-time.gp
file.TLB-miss-latency.data
file.TLB-miss-latency.gp
file.cache-miss-latency.data
file.cache-miss-latency.gp
file.cache-replace-time.data
其中 1200表示 1200MHz,也就是 1.2GHz,也即 ICE 开发板的 CPU 频率;跑完后生成了很多以“file”开头的文件,可以观测 cache 各个方面的性能。