• Yang Jihong's avatar
    perf kwork top: Add statistics on softirq event support · e29090d2
    Yang Jihong authored
    Calculate the runtime of the softirq events and subtract it from
    the corresponding task runtime to improve the precision.
    
    Example usage:
    
      # perf kwork -k sched,irq,softirq record -- perf record -e cpu-clock -o perf_record.data -a sleep 10
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.467 MB perf_record.data (7154 samples) ]
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 2.152 MB perf.data (22846 samples) ]
      # perf kwork top
    
      Total  : 136601.588 ms, 8 cpus
      %Cpu(s):  95.66% id,   0.04% hi,   0.05% si
      %Cpu0   [                                 0.02%]
      %Cpu1   [                                 0.01%]
      %Cpu2   [|                                4.61%]
      %Cpu3   [                                 0.04%]
      %Cpu4   [                                 0.01%]
      %Cpu5   [|||||                           17.31%]
      %Cpu6   [                                 0.51%]
      %Cpu7   [|||                             11.42%]
    
            PID    %CPU           RUNTIME  COMMMAND
        ----------------------------------------------------
              0   99.98      17073.515 ms  swapper/4
              0   99.98      17072.173 ms  swapper/1
              0   99.93      17064.229 ms  swapper/3
              0   99.62      17011.013 ms  swapper/0
              0   99.47      16985.180 ms  swapper/6
              0   95.17      16250.874 ms  swapper/2
              0   88.51      15111.684 ms  swapper/7
              0   82.62      14108.577 ms  swapper/5
           4342   33.00       5644.045 ms  perf
           4344    0.43         74.351 ms  perf
             16    0.13         22.296 ms  rcu_preempt
           4345    0.05         10.093 ms  perf
           4343    0.05          8.769 ms  perf
           4341    0.02          4.882 ms  perf
           4095    0.02          4.605 ms  kworker/7:1
             75    0.02          4.261 ms  kworker/2:1
            120    0.01          1.909 ms  systemd-journal
             98    0.01          2.540 ms  jbd2/sda-8
             61    0.01          3.404 ms  kcompactd0
            667    0.01          2.542 ms  kworker/u16:2
           4340    0.00          1.052 ms  kworker/7:2
             97    0.00          0.489 ms  kworker/7:1H
             51    0.00          0.209 ms  ksoftirqd/7
             50    0.00          0.646 ms  migration/7
             76    0.00          0.753 ms  kworker/6:1
             45    0.00          0.572 ms  migration/6
             87    0.00          0.145 ms  kworker/5:1H
             73    0.00          0.596 ms  kworker/5:1
             41    0.00          0.041 ms  ksoftirqd/5
             40    0.00          0.718 ms  migration/5
             64    0.00          0.115 ms  kworker/4:1
             35    0.00          0.556 ms  migration/4
            353    0.00          2.600 ms  sshd
             74    0.00          0.205 ms  kworker/3:1
             33    0.00          1.576 ms  kworker/3:0H
             30    0.00          0.996 ms  migration/3
             26    0.00          1.665 ms  ksoftirqd/2
             25    0.00          0.662 ms  migration/2
            397    0.00          0.057 ms  kworker/1:1
             20    0.00          1.005 ms  migration/1
           2909    0.00          1.053 ms  kworker/0:2
             17    0.00          0.720 ms  migration/0
             15    0.00          0.039 ms  ksoftirqd/0
    Reviewed-by: default avatarIan Rogers <irogers@google.com>
    Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Ravi Bangoria <ravi.bangoria@amd.com>
    Cc: Sandipan Das <sandipan.das@amd.com>
    Link: https://lore.kernel.org/r/20230812084917.169338-13-yangjihong1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e29090d2
builtin-kwork.c 60.8 KB