• Yang Jihong's avatar
    perf kwork: Add softirq kwork record support · e6439321
    Yang Jihong authored
    Record softirq events irq:softirq_raise, irq:softirq_entry &
    irq:softirq_exit.
    
    Test cases:
    Record all events:
    
      # perf kwork record -o perf_kwork.date -- sleep 1
      [ perf record: Woken up 0 times to write data ]
      [ perf record: Captured and wrote 0.897 MB perf_kwork.date ]
      #
      # perf evlist -i perf_kwork.date
      irq:irq_handler_entry
      irq:irq_handler_exit
      irq:softirq_raise
      irq:softirq_entry
      irq:softirq_exit
      dummy:HG
      # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
    
    Record softirq events:
    
      # perf kwork -k softirq record -o perf_kwork.date -- sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.141 MB perf_kwork.date ]
      #
      # perf evlist -i perf_kwork.date
      irq:softirq_raise
      irq:softirq_entry
      irq:softirq_exit
      dummy:HG
      # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
    
    Committer testing:
    
      # perf kwork record sleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 3.078 MB perf.data (17433 samples) ]
      # perf evlist -v
      irq:irq_handler_entry: type: 2, size: 128, config: 0x97, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1, exclude_guest: 1
      irq:irq_handler_exit: type: 2, size: 128, config: 0x96, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1, exclude_guest: 1
      irq:softirq_raise: type: 2, size: 128, config: 0x93, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1, exclude_guest: 1
      irq:softirq_entry: type: 2, size: 128, config: 0x95, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1, exclude_guest: 1
      irq:softirq_exit: type: 2, size: 128, config: 0x94, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, sample_id_all: 1, exclude_guest: 1
      dummy:HG: type: 1, size: 128, config: 0x9, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|RAW|IDENTIFIER, read_format: ID, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, mmap2: 1, comm_exec: 1, ksymbol: 1, bpf_event: 1
      # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
      # perf script | head
          migration/12    73 [012] 25884.940992:     irq:softirq_raise: vec=9 [action=RCU]
          migration/12    73 [012] 25884.940994:     irq:softirq_entry: vec=9 [action=RCU]
          migration/12    73 [012] 25884.940995:      irq:softirq_exit: vec=9 [action=RCU]
               swapper     0 [004] 25884.940995:     irq:softirq_raise: vec=9 [action=RCU]
               swapper     0 [004] 25884.940998:     irq:softirq_entry: vec=9 [action=RCU]
               swapper     0 [004] 25884.940999:      irq:softirq_exit: vec=9 [action=RCU]
                   cc1 71212 [021] 25884.941990:     irq:softirq_raise: vec=9 [action=RCU]
               swapper     0 [004] 25884.941991:     irq:softirq_raise: vec=9 [action=RCU]
                   cc1 71212 [021] 25884.941992:     irq:softirq_raise: vec=7 [action=SCHED]
             perf-exec 71208 [013] 25884.941992:     irq:softirq_raise: vec=9 [action=RCU]
      #
    Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Clarke <pc@us.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20220709015033.38326-4-yangjihong1@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    e6439321
builtin-kwork.c 4.55 KB