On Sun, Oct 20, 2019 at 10:52:02AM -0700, Andi Kleen wrote:

SNIP

>  
>  void evlist__enable(struct evlist *evlist)
>  {
>       struct evsel *pos;
> +     struct affinity affinity;
> +     struct perf_cpu_map *cpus;
> +     int i;
> +
> +     if (affinity__setup(&affinity) < 0)
> +             return;
> +
> +     cpus = evlist__cpu_iter_start(evlist);
> +     for (i = 0; i < cpus->nr; i++) {
> +             int cpu = cpus->map[i];
> +             affinity__set(&affinity, cpu);
>  
> +             evlist__for_each_entry(evlist, pos) {
> +                     if (evlist__cpu_iter_skip(pos, cpu))
> +                             continue;
> +                     if (!perf_evsel__is_group_leader(pos) || !pos->core.fd)
> +                             continue;

all the previous patches and this one have this code in common,
could we make this a single function, that would call a callback
that would have affinity set.. sort of like what we do in 
cpu_function_call in the kernel

thanks,
jirka

> +                     evsel__enable_cpu(pos, pos->cpu_index);
> +                     evlist__cpu_iter_next(pos);
> +             }
> +     }
> +     affinity__cleanup(&affinity);

SNIP

Reply via email to