微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

为什么不执行报告caching未命中?

根据perf教程 , perf stat应该使用硬件计数器报告caching未命中。 但是,在我的系统上(最新的Arch Linux),它并没有:

[joel@panda goog]$ perf stat ./hash Performance counter stats for './hash': 869.447863 task-clock # 0.997 cpus utilized 92 context-switches # 0.106 K/sec 4 cpu-migrations # 0.005 K/sec 1,041 page-faults # 0.001 M/sec 2,628,646,296 cycles # 3.023 GHz 819,269,992 stalled-cycles-frontend # 31.17% frontend cycles idle 132,355,435 stalled-cycles-backend # 5.04% backend cycles idle 4,515,152,198 instructions # 1.72 insns per cycle # 0.18 stalled cycles per insn 1,060,739,808 branches # 1220.015 M/sec 2,653,157 branch-misses # 0.25% of all branches 0.871766141 seconds time elapsed

我错过了什么? 我已经search了手册页和网页,但没有发现任何明显的东西。

编辑:我的cpu是英特尔i5 2300K,如果这件事。

你知道任何工具,如smush.it我可以在命令行?

在调整PHP图像大小时,服务器负载增加

Pagespeed调整图像质量低

优化C ++二维数组

定时Linux内核启动时间优化

优化一个sqlite数据库一个数据在其中的提示

如何在XPerf中定位空闲时间(和networkingIO时间等)?

Linux inotify API的效率如何?

为什么gcc用-O0做一些优化

如何在linux中打败core i3 / i7中的硬件预取器

在我的系统上, Intel Xeon X5570 @ 2.93 GHz我能够得到perf stat报告缓存引用和未命中通过明确地要求这些事件

perf stat -B -e cache-references,cache-misses,cycles,instructions,branches,faults,migrations sleep 5 Performance counter stats for 'sleep 5': 10573 cache-references 1949 cache-misses # 18.434 % of all cache refs 1077328 cycles # 0.000 GHz 715248 instructions # 0.66 insns per cycle 151188 branches 154 faults 0 migrations 5.002776842 seconds time elapsed

认的一组事件不包括缓存事件,匹配你的结果,我不知道为什么

perf stat -B sleep 5 Performance counter stats for 'sleep 5': 0.344308 task-clock # 0.000 cpus utilized 1 context-switches # 0.003 M/sec 0 cpu-migrations # 0.000 M/sec 154 page-faults # 0.447 M/sec 977183 cycles # 2.838 GHz 586878 stalled-cycles-frontend # 60.06% frontend cycles idle 430497 stalled-cycles-backend # 44.05% backend cycles idle 720815 instructions # 0.74 insns per cycle # 0.81 stalled cycles per insn 152217 branches # 442.095 M/sec 7646 branch-misses # 5.02% of all branches 5.002763199 seconds time elapsed

在最新的源代码中 ,认事件不再包括cache-misses和cache-references :

struct perf_event_attr default_attrs[] = { { .type = PERF_TYPE_SOFTWARE,.config = PERF_COUNT_SW_TASK_CLOCK },{ .type = PERF_TYPE_SOFTWARE,.config = PERF_COUNT_SW_CONTEXT_SWITCHES },.config = PERF_COUNT_SW_cpu_MIGRATIONS },.config = PERF_COUNT_SW_PAGE_FAULTS },{ .type = PERF_TYPE_HARDWARE,.config = PERF_COUNT_HW_cpu_CYCLES },.config = PERF_COUNT_HW_STALLED_CYCLES_FRONTEND },.config = PERF_COUNT_HW_STALLED_CYCLES_BACKEND },.config = PERF_COUNT_HW_INSTRUCTIONS },.config = PERF_COUNT_HW_BRANCH_INSTRUCTIONS },.config = PERF_COUNT_HW_BRANCH_MISSES },};

所以这个男人和大多数的网络已经过时了。

我已经花了几分钟的时间去了解perf 。 通过首先记录并报告数据(都包括perf工具),我发现了缓存未命中。

要查看事件列表:

perf list

例如,为了切断最后一级缓存加载失败,您将要使用事件LLC-loads-misses这样的事情

perf record -e LLC-loads-misses ./your_program

然后报告结果

perf report -v

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐