linux - 运行 perf 进行测试 - 缓存未命中 100%

标签 linux performance caching cpu-cache perf

我正在尝试在我的主机上执行 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 有关。有什么想法吗?


工作量 enter image description here

性能消息 enter image description here


我不确定 cachegrind 是否会进行与 perf 类似的缓存分析。在 cachegrind 中,一切正常,与其他平台相比,我的平台没有太大差异。

缓存研磨消息

enter image description here

CPU 信息

enter image description here

最佳答案

只是想分享我在 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/

相关文章:

javascript - 如何使用 AngularJS $templateCache.get()?

http - 如何缓存 api 响应?

java - java动态缓存和静态缓存的区别

linux - 使用grep查找linux中所有.c文件

linux - Sed - 如何切换一行中的两个单词

c++ - 新手,acquireLock() 到底是什么,它的目的是什么?

c - 在 CentOS 上增加管道内部缓冲区大小

javascript - 使用angularjs隐藏表列的最有效方法

java - 在 Java 中,我应该使用 ArrayList<Long> 还是 long[] ?

Javascript/Jquery 在循环中获取位置很慢