[英]Counting CPU cycles with `perf_event` in C yields different value than `perf`
[英]perf stat frontend and backend cycles showing greater than 100%
我正在嘗試使用perf
對用C語言編寫的代碼進行基准測試,前端空閑周期數超過100%。 我已經看到后端空閑周期也發生了這種情況。 兩者同時超過100。 每個周期的指令數量非常高-從5 - 10
。
3,569,966 stalled-cycles-frontend # 111.98% frontend cycles idle
1,843,327 stalled-cycles-backend # 57.82% backend cycles idle
17,875,020 instructions # 5.61 insns per cycle
# 0.20 stalled cycles per insn
百分比如此之高意味着什么?
這些百分比是相對於活動CPU周期而言的,顯示為cycles
。 因此, cycles
不是總周期,而是活動的CPU周期,並且相對於它計算前端或后端停頓的周期。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.