aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2019-08-15 11:00:11 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-08-15 12:24:31 -0300
commit8829e56fa050998164e496d380cd69186ae9b8d0 (patch)
treec7ea46f40b3d52bd171555b6ad87d90785081081 /tools/perf/builtin-script.c
parentperf evswitch: Move struct to a separate header to use in other tools (diff)
downloadlinux-dev-8829e56fa050998164e496d380cd69186ae9b8d0.tar.xz
linux-dev-8829e56fa050998164e496d380cd69186ae9b8d0.zip
perf evswitch: Move switch logic to use in other tools
Now other tools that want switching can use an evswitch for that, just set it up and add it to the PERF_RECORD_SAMPLE processing function. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Florian Weimer <fweimer@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: William Cohen <wcohen@redhat.com> Link: https://lkml.kernel.org/n/tip-b1trj1q97qwfv251l66q3noj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r--tools/perf/builtin-script.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index fff02e0d70c4..e7b950e977a9 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1807,28 +1807,9 @@ static void process_event(struct perf_script *script,
if (!show_event(sample, evsel, thread, al))
return;
- if (script->evswitch.on && script->evswitch.discarding) {
- if (script->evswitch.on != evsel)
- return;
-
- script->evswitch.discarding = false;
-
- if (!script->evswitch.show_on_off_events)
- return;
-
- goto print_it;
- }
-
- if (script->evswitch.off && !script->evswitch.discarding) {
- if (script->evswitch.off != evsel)
- goto print_it;
-
- script->evswitch.discarding = true;
+ if (evswitch__discard(&script->evswitch, evsel))
+ return;
- if (!script->evswitch.show_on_off_events)
- return;
- }
-print_it:
++es->samples;
perf_sample__fprintf_start(sample, thread, evsel,