Re: [PATCH 04/19] perf stat: Add aggr id for global mode

From: Jiri Olsa
Date: Wed Oct 12 2022 - 06:56:07 EST


On Sun, Oct 09, 2022 at 10:35:45PM -0700, Namhyung Kim wrote:
> To make the code simpler, I'd like to use the same aggregation code for
> the global mode. We can simply add an id function to return cpu 0 and
> use print_aggr().
>
> No functional change intended.
>
> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> ---
> tools/perf/builtin-stat.c | 39 ++++++++++++++++++++++++++++++++--
> tools/perf/util/cpumap.c | 10 +++++++++
> tools/perf/util/cpumap.h | 6 +++++-
> tools/perf/util/stat-display.c | 9 ++------
> 4 files changed, 54 insertions(+), 10 deletions(-)
>

SNIP

> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index 4113aa86772f..1d8e585df4ad 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -1477,13 +1477,8 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
> if (config->iostat_run)
> iostat_print_counters(evlist, config, ts, prefix = buf,
> print_counter_aggr);
> - else {
> - evlist__for_each_entry(evlist, counter) {
> - print_counter_aggr(config, counter, prefix);
> - }
> - if (metric_only)
> - fputc('\n', config->output);
> - }
> + else
> + print_aggr(config, evlist, prefix);

this seems to break output for:

before:
# ./perf stat -M ipc -I 1000 --metric-only
# time IPC
1.000674320 0.61
2.001700284 0.66
3.003677500 0.67
4.005583140 0.64

after:
# ./perf stat -M ipc -I 1000 --metric-only
# time IPC
1.001004048 0.94

2.003120471 0.69

3.005030405 0.65

4.006788766 0.64

5.008004052 0.68


also should this hunk be in separate patch?

jirka

> break;
> case AGGR_NONE:
> if (metric_only)
> --
> 2.38.0.rc1.362.ged0d419d3c-goog
>