OSDN Git Service

perf kwork: Add irq kwork record support
authorYang Jihong <yangjihong1@huawei.com>
Sat, 9 Jul 2022 01:50:18 +0000 (09:50 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 26 Jul 2022 19:01:29 +0000 (16:01 -0300)
Record interrupt events irq:irq_handler_entry & irq_handler_exit

Test cases:

 # perf kwork record -o perf_kwork.date -- sleep 1
  [ perf record: Woken up 0 times to write data ]
  [ perf record: Captured and wrote 0.556 MB perf_kwork.date ]
  #
  # perf evlist -i perf_kwork.date
  irq:irq_handler_entry
  irq:irq_handler_exit
  dummy:HG
  # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
  #

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-3-yangjihong1@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/Documentation/perf-kwork.txt
tools/perf/builtin-kwork.c
tools/perf/util/kwork.h

index dc1e36d..57bd5fa 100644 (file)
@@ -32,7 +32,7 @@ OPTIONS
 
 -k::
 --kwork::
-       List of kwork to profile
+       List of kwork to profile (irq, etc)
 
 -v::
 --verbose::
index 3e8d5fa..2cff7d1 100644 (file)
 #include <linux/time64.h>
 #include <linux/zalloc.h>
 
+const struct evsel_str_handler irq_tp_handlers[] = {
+       { "irq:irq_handler_entry", NULL, },
+       { "irq:irq_handler_exit",  NULL, },
+};
+
+static struct kwork_class kwork_irq = {
+       .name           = "irq",
+       .type           = KWORK_CLASS_IRQ,
+       .nr_tracepoints = 2,
+       .tp_handlers    = irq_tp_handlers,
+};
+
 static struct kwork_class *kwork_class_supported_list[KWORK_CLASS_MAX] = {
+       [KWORK_CLASS_IRQ]       = &kwork_irq,
 };
 
 static void setup_event_list(struct perf_kwork *kwork,
@@ -133,7 +146,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"),
+                  "list of kwork to profile (irq, etc)"),
        OPT_BOOLEAN('f', "force", &kwork.force, "don't complain, do it"),
        OPT_END()
        };
index 6950636..f1d89cb 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/bitmap.h>
 
 enum kwork_class_type {
+       KWORK_CLASS_IRQ,
        KWORK_CLASS_MAX,
 };