perf sched timehist: Fix use of CPU list with summary option
PATCH 2/2 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 c30d630d1bcf ("perf sched timehist: Add support for filtering on CPU")
Signed-off-by David Ahern <[email protected]>
--- tools/perf/builtin-sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/builtin-sched.c +5 -1
@@ -2575,7 +2575,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, }if (!sched->idle_hist || thread->tid ==0 ) { -timehist_update_runtime_stats (tr, t, tprev); +if (!cpu_list ||test_bit (sample->cpu, cpu_bitmap)) +timehist_update_runtime_stats (tr, t, tprev);if (sched->idle_hist) {struct idle_thread_runtime *itr = (void *)tr;
@@ -2848,6 +2849,9 @@ static void timehist_print_summary(struct perf_sched *sched,printf ("\nIdle stats:\n" );for (i =0 ; i < idle_max_cpu; ++i) { +if (!test_bit (i, cpu_bitmap)) +continue ; + t = idle_threads[i];if (!t)continue ;
Signature · 1 line
2.17.1
Namhyung Kim
maintainerQuoted 25 lines · David Ahern
Do not update thread stats or show idle summary unless CPU is in the list of interest.
Fixes c30d630d1bcf ("perf sched timehist: Add support for filtering on CPU")Signed-off-by David Ahern <[email protected]>--- tools/perf/builtin-sched.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/builtin-sched.c +2
-1@@ -2575,7 +2575,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, }if (!sched->idle_hist || thread->tid ==0 ) { -timehist_update_runtime_stats (tr, t, tprev); +if (!cpu_list ||test_bit (sample->cpu, cpu_bitmap)) +timehist_update_runtime_stats (tr, t, tprev);if (sched->idle_hist) {struct idle_thread_runtime *itr = (void *)tr;
tools/perf/builtin-sched.c static void timehist_print_summary(struct perf_sched *sched, · line 2852
Quoted 4 lines
tools/perf/builtin-sched.c +1
-0@@ -2848,6 +2849,9 @@ static void timehist_print_summary(struct perf_sched *sched,printf ("\nIdle stats:\n" );for (i =0 ; i < idle_max_cpu; ++i) { +if (!test_bit (i, cpu_bitmap))
Shouldn't it check cpu_list as well?
Thanks
Namhyung
Quoted 8 lines
tools/perf/builtin-sched.c +2
-1+continue ; + t = idle_threads[i];if (!t)continue ; --2.17.1
Quoted 12 lines · Namhyung Kim
Quoted 12 lines
tools/perf/builtin-sched.c +2
-1@@ -2575,7 +2575,8 @@ static int timehist_sched_change_event(struct perf_tool *tool, }if (!sched->idle_hist || thread->tid ==0 ) { -timehist_update_runtime_stats (tr, t, tprev); +if (!cpu_list ||test_bit (sample->cpu, cpu_bitmap)) +timehist_update_runtime_stats (tr, t, tprev);if (sched->idle_hist) {struct idle_thread_runtime *itr = (void *)tr;@@ -2848,6 +2849,9 @@ static void timehist_print_summary(struct perf_sched *sched,
Quoted 6 lines
tools/perf/builtin-sched.c static void timehist_print_summary(struct perf_sched *sched, · line 2852
Quoted 3 lines
tools/perf/builtin-sched.c +1
-0printf ("\nIdle stats:\n" );for (i =0 ; i < idle_max_cpu; ++i) { +if (!test_bit (i, cpu_bitmap))Shouldn't it check
cpu_listas well?
oh, right. will fix.