Re: [PATCH 04/13 v4] perf tools: Replace aggregation ID with a struct
From: Jiri Olsa
Date: Sun Nov 15 2020 - 16:18:15 EST
On Fri, Nov 13, 2020 at 07:26:45PM +0200, James Clark wrote:
SNIP
> @@ -754,7 +766,7 @@ static void print_aggr_thread(struct perf_stat_config *config,
> FILE *output = config->output;
> int nthreads = perf_thread_map__nr(counter->core.threads);
> int ncpus = perf_cpu_map__nr(counter->core.cpus);
> - int thread, sorted_threads, id;
> + int thread, sorted_threads;
> struct perf_aggr_thread_value *buf;
>
> buf = sort_aggr_thread(counter, nthreads, ncpus, &sorted_threads, _target);
> @@ -767,13 +779,12 @@ static void print_aggr_thread(struct perf_stat_config *config,
> if (prefix)
> fprintf(output, "%s", prefix);
>
> - id = buf[thread].id;
would it be less changes in here if you kept id with new type?
jirka
> if (config->stats)
> - printout(config, id, 0, buf[thread].counter, buf[thread].uval,
> + printout(config, buf[thread].id, 0, buf[thread].counter, buf[thread].uval,
> prefix, buf[thread].run, buf[thread].ena, 1.0,
> - &config->stats[id]);
> + &config->stats[buf[thread].id.id]);
> else
> - printout(config, id, 0, buf[thread].counter, buf[thread].uval,
> + printout(config, buf[thread].id, 0, buf[thread].counter, buf[thread].uval,
> prefix, buf[thread].run, buf[thread].ena, 1.0,
> &rt_stat);
> fputc('\n', output);
SNIP