我想在运行一个特定程序 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/