[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191023103048.GK22919@krava>
Date: Wed, 23 Oct 2019 12:30:48 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, linux-kernel@...r.kernel.org, jolsa@...nel.org,
eranian@...gle.com, kan.liang@...ux.intel.com,
peterz@...radead.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v2 9/9] perf stat: Use affinity for enabling/disabling
events
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
Powered by blists - more mailing lists