linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] perf sched timehist: Fix use of CPU list with summary option
@ 2020-08-07 16:49 David Ahern
  2020-08-11  6:42 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-08-07 16:49 UTC (permalink / raw)
  To: acme; +Cc: namhyung, linux-kernel, jolsa, 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 <dsahern@kernel.org>
---
 tools/perf/builtin-sched.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 0c7d599fa555..82ee0dfd1831 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -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;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] perf sched timehist: Fix use of CPU list with summary option
  2020-08-07 16:49 [PATCH 2/2] perf sched timehist: Fix use of CPU list with summary option David Ahern
@ 2020-08-11  6:42 ` Namhyung Kim
  2020-08-12  3:12   ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2020-08-11  6:42 UTC (permalink / raw)
  To: David Ahern; +Cc: Arnaldo Carvalho de Melo, linux-kernel, Jiri Olsa

On Sat, Aug 8, 2020 at 1:49 AM David Ahern <dsahern@kernel.org> wrote:
>
> 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 <dsahern@kernel.org>
> ---
>  tools/perf/builtin-sched.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 0c7d599fa555..82ee0dfd1831 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -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))

Shouldn't it check cpu_list as well?

Thanks

Namhyung


> +                       continue;
> +
>                 t = idle_threads[i];
>                 if (!t)
>                         continue;
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] perf sched timehist: Fix use of CPU list with summary option
  2020-08-11  6:42 ` Namhyung Kim
@ 2020-08-12  3:12   ` David Ahern
  0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2020-08-12  3:12 UTC (permalink / raw)
  To: Namhyung Kim, David Ahern
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Jiri Olsa

On 8/11/20 12:42 AM, Namhyung Kim wrote:
>> @@ -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))
> 
> Shouldn't it check cpu_list as well?
> 

oh, right. will fix.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-12  3:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 16:49 [PATCH 2/2] perf sched timehist: Fix use of CPU list with summary option David Ahern
2020-08-11  6:42 ` Namhyung Kim
2020-08-12  3:12   ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).