q57259028
q57259028

Reputation: 59

Why does the CPU utilization analyzed by pref is larger than 1?

q@centos:~/QQMail/platform/task/task2>perf stat bazel-bin/test

 Performance counter stats for 'bazel-bin/test':

      16380.991838      task-clock (msec)         #    3.430 CPUs utilized          
           583,363      context-switches          #    0.036 M/sec                  
               227      cpu-migrations            #    0.014 K/sec                  
            37,899      page-faults               #    0.002 M/sec                  
                 0      cycles                    #    0.000 GHz                    
                 0      stalled-cycles-frontend   #    0.00% frontend cycles idle   
                 0      stalled-cycles-backend    #    0.00% backend  cycles idle   
                 0      instructions              #    0.00  insns per cycle        
                 0      branches                  #    0.000 K/sec                  
                 0      branch-misses             #    0.000 K/sec                  

       4.775427302 seconds time elapsed

The output is shown above. I want to know what does the task-clock output by perf mean? Why is it longer than the time elapsed? And some data are 0, what might be wrong?

Upvotes: 0

Views: 358

Answers (1)

Leonardo Dagnino
Leonardo Dagnino

Reputation: 3225

This happens because time is counted per-CPU, as indicated by the 3.430 CPUs utilized. It has, on average, occupied 3.43 CPUs during that time. You can check that dividing 16380/3.43 gives you about the elapsed time.

Upvotes: 2

Related Questions