5

We have an algorithm which is performing poorly and we believe it's because of CPU cache misses. Nevertheless, we can't prove it because we don't have any way of detecting them. Is there any way to tell how many CPU cache misses an algorithm produces? We can port it to any language which could allow us to detect them.

Thanks in advance.

4

2 回答 2

2

找出此类问题的最简单方法是使用分析器并收集与缓存相关的性能计数器。

我建议检查以下工具:

是否可以看到算法的整体结构(如果不是太长)?

于 2012-01-05T23:37:12.503 回答
0

英特尔 CPU 保留性能计数器,您可以使用一些汇编指令提取这些计数器。

您能否(1)在静止系统上进行基线缓存未命中,(2)运行程序并进行比较?

有关您必须编写的汇编程序,请参阅Intel 指令集参考第 18 页第 15 页 (18-15) 的第 3B 卷。

于 2012-01-05T14:30:16.273 回答