From 8829e56fa050998164e496d380cd69186ae9b8d0 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Thu, 15 Aug 2019 11:00:11 -0300 Subject: 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 Cc: Florian Weimer Cc: Jiri Olsa Cc: Namhyung Kim Cc: William Cohen Link: https://lkml.kernel.org/n/tip-b1trj1q97qwfv251l66q3noj@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'tools/perf/builtin-script.c') 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, -- cgit v1.2.3