Re: [PATCH 06/10] perf, tools: Collapse identically named events in perf stat

Jiri Olsa
2017-02-08T11:31:30Z

On Fri, Jan 27, 2017 at 06:03:41PM -0800, Andi Kleen wrote:

SNIP

> +static void collect_all_aliases(struct perf_evsel *counter,
> + void (*cb)(struct perf_evsel *counter, void *data,
> + bool first),
> + void *data)
> +{
> + struct perf_evsel *alias;
> +
> + alias = list_prepare_entry(counter, &(evsel_list->entries), node);
> + list_for_each_entry_continue (alias, &evsel_list->entries, node) {
> + if (strcmp(perf_evsel__name(alias), perf_evsel__name(counter)) ||
> + alias->scale != counter->scale ||
> + alias->cgrp != counter->cgrp ||
> + strcmp(alias->unit, counter->unit) ||
> + nsec_counter(alias) != nsec_counter(counter))
> + break;
> + alias->merged_stat = true;
> + cb(alias, data, false);
> + }
> +}
> +
> +static void collect_aliases(struct perf_evsel *counter,
> + void (*cb)(struct perf_evsel *counter, void *data,
> + bool first),
> + void *data)
> +{
> + cb(counter, data, true);
> + if (!no_merge)
> + collect_all_aliases(counter, cb, data);
> +}

could you please split this into 2 changes:
- adding adding collect_aliases function with no functional change
just changing all the print callers to use it
- adding collect_all_aliases change that actualy change the behaviour
and merges the stats

also please change the collect_aliases name to something
generic like collect data

thanks,
jirka