From 4371fbc0c9c4bcd812e96bafd54a666c330292e8 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Mon, 21 Jun 2021 18:05:05 +0300 Subject: perf script: Move filtering before scripting To make it possible to use filtering with scripts, move filtering before scripting. Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: Jiri Olsa Cc: Kan Liang Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20210621150514.32159-3-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-script.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tools/perf/builtin-script.c') diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 08a2b5d51018..ff7b43899f2e 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -1984,12 +1984,6 @@ static void process_event(struct perf_script *script, if (output[type].fields == 0) return; - if (!show_event(sample, evsel, thread, al)) - return; - - if (evswitch__discard(&script->evswitch, evsel)) - return; - ++es->samples; perf_sample__fprintf_start(script, sample, thread, evsel, @@ -2203,6 +2197,12 @@ static int process_sample_event(struct perf_tool *tool, if (al.filtered) goto out_put; + if (!show_event(sample, evsel, al.thread, &al)) + goto out_put; + + if (evswitch__discard(&scr->evswitch, evsel)) + goto out_put; + if (scripting_ops) { struct addr_location *addr_al_ptr = NULL; struct addr_location addr_al; -- cgit v1.2.3