lkml.org 
[lkml]   [2022]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 18/48] perf cpumap: Refactor cpu_map__build_map
On Wed, Dec 29, 2021 at 11:20:00PM -0800, Ian Rogers wrote:

SNIP

> + return 0;
> +
> + stat_config.aggr_map = cpu_aggr_map__new(evsel_list->core.cpus, get_id, env);
> + if (!stat_config.aggr_map) {
> + pr_err("cannot build %s map", aggr_mode__string[stat_config.aggr_mode]);
> + return -1;
> + }
> + stat_config.aggr_get_id = aggr_mode__get_id_file(stat_config.aggr_mode);
> return 0;
> }
>
> diff --git a/tools/perf/util/cpumap.c b/tools/perf/util/cpumap.c
> index 32f9fc2dd389..ba4468f691c8 100644
> --- a/tools/perf/util/cpumap.c
> +++ b/tools/perf/util/cpumap.c
> @@ -140,7 +140,7 @@ struct aggr_cpu_id cpu_map__get_socket_aggr_by_cpu(int cpu, void *data __maybe_u
> return id;
> }
>
> -static int cmp_aggr_cpu_id(const void *a_pointer, const void *b_pointer)
> +static int aggr_cpu_id__cmp(const void *a_pointer, const void *b_pointer)
> {
> struct aggr_cpu_id *a = (struct aggr_cpu_id *)a_pointer;
> struct aggr_cpu_id *b = (struct aggr_cpu_id *)b_pointer;
> @@ -157,37 +157,40 @@ static int cmp_aggr_cpu_id(const void *a_pointer, const void *b_pointer)
> return a->thread - b->thread;
> }
>
> -int cpu_map__build_map(struct perf_cpu_map *cpus, struct cpu_aggr_map **res,
> - struct aggr_cpu_id (*f)(int cpu, void *data),
> - void *data)
> +struct cpu_aggr_map *cpu_aggr_map__new(const struct perf_cpu_map *cpus,
> + aggr_cpu_id_get_t f,

s/f/get_id/ ?

jirka


> + void *data)
> {
> - int nr = cpus->nr;
> - struct cpu_aggr_map *c = cpu_aggr_map__empty_new(nr);
> - int cpu, s2;
> - struct aggr_cpu_id s1;
> + int cpu, idx;
> + struct cpu_aggr_map *c = cpu_aggr_map__empty_new(cpus->nr);

SNIP

\
 
 \ /
  Last update: 2022-01-04 15:21    [W:0.273 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site