[PATCH v1] perf test parse-metric: Ensure aggregate counts appear to have run

Ian Rogers posted 1 patch 1 day, 22 hours ago
tools/perf/tests/parse-metric.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH v1] perf test parse-metric: Ensure aggregate counts appear to have run
Posted by Ian Rogers 1 day, 22 hours ago
Commit bb5a920b9099 ("perf stat: Ensure metrics are displayed even
with failed events") made it so that counters which weren't enabled in
the kernel were handled as NaN in metrics. This cased the "Parse and
process metrics" test to start failing as it wasn't putting a non-zero
value in these variables. Add arbitrary values of 1 to fix the test.

Fixes: bb5a920b9099 ("perf stat: Ensure metrics are displayed even with failed events")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/tests/parse-metric.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c
index 6bbc209a5c6a..7c7f489a5eb0 100644
--- a/tools/perf/tests/parse-metric.c
+++ b/tools/perf/tests/parse-metric.c
@@ -41,6 +41,8 @@ static void load_runtime_stat(struct evlist *evlist, struct value *vals)
 		count = find_value(evsel->name, vals);
 		evsel->supported = true;
 		evsel->stats->aggr->counts.val = count;
+		evsel->stats->aggr->counts.ena = 1;
+		evsel->stats->aggr->counts.run = 1;
 	}
 }
 
-- 
2.53.0.239.g8d8fc8a987-goog
Re: [PATCH v1] perf test parse-metric: Ensure aggregate counts appear to have run
Posted by Arnaldo Carvalho de Melo 1 day, 13 hours ago
On Sat, Feb 07, 2026 at 09:54:55PM -0800, Ian Rogers wrote:
> Commit bb5a920b9099 ("perf stat: Ensure metrics are displayed even
> with failed events") made it so that counters which weren't enabled in
> the kernel were handled as NaN in metrics. This cased the "Parse and
> process metrics" test to start failing as it wasn't putting a non-zero
> value in these variables. Add arbitrary values of 1 to fix the test.
> 
> Fixes: bb5a920b9099 ("perf stat: Ensure metrics are displayed even with failed events")

Thanks, applied to perf-tools-next,

- Arnaldo
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/tests/parse-metric.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/perf/tests/parse-metric.c b/tools/perf/tests/parse-metric.c
> index 6bbc209a5c6a..7c7f489a5eb0 100644
> --- a/tools/perf/tests/parse-metric.c
> +++ b/tools/perf/tests/parse-metric.c
> @@ -41,6 +41,8 @@ static void load_runtime_stat(struct evlist *evlist, struct value *vals)
>  		count = find_value(evsel->name, vals);
>  		evsel->supported = true;
>  		evsel->stats->aggr->counts.val = count;
> +		evsel->stats->aggr->counts.ena = 1;
> +		evsel->stats->aggr->counts.run = 1;
>  	}
>  }
>  
> -- 
> 2.53.0.239.g8d8fc8a987-goog