perf stat中循环注释的含义是什么

what's the meaning of cycles annotation in perf stat

      8.014196 task-clock                #    0.004 CPUs utilized          
           204 context-switches          #    0.025 M/sec                  
            32 cpu-migrations            #    0.004 M/sec                  
             0 page-faults               #    0.000 K/sec                  
    11,841,196 cycles                    #    1.478 GHz                     [46.17%]
     9,982,788 stalled-cycles-frontend   #   84.31% frontend cycles idle    [80.26%]
     8,122,708 stalled-cycles-backend    #   68.60% backend  cycles idle   
     5,462,302 instructions              #    0.46  insns per cycle        
                                         #    1.83  stalled cycles per insn
     1,098,309 branches                  #  137.045 M/sec                  
        94,430 branch-misses             #    8.60% of all branches         [77.23%]

循环注释中的1.478 GHz[46.17%]是什么意思

这是我在 perf 上非常讨厌的事情,文档和手册页已经过时并且搜索某些值的含义非常复杂。我确实搜索过一次,所以我添加了我的发现:

what's the meaning of 1.478 GHz

据我所知,# 之后的值是将本机计数器值(第一列中的值)重新计算为用户可读的形式。该值应大致对应于处理器的时钟速度:

grep MHz /proc/cpuinfo

应该给出相似的值。它是从 tools/perf/util/stat-shadow.c.

打印的

and [46.17%] in cycles's annotation?

此值应对应于硬件计数器处于活动状态的时间部分。 Perf 允许启动更多的硬件计数器并在运行时对其进行多路复用,这使程序员更容易。

我没有找到代码中的实际位置,但最近 proposed patch 中将其描述为(csv 格式的一部分):

+   - percentage of measurement time the counter was running