[英]Confusing perf stat results after multiple runs
I executed a 1000x1000 matrix multiplication code consecutively 6 times along with perf stat -e cache-misses command and got the following results 我与perf stat -e cache-misses命令一起连续执行了1000x1000矩阵乘法代码6次,并得到以下结果
Observation Cache-Misses Time elapsed(sec)
1 48822173 7.697147087
2 48663517 7.710045908
3 48667119 7.701690126
4 48867057 7.766267284
5 48610651 7.701600681
6 49203583 7.719180737
As we can see here, cache-misses for observation 1 is greater than cache-misses in observation 2,3 & 5. But the elapsed time for observation 1 is lesser than observation 2, 3 & 5. On the other hand observation 4 has highest elapsed time among all these observations but cache-misses for observation 4 is lesser than observation 3 and observation 6. According to the textbook, increasing cache-misses elongate the execution time of a program. 正如我们在这里看到的,观察1的缓存丢失比观察2、3和5中的缓存丢失大。但是,观察1的经过时间比观察2、3和5短。在所有这些观察中,经过时间最长,但观察4的高速缓存丢失比观察3和观察6短。根据教科书,增加的高速缓存丢失会延长程序的执行时间。 Then how we can explain this behavior?
那么我们如何解释这种行为呢? Thanks
谢谢
Here is my system details: 这是我的系统详细信息:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Stepping: 7
CPU MHz: 2300.000
BogoMIPS: 4589.89
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
Several tools exist to find the root-cause of your cache misses. 存在多种工具来查找缓存未命中的根本原因。 But a lot of misses does not always mean longer execution time.
但是很多遗漏并不总是意味着更长的执行时间。 It depends also on cache-miss level.
它还取决于缓存未命中级别。
Moreover, it is recommended to do one or two observations runs without collecting statistics to warm caches (ie, filling them with data): subsequent runs will benefit from the first one which had warmed up the cache with necessary data. 此外,建议执行一次或两次观察运行,而无需收集统计信息以预热缓存(即,用数据填充它们):后续运行将受益于第一个运行时使用必要数据预热了缓存的数据。
A tool like dprof
can help you to find causes and performances problems due to cache-misses. 诸如
dprof
类的工具可以帮助您查找由于缓存丢失而导致的原因和性能问题。 Try it. 试试吧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.