perf inject: Add missing callbacks in perf_tool
authorNamhyung Kim <namhyung@kernel.org>
Mon, 12 Oct 2020 07:02:10 +0000 (16:02 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 13 Oct 2020 13:59:42 +0000 (10:59 -0300)
I found some events (like PERF_RECORD_CGROUP) are not copied by perf
inject due to the missing callbacks.  Let's add them.

While at it, I've changed the order of the callbacks to match with
struct perf_tool so that we can compare them easily.

Acked-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20201012070214.2074921-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-inject.c

index e4d78f11494e5183fc690d39e305110923f7dd5d..2c5e23d73a8a08274614256ca6676f8ef01b6210 100644 (file)
@@ -97,6 +97,13 @@ static int perf_event__repipe_op2_synth(struct perf_session *session,
        return perf_event__repipe_synth(session->tool, event);
 }
 
+static int perf_event__repipe_op4_synth(struct perf_session *session,
+                                       union perf_event *event,
+                                       u64 data __maybe_unused)
+{
+       return perf_event__repipe_synth(session->tool, event);
+}
+
 static int perf_event__repipe_attr(struct perf_tool *tool,
                                   union perf_event *event,
                                   struct evlist **pevlist)
@@ -115,6 +122,13 @@ static int perf_event__repipe_attr(struct perf_tool *tool,
        return perf_event__repipe_synth(tool, event);
 }
 
+static int perf_event__repipe_event_update(struct perf_tool *tool,
+                                          union perf_event *event,
+                                          struct evlist **pevlist __maybe_unused)
+{
+       return perf_event__repipe_synth(tool, event);
+}
+
 #ifdef HAVE_AUXTRACE_SUPPORT
 
 static int copy_bytes(struct perf_inject *inject, int fd, off_t size)
@@ -707,9 +721,12 @@ int cmd_inject(int argc, const char **argv)
        struct perf_inject inject = {
                .tool = {
                        .sample         = perf_event__repipe_sample,
+                       .read           = perf_event__repipe_sample,
                        .mmap           = perf_event__repipe,
                        .mmap2          = perf_event__repipe,
                        .comm           = perf_event__repipe,
+                       .namespaces     = perf_event__repipe,
+                       .cgroup         = perf_event__repipe,
                        .fork           = perf_event__repipe,
                        .exit           = perf_event__repipe,
                        .lost           = perf_event__repipe,
@@ -717,19 +734,28 @@ int cmd_inject(int argc, const char **argv)
                        .aux            = perf_event__repipe,
                        .itrace_start   = perf_event__repipe,
                        .context_switch = perf_event__repipe,
-                       .read           = perf_event__repipe_sample,
                        .throttle       = perf_event__repipe,
                        .unthrottle     = perf_event__repipe,
+                       .ksymbol        = perf_event__repipe,
+                       .bpf            = perf_event__repipe,
+                       .text_poke      = perf_event__repipe,
                        .attr           = perf_event__repipe_attr,
+                       .event_update   = perf_event__repipe_event_update,
                        .tracing_data   = perf_event__repipe_op2_synth,
-                       .auxtrace_info  = perf_event__repipe_op2_synth,
-                       .auxtrace       = perf_event__repipe_auxtrace,
-                       .auxtrace_error = perf_event__repipe_op2_synth,
-                       .time_conv      = perf_event__repipe_op2_synth,
                        .finished_round = perf_event__repipe_oe_synth,
                        .build_id       = perf_event__repipe_op2_synth,
                        .id_index       = perf_event__repipe_op2_synth,
+                       .auxtrace_info  = perf_event__repipe_op2_synth,
+                       .auxtrace_error = perf_event__repipe_op2_synth,
+                       .time_conv      = perf_event__repipe_op2_synth,
+                       .thread_map     = perf_event__repipe_op2_synth,
+                       .cpu_map        = perf_event__repipe_op2_synth,
+                       .stat_config    = perf_event__repipe_op2_synth,
+                       .stat           = perf_event__repipe_op2_synth,
+                       .stat_round     = perf_event__repipe_op2_synth,
                        .feature        = perf_event__repipe_op2_synth,
+                       .compressed     = perf_event__repipe_op4_synth,
+                       .auxtrace       = perf_event__repipe_auxtrace,
                },
                .input_name  = "-",
                .samples = LIST_HEAD_INIT(inject.samples),