Skip to contentSkip to conversation

perf stat: Don't display zero tool counts

PATCH In review Ian Rogers 3 participants 8 messages Aug 1, 2023 – Aug 8, 2023 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf stat: Don't display zero tool counts

Skip zero counts for tool events.

---
 tools/perf/util/stat-display.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/stat-display.c +5 -0
index 7329b3340f88..d45d5dcb0e2b 100644
@@ -931,6 +931,11 @@ static bool should_skip_zero_counter(struct perf_stat_config *config,
 	 */
 	if (config->aggr_mode == AGGR_THREAD && config->system_wide)
 		return true;
+
+	/* Tool events have the software PMU but are only gathered on 1. */
+	if (evsel__is_tool(counter))
+		return true;
+
 	/*
 	 * Skip value 0 when it's an uncore event and the given aggr id
 	 * does not belong to the PMU cpumask.
Signature · 1 line
2.41.0.585.gd2178a4bd4-goog
#2 lore raw
In reply to Ian Rogers

Em Tue, Aug 01, 2023 at 01:54:52PM -0700, Ian Rogers escreveu:

Quoted 3 lines

Skip zero counts for tool events.

Andi,

Have you tested this? Can we please have your Tested-by?

- Arnaldo:1

Quoted 24 lines
---
 tools/perf/util/stat-display.c | 5 +++++
 1 file changed, 5 insertions(+)
tools/perf/util/stat-display.c +5 -0
index 7329b3340f88..d45d5dcb0e2b 100644
@@ -931,6 +931,11 @@ static bool should_skip_zero_counter(struct perf_stat_config *config,
 	 */
 	if (config->aggr_mode == AGGR_THREAD && config->system_wide)
 		return true;
+
+	/* Tool events have the software PMU but are only gathered on 1. */
+	if (evsel__is_tool(counter))
+		return true;
+
 	/*
 	 * Skip value 0 when it's an uncore event and the given aggr id
 	 * does not belong to the PMU cpumask.
Signature · 1 line
2.41.0.585.gd2178a4bd4-goog
Signature · 1 line
- Arnaldo
#4 lore raw

Em Mon, Aug 07, 2023 at 07:54:47AM -0700, Andi Kleen escreveu:

Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 5 lines

Em Tue, Aug 01, 2023 at 01:54:52PM -0700, Ian Rogers escreveu:

Quoted 3 lines

Skip zero counts for tool events.

Quoted 7 lines
Quoted 3 lines

Andi,

Have you tested this? Can we please have your Tested-by?

I thought I had sent it earlier?

Yeah, you did it, sorry, somehow I didn't notice.

Applying.

- Arnaldo

#5 lore raw

Em Mon, Aug 07, 2023 at 04:43:38PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Mon, Aug 07, 2023 at 07:54:47AM -0700, Andi Kleen escreveu:

Quoted 10 lines · Arnaldo Carvalho de Melo
Quoted 8 lines

Em Tue, Aug 01, 2023 at 01:54:52PM -0700, Ian Rogers escreveu:

Quoted 3 lines

Skip zero counts for tool events.

Andi,

Have you tested this? Can we please have your Tested-by?

Quoted 7 lines
Quoted 3 lines

I thought I had sent it earlier?

Yeah, you did it, sorry, somehow I didn't notice.

Applying.

Would be good to have the original link with your report and to figure out the cset that introduced the problem, so that we could have a Fixes tag to help justifying getting this into 6.5.

- Arnaldo

#6 lore raw
Quoted 16 lines · Arnaldo Carvalho de Melo

Em Mon, Aug 07, 2023 at 04:43:38PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Mon, Aug 07, 2023 at 07:54:47AM -0700, Andi Kleen escreveu:

Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 8 lines

Em Tue, Aug 01, 2023 at 01:54:52PM -0700, Ian Rogers escreveu:

Quoted 3 lines

Skip zero counts for tool events.

Andi,

Have you tested this? Can we please have your Tested-by?

I thought I had sent it earlier?

Quoted 7 lines
Quoted 3 lines

Yeah, you did it, sorry, somehow I didn't notice.

Applying.

Would be good to have the original link with your report and to figure out the cset that introduced the problem, so that we could have a Fixes tag to help justifying getting this into 6.5.

Just bisected it. The original patch was below. Remarkably it had a "Fixes" tag too)

My report was

https://lore.kernel.org/linux-perf-users/ZMlrzcVrVi1lTDmn@tassilo/

commit b897613510890d6e92b6a276a20f6c3d96fe90e8

Author: Namhyung Kim <[email protected]>
Date:   Tue Dec 6 09:58:04 2022 -0800

perf stat: Update event skip condition for system-wide per-thread mode and merged uncore and hybrid events

In print_counter_aggrdata(), it skips some events that has no aggregate count. It's actually for system-wide per-thread mode and merged uncore and hybrid events.

Let's update the condition to check them explicitly.

Fixes 91f85f98da7ab8c3 ("perf stat: Display event stats using aggr counts")
#7 lore raw

Em Tue, Aug 08, 2023 at 10:38:48AM -0700, Andi Kleen escreveu:

Quoted 25 lines · Arnaldo Carvalho de Melo
Quoted 16 lines

Em Mon, Aug 07, 2023 at 04:43:38PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 15 lines

Em Mon, Aug 07, 2023 at 07:54:47AM -0700, Andi Kleen escreveu:

Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 8 lines

Em Tue, Aug 01, 2023 at 01:54:52PM -0700, Ian Rogers escreveu:

Quoted 3 lines

Skip zero counts for tool events.

Andi,

Have you tested this? Can we please have your Tested-by?

I thought I had sent it earlier?

Quoted 7 lines
Quoted 3 lines

Yeah, you did it, sorry, somehow I didn't notice.

Applying.

Would be good to have the original link with your report and to figure out the cset that introduced the problem, so that we could have a Fixes tag to help justifying getting this into 6.5.

Quoted 6 lines

Just bisected it. The original patch was below. Remarkably it had a "Fixes" tag too)

My report was

https://lore.kernel.org/linux-perf-users/ZMlrzcVrVi1lTDmn@tassilo/

Thanks, I did this research and bisection earlier today, some more tests and the result matches yours and is available at:

https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git/commit/?h=perf-tools

I used that ZMlrzcVrVi1lTDmn@tassilo in the Link: tag, as Linus stated he prefers the discussion leading to the patch than the URL for the patch itself once submitted.

Now I'll wait a bit till it lands in linux-next/pending-fixes to then send it to Linus.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?h=pending-fixes

Thanks again!

- Arnaldo

Quoted 13 lines

commit b897613510890d6e92b6a276a20f6c3d96fe90e8

Author: Namhyung Kim <[email protected]>
Date:   Tue Dec 6 09:58:04 2022 -0800

perf stat: Update event skip condition for system-wide per-thread mode and merged uncore and hybrid events

In print_counter_aggrdata(), it skips some events that has no aggregate count. It's actually for system-wide per-thread mode and merged uncore and hybrid events.

Let's update the condition to check them explicitly.

Fixes 91f85f98da7ab8c3 ("perf stat: Display event stats using aggr counts")