Skip to content

Commit a74eaf1

Browse files
dsahernacmel
authored andcommitted
perf sched timehist: Fix use of CPU list with summary option
Do not update thread stats or show idle summary unless CPU is in the list of interest. Fixes: c30d630 ("perf sched timehist: Add support for filtering on CPU") Signed-off-by: David Ahern <dsahern@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Link: http://lore.kernel.org/lkml/20200817170943.1486-1-dsahern@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 4b04e0d commit a74eaf1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tools/perf/builtin-sched.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,8 @@ static int timehist_sched_change_event(struct perf_tool *tool,
25842584
}
25852585

25862586
if (!sched->idle_hist || thread->tid == 0) {
2587-
timehist_update_runtime_stats(tr, t, tprev);
2587+
if (!cpu_list || test_bit(sample->cpu, cpu_bitmap))
2588+
timehist_update_runtime_stats(tr, t, tprev);
25882589

25892590
if (sched->idle_hist) {
25902591
struct idle_thread_runtime *itr = (void *)tr;
@@ -2857,6 +2858,9 @@ static void timehist_print_summary(struct perf_sched *sched,
28572858

28582859
printf("\nIdle stats:\n");
28592860
for (i = 0; i < idle_max_cpu; ++i) {
2861+
if (cpu_list && !test_bit(i, cpu_bitmap))
2862+
continue;
2863+
28602864
t = idle_threads[i];
28612865
if (!t)
28622866
continue;

0 commit comments

Comments
 (0)