diff options
author | Yang Jihong <yangjihong1@huawei.com> | 2022-07-09 04:50:19 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2022-07-26 22:01:54 +0300 |
commit | e64393219069879e26483a6f92ec0cf2e1c43582 (patch) | |
tree | d94cd7a0c7543380a903792a87ab30f0828e6210 /tools/perf/builtin-kwork.c | |
parent | 4f8ae962f0f71c682f97be5a9491694f9fbd814a (diff) | |
download | linux-e64393219069879e26483a6f92ec0cf2e1c43582.tar.xz |
perf kwork: Add softirq kwork record support
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: Yang Jihong <yangjihong1@huawei.com>
Tested-by: Arnaldo 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.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-kwork.c')
-rw-r--r-- | tools/perf/builtin-kwork.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/perf/builtin-kwork.c b/tools/perf/builtin-kwork.c index 2cff7d1fff20..7c00a8fef858 100644 --- a/tools/perf/builtin-kwork.c +++ b/tools/perf/builtin-kwork.c @@ -37,8 +37,22 @@ static struct kwork_class kwork_irq = { .tp_handlers = irq_tp_handlers, }; +const struct evsel_str_handler softirq_tp_handlers[] = { + { "irq:softirq_raise", NULL, }, + { "irq:softirq_entry", NULL, }, + { "irq:softirq_exit", NULL, }, +}; + +static struct kwork_class kwork_softirq = { + .name = "softirq", + .type = KWORK_CLASS_SOFTIRQ, + .nr_tracepoints = 3, + .tp_handlers = softirq_tp_handlers, +}; + static struct kwork_class *kwork_class_supported_list[KWORK_CLASS_MAX] = { [KWORK_CLASS_IRQ] = &kwork_irq, + [KWORK_CLASS_SOFTIRQ] = &kwork_softirq, }; static void setup_event_list(struct perf_kwork *kwork, @@ -146,7 +160,7 @@ int cmd_kwork(int argc, const char **argv) OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, "dump raw trace in ASCII"), OPT_STRING('k', "kwork", &kwork.event_list_str, "kwork", - "list of kwork to profile (irq, etc)"), + "list of kwork to profile (irq, softirq, etc)"), OPT_BOOLEAN('f', "force", &kwork.force, "don't complain, do it"), OPT_END() }; |