On Tue, Feb 28, 2017 at 10:49:16PM -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_data(struct perf_evsel *counter, > void (*cb)(struct perf_evsel *counter, void *data, > bool first), > void *data) > { could we place the merged_stat condition in here and have collect_data return value to process or not the current counter.. looks like we could get rid of 2 merged_stat conditions in print_counter_aggr and print_aggr jirka