Re: [PATCH 07/10] perf, tools: Collapse identically named events in perf stat
From: Jiri Olsa
Date: Mon Oct 17 2016 - 07:28:02 EST
On Thu, Oct 13, 2016 at 02:15:29PM -0700, Andi Kleen wrote:
SNIP
> --------
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 688dea7cb08f..76304f27c090 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -140,6 +140,7 @@ static unsigned int unit_width = 4; /* strlen("unit") */
> static bool forever = false;
> static bool metric_only = false;
> static bool force_metric_only = false;
> +static bool no_merge = false;
> static struct timespec ref_time;
> static struct cpu_map *aggr_map;
> static aggr_get_id_t aggr_get_id;
> @@ -1178,11 +1179,59 @@ static void aggr_update_shadow(void)
> }
> }
>
> +static void collect_aliases(struct perf_evsel *counter,
> + void (*cb)(struct perf_evsel *counter, void *data,
> + bool first),
> + void *data)
merges_stats might be better name
> +{
> + struct perf_evsel *alias;
> +
> + alias = list_prepare_entry(counter, &(evsel_list->entries), node);
> + cb(counter, data, true);
> + if (no_merge)
> + return;
please put this decision (no_merge) outside this function,
so the normal path is straight
this leads to my next question: why this merging should be default?
it seems to make sense just for uncore events
thanks,
jirka