0

Here is my question: perf stat will show some info for program running. Below is my program running on a Linux system with Intel 32 cores, my program have 32 threads.

Performance counter stats for './mul8_t32_lock/dfc_main':

     2,527,620.62 msec task-clock                #   27.051 CPUs utilized
        5,382,455      context-switches          #    0.002 M/sec
          322,153      cpu-migrations            #    0.127 K/sec
        6,728,473      page-faults               #    0.003 M/sec
5,773,817,446,711      cycles                    #    2.284 GHz
8,504,327,916,051      instructions              #    1.47  insn per cycle
  358,700,135,637      branches                  #  141.912 M/sec
      952,042,974      branch-misses             #    0.27% of all branches

     93.438474548 seconds time elapsed

   2482.333923000 seconds user
     66.839344000 seconds sys

So, why is the seconds user + seconds sys do not equal seconds time elapsed? And, I want to know the real meaning of the seconds user and seconds sys.

Hessen Du
  • 1
  • 1
  • Look how many cores your code used on average: `27.051 CPUs utilized`. That lets it use more than 1 CPU-second of cpu time in 1 second of wall-clock time. – Peter Cordes Apr 04 '21 at 04:26
  • [What do 'real', 'user' and 'sys' mean in the output of time(1)?](https://stackoverflow.com/a/2734965) explains that user+sys can exceed elapsed on multi-threaded machines. Other answers have more detail on other things. Looks like an exact duplicate because `perf stat` is simply reporting the same process-accounting times as `time` does. – Peter Cordes Apr 04 '21 at 04:39
  • @PeterCordes Thanks guy, I begin understand about this confused concept. – Hessen Du Apr 04 '21 at 05:06

0 Answers0