Re: [PATCH 01/10] perf, tools, stat: Factor out callback for collecting event values

From: Jiri Olsa
Date: Sun Feb 26 2017 - 18:28:33 EST


On Thu, Feb 23, 2017 at 04:10:12PM -0800, Andi Kleen wrote:

SNIP

> +static void aggr_cb(struct perf_evsel *counter, void *data, bool first)
> +{
> + struct aggr_data *ad = data;
> + int cpu, cpu2, s2;
> +
> + for (cpu = 0; cpu < perf_evsel__nr_cpus(counter); cpu++) {
> + struct perf_counts_values *counts;
> +
> + cpu2 = perf_evsel__cpus(counter)->map[cpu];
> + s2 = aggr_get_id(evsel_list->cpus, cpu2);
> + if (s2 != ad->id)
> + continue;
> + if (first)
> + ad->nr++;
> + counts = perf_counts(counter->counts, cpu, 0);
> + /*
> + * When any result is bad, make them all to give
> + * consistent output in interval mode.
> + */
> + if (counts->ena == 0 || counts->run == 0 ||
> + counter->counts->scaled == -1) {
> + ad->ena = 0;
> + ad->run = 0;
> + break;
> + }

that's new, please make this a separate change

thanks,
jirka