[PATCH 1/2] perf report: apply --cpu filter before --switch-on/--switch-off
From: Konstantin Khlebnikov
Date: Sat Jan 25 2020 - 11:11:11 EST
If report focus on particular cpus then event switch should see only them.
Perf script/trace/top already works in this way.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx>
Fixes: ef4b1a539f4b ("perf report: Add --switch-on/--switch-off events")
---
tools/perf/builtin-report.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index de988589d99b..f03120c641c0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -258,6 +258,9 @@ static int process_sample_event(struct perf_tool *tool,
return 0;
}
+ if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
+ return 0;
+
if (evswitch__discard(&rep->evswitch, evsel))
return 0;
@@ -270,9 +273,6 @@ static int process_sample_event(struct perf_tool *tool,
if (symbol_conf.hide_unresolved && al.sym == NULL)
goto out_put;
- if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
- goto out_put;
-
if (sort__mode == SORT_MODE__BRANCH) {
/*
* A non-synthesized event might not have a branch stack if