【发布时间】:2018-11-18 16:47:46
【问题描述】:
以下answer about Benchmarking - How to count number of instructions sent to CPU to find consumed MIPS 建议:
perf stat ./my_program在 Linux 上将使用 CPU 性能计数器 记录它运行了多少条指令,以及它有多少个核心时钟周期 拿。 (以及它使用了多少 CPU 时间,并将计算 MIPS 你)。
一个示例生成以下不包含计算的MIPS 信息的输出。
Performance counter stats for './hello.py':
1452.607792 task-clock (msec) # 0.997 CPUs utilized
327 context-switches # 0.225 K/sec
147 cpu-migrations # 0.101 K/sec
35,548 page-faults # 0.024 M/sec
2,254,593,107 cycles # 1.552 GHz [26.64%]
<not supported> stalled-cycles-frontend
<not supported> stalled-cycles-backend
1,652,281,933 instructions # 0.73 insns per cycle [38.87%]
353,431,039 branches # 243.308 M/sec [37.95%]
18,536,723 branch-misses # 5.24% of all branches [38.06%]
612,338,241 L1-dcache-loads # 421.544 M/sec [25.93%]
41,746,028 L1-dcache-load-misses # 6.82% of all L1-dcache hits [25.71%]
25,531,328 LLC-loads # 17.576 M/sec [26.39%]
1,846,241 LLC-load-misses # 7.23% of all LL-cache hits [26.26%]
1.456531157 seconds time elapsed
[Q] 如何从perf stat 的输出中正确计算MIPS?为了计算 MIPS,我应该从 perf stat 获得的值遵循 instructions/seconds_time_elapsed 吗?
【问题讨论】:
标签: performance profiling mips cpu perf