性能:[<n percent>] 记录在性能统计输出中意味着什么?

Perf: what do [<n percent>] records mean in perf stat output?

perf stat -e <events> <command> 许多不同的事件通常 returns 输出像这样

   127.352.815.472 r53003c                                                      [23,76%]
    65.712.112.871 r53019c                                                      [23,81%]
   178.027.463.861 r53010e                                                      [23,88%]
   162.854.142.303 r5302c2                                                      [24,05%]
   ...

百分比记录是什么意思?

百分比显示在 perf 必须多路复用事件的情况下测量特定事件的时间百分比。事件多路复用在 perf wiki 上有更详细的解释,我在下面包含了一个简短的引用:

If there are more events than counters, the kernel uses time multiplexing (switch frequency = HZ, generally 100 or 1000) to give each event a chance to access the monitoring hardware. Multiplexing only applies to PMU events. With multiplexing, an event is not measured all the time. At the end of the run, the tool scales the count based on total time enabled vs time running.