perf trace: Make evlist__set_evsel_handler() affect just entries without a handler
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 1 Oct 2019 14:31:59 +0000 (11:31 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 7 Oct 2019 15:22:17 +0000 (12:22 -0300)
Renaming it to evlist__set_default_evsel_handler(), to better reflect
what we want to do, which is to set a default handler for events we
still haven't set a custom handler, like the ones for "msr:write_msr",
etc that are coming soon.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-e1bit7upnpmtsayh8039kfuw@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c

index bb5130d0215549fb3eb2266cfea2ce742a0510d2..ee330f50b4503f7f99e112bec688d2e104b006a9 100644 (file)
@@ -3858,12 +3858,14 @@ static int parse_pagefaults(const struct option *opt, const char *str,
        return 0;
 }
 
-static void evlist__set_evsel_handler(struct evlist *evlist, void *handler)
+static void evlist__set_default_evsel_handler(struct evlist *evlist, void *handler)
 {
        struct evsel *evsel;
 
-       evlist__for_each_entry(evlist, evsel)
-               evsel->handler = handler;
+       evlist__for_each_entry(evlist, evsel) {
+               if (evsel->handler == NULL)
+                       evsel->handler = handler;
+       }
 }
 
 static int evlist__set_syscall_tp_fields(struct evlist *evlist)
@@ -4287,7 +4289,7 @@ int cmd_trace(int argc, const char **argv)
        }
 
        if (trace.evlist->core.nr_entries > 0) {
-               evlist__set_evsel_handler(trace.evlist, trace__event_handler);
+               evlist__set_default_evsel_handler(trace.evlist, trace__event_handler);
                if (evlist__set_syscall_tp_fields(trace.evlist)) {
                        perror("failed to set syscalls:* tracepoint fields");
                        goto out;