c - L2 高速缓存行未命中计数

标签 c linux performance-testing cpu-architecture cpu-cache

我想在运行一个特定程序 A 时计算 L2 缓存未命中总数。有什么方法可以找到 L2 缓存中的缓存未命中数吗?

我知道了,Core i7 CPU 的性能计数器事件类型“L2_LINES_OUT”可用于计算驱逐的 L2 缓存行,但不知道如何使用它?

我正在使用 linux 和 Intel i7 IvyBridge 机器。

任何指针或链接将不胜感激。

最佳答案

根据 this summary ,您可以使用 l2_rqsts 子事件:

0x01: (name=demand_data_rd_hit) Demand Data Read requests that hit L2 cache
0x03: (name=all_demand_data_rd) Demand Data Read requests
0x04: (name=rfo_hit) RFO requests that hit L2 cache
0x08: (name=rfo_miss) RFO requests that miss L2 cache
0x0c: (name=all_rfo) RFO requests to L2 cache
0x10: (name=code_rd_hit) L2 cache hits when fetching instructions, code reads.
0x20: (name=code_rd_miss) L2 cache misses when fetching instructions
0x30: (name=all_code_rd) L2 code requests
0x40: (name=pf_hit) Requests from the L2 hardware prefetchers that hit L2 cache
0x80: (name=pf_miss) Requests from the L2 hardware prefetchers that miss L2 cache
0xc0: (name=all_pf) Requests from L2 hardware prefetchers 

您可以只使用 - (all_demand_data_rd - demand_data_rd_hit) 来计算未命中的需求

关于c - L2 高速缓存行未命中计数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21216088/

相关文章:

c - 代码在输出 C 处无法正常工作

c - 位掩码与位中的 "accessing an array"相当吗?

c - 将 32 位 ARM 代码迁移到 64 位开发环境

firefox - 性能测试: YSlow on Firefox 37

performance - 使用加特林将条件放入 HTTP 请求中

performance-testing - Gatling:从报告中排除准备请求

c - 使用 C 语言在 SBC 中编写 i2c 接口(interface)

c - 三角形上的光线追踪球体阴影

linux - 如何在目录中单独获取最新的文件名?

linux - redhat enterprise 6.1 Linux 兼容软件