Commit b8976135 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Update event skip condition for system-wide per-thread mode and...

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: 91f85f98 ("perf stat: Display event stats using aggr counts")
Reported-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221206175804.391387-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 616aa32d
...@@ -804,7 +804,8 @@ static void print_counter_aggrdata(struct perf_stat_config *config, ...@@ -804,7 +804,8 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
os->nr = aggr->nr; os->nr = aggr->nr;
os->evsel = counter; os->evsel = counter;
if (counter->supported && aggr->nr == 0) /* Skip already merged uncore/hybrid events */
if (counter->merged_stat)
return; return;
uniquify_counter(config, counter); uniquify_counter(config, counter);
...@@ -813,6 +814,13 @@ static void print_counter_aggrdata(struct perf_stat_config *config, ...@@ -813,6 +814,13 @@ static void print_counter_aggrdata(struct perf_stat_config *config,
ena = aggr->counts.ena; ena = aggr->counts.ena;
run = aggr->counts.run; run = aggr->counts.run;
/*
* Skip value 0 when enabling --per-thread globally, otherwise it will
* have too many 0 output.
*/
if (val == 0 && config->aggr_mode == AGGR_THREAD && config->system_wide)
return;
if (!metric_only) { if (!metric_only) {
if (config->json_output) if (config->json_output)
fputc('{', output); fputc('{', output);
...@@ -889,9 +897,6 @@ static void print_aggr(struct perf_stat_config *config, ...@@ -889,9 +897,6 @@ static void print_aggr(struct perf_stat_config *config,
print_metric_begin(config, evlist, os, s); print_metric_begin(config, evlist, os, s);
evlist__for_each_entry(evlist, counter) { evlist__for_each_entry(evlist, counter) {
if (counter->merged_stat)
continue;
print_counter_aggrdata(config, counter, s, os); print_counter_aggrdata(config, counter, s, os);
} }
print_metric_end(config, os); print_metric_end(config, os);
...@@ -918,9 +923,6 @@ static void print_aggr_cgroup(struct perf_stat_config *config, ...@@ -918,9 +923,6 @@ static void print_aggr_cgroup(struct perf_stat_config *config,
print_metric_begin(config, evlist, os, s); print_metric_begin(config, evlist, os, s);
evlist__for_each_entry(evlist, counter) { evlist__for_each_entry(evlist, counter) {
if (counter->merged_stat)
continue;
if (counter->cgrp != os->cgrp) if (counter->cgrp != os->cgrp)
continue; continue;
...@@ -940,9 +942,6 @@ static void print_counter(struct perf_stat_config *config, ...@@ -940,9 +942,6 @@ static void print_counter(struct perf_stat_config *config,
if (!config->aggr_map) if (!config->aggr_map)
return; return;
if (counter->merged_stat)
return;
for (s = 0; s < config->aggr_map->nr; s++) { for (s = 0; s < config->aggr_map->nr; s++) {
print_counter_aggrdata(config, counter, s, os); print_counter_aggrdata(config, counter, s, os);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment