• Arnaldo Carvalho de Melo's avatar
    perf trace: Add --switch-on/--switch-off events · 22ac4318
    Arnaldo Carvalho de Melo authored
    Just like with 'perf script':
    
      # perf trace -e sched:*,syscalls:*sleep* sleep 1
           0.000 :28345/28345 sched:sched_waking:comm=perf pid=28346 prio=120 target_cpu=005
           0.005 :28345/28345 sched:sched_wakeup:perf:28346 [120] success=1 CPU:005
           0.383 sleep/28346 sched:sched_process_exec:filename=/usr/bin/sleep pid=28346 old_pid=28346
           0.613 sleep/28346 sched:sched_stat_runtime:comm=sleep pid=28346 runtime=607375 [ns] vruntime=23289041218 [ns]
           0.689 sleep/28346 syscalls:sys_enter_nanosleep:rqtp: 0x7ffc491789b0
           0.693 sleep/28346 sched:sched_stat_runtime:comm=sleep pid=28346 runtime=72021 [ns] vruntime=23289113239 [ns]
           0.694 sleep/28346 sched:sched_switch:sleep:28346 [120] S ==> swapper/5:0 [120]
        1000.787 :0/0 sched:sched_waking:comm=sleep pid=28346 prio=120 target_cpu=005
        1000.824 :0/0 sched:sched_wakeup:sleep:28346 [120] success=1 CPU:005
        1000.908 sleep/28346 syscalls:sys_exit_nanosleep:0x0
        1001.218 sleep/28346 sched:sched_process_exit:comm=sleep pid=28346 prio=120
      # perf trace -e sched:*,syscalls:*sleep* --switch-on=syscalls:sys_enter_nanosleep sleep 1
           0.000 sleep/28349 sched:sched_stat_runtime:comm=sleep pid=28349 runtime=603036 [ns] vruntime=23873537697 [ns]
           0.001 sleep/28349 sched:sched_switch:sleep:28349 [120] S ==> swapper/4:0 [120]
        1000.392 :0/0 sched:sched_waking:comm=sleep pid=28349 prio=120 target_cpu=004
        1000.443 :0/0 sched:sched_wakeup:sleep:28349 [120] success=1 CPU:004
        1000.540 sleep/28349 syscalls:sys_exit_nanosleep:0x0
        1000.852 sleep/28349 sched:sched_process_exit:comm=sleep pid=28349 prio=120
      # perf trace -e sched:*,syscalls:*sleep* --switch-on=syscalls:sys_enter_nanosleep --switch-off=syscalls:sys_exit_nanosleep sleep 1
           0.000 sleep/28352 sched:sched_stat_runtime:comm=sleep pid=28352 runtime=610543 [ns] vruntime=24811686681 [ns]
           0.001 sleep/28352 sched:sched_switch:sleep:28352 [120] S ==> swapper/0:0 [120]
        1000.397 :0/0 sched:sched_waking:comm=sleep pid=28352 prio=120 target_cpu=000
        1000.440 :0/0 sched:sched_wakeup:sleep:28352 [120] success=1 CPU:000
      #
      # perf trace -e sched:*,syscalls:*sleep* --switch-on=syscalls:sys_enter_nanosleep --switch-off=syscalls:sys_exit_nanosleep --show-on-off sleep 1
           0.000 sleep/28367 syscalls:sys_enter_nanosleep:rqtp: 0x7fffd1a25fc0
           0.004 sleep/28367 sched:sched_stat_runtime:comm=sleep pid=28367 runtime=628760 [ns] vruntime=22170052672 [ns]
           0.005 sleep/28367 sched:sched_switch:sleep:28367 [120] S ==> swapper/2:0 [120]
        1000.367 :0/0 sched:sched_waking:comm=sleep pid=28367 prio=120 target_cpu=002
        1000.412 :0/0 sched:sched_wakeup:sleep:28367 [120] success=1 CPU:002
        1000.512 sleep/28367 syscalls:sys_exit_nanosleep:0x0
      #
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Florian Weimer <fweimer@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: William Cohen <wcohen@redhat.com>
    Link: https://lkml.kernel.org/n/tip-t3ngpt1brcc1fm9gep9gxm4q@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    22ac4318
builtin-trace.c 126 KB