我正在尝试在我的主机上执行 perf。
操作系统:Ubuntu 15.04
性能命令:
perf stat -B -e cache-references,cache-misses,cycles,instructions,branches,faults,migrations sleep 5
Performance counter stats for 'sleep 5':
结果:缓存未命中 100%
CPU:英特尔至强处理器 D-1520
我还没有弄清楚为什么缓存未命中率可以达到 100%,但我怀疑这个问题可能与 CPU 有关。有什么想法吗?
我不确定 cachegrind 是否会进行与 perf 类似的缓存分析。在 cachegrind 中,一切正常,与其他平台相比,我的平台没有太大差异。
缓存研磨消息
CPU 信息
最佳答案
只是想分享我在 Ubuntu 15.04 64 位机器 Intel i7-3770 CPU 上的测试。测试似乎没问题。
perf stat -B -e cache-references,cache-misses,cycles,instructions,branches,faults,migrations sleep 5`
Performance counter stats for sleep 5:
15,375 cache-references
1,790 cache-misses # 11.642 % of all cache refs
897,607 cycles
684,540 instructions # 0.76 insns per cycle
139,092 branches
58 faults
0 migrations
5.001000990 seconds time elapsed
我电脑上的 Linux 内核版本:
$ uname -a
Linux plex 3.19.0-26-generic #28-Ubuntu SMP Tue Aug 11 14:16:32 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
已安装软件以安装 perf:
sudo apt-get install linux-tools-common
sudo apt-get install linux-tools-generic
sudo apt-get install linux-tools-3.19.0-26-generic
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 58
Model name: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
Stepping: 9
CPU MHz: 1601.851
CPU max MHz: 3900.0000
CPU min MHz: 1600.0000
BogoMIPS: 6784.60
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
关于linux - 运行 perf 进行测试 - 缓存未命中 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32883828/