我使用这个等式来获得执行时间:
Execution time = Cpu time + memory time
然后,
Execution time = (#instructions * average instruction execution time) +
(Misses Cache l1 * latency L2) +
(Misses Cache l2 * latency access memory).
我开发了一个简单的程序来检查这个方程,伪代码是下一个:
ini_time = get_cepu_time();
Init_Papi_counters;
//intesive computation code (matrix mult)
End_Papi_counters();
end_time = get_cepu_time();
end_time = end_time - ini_time.
获得的值如下:
Execution time: 194,111 sec
Cycles: 568949490685
Instructions: 676850501790
Misses L1: 30666388828
Misses L2: 1743525419
英特尔手册中获得的延迟是:
Acces L2: 4,8 ns
Acces main memory: 110 ns
然后,如果我应用等式:
Misses L1 * Latency l2 = 147 sec
Misses L2 * memory access time = 193 sec
我们可以看到,内存时间分量的总和大于总执行时间:
194 < 147 + 193 ERRORRRRR
您能否帮助我了解如何估算执行时间。