Re: [PATCH 04/13 v4] perf tools: Replace aggregation ID with a struct

From: James Clark
Date: Tue Nov 17 2020 - 09:52:12 EST




On 15/11/2020 23:17, Jiri Olsa wrote:
> 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?

Yes it did turn out with almost no changes by just changing the type.

James

>
> 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
>