[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191115145542.GD4255@krava>
Date: Fri, 15 Nov 2019 15:55:42 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: jolsa@...nel.org, acme@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v6 10/12] perf stat: Use affinity for reading
On Mon, Nov 11, 2019 at 04:59:39PM -0800, Andi Kleen wrote:
SNIP
>
> return 0;
> @@ -325,15 +318,35 @@ static int read_counter(struct evsel *counter, struct timespec *rs)
> static void read_counters(struct timespec *rs)
> {
> struct evsel *counter;
> - int ret;
> + struct affinity affinity;
> + int i, ncpus, cpu;
> +
> + if (affinity__setup(&affinity) < 0)
> + return;
> +
> + ncpus = evsel_list->core.all_cpus->nr;
> + if (!(target__has_cpu(&target) && !target__has_per_thread(&target)))
> + ncpus = 1;
hum, could we propagate the negation inside amke this more readable?
if (!target__has_cpu(&target) || target__has_per_thread(&target))
jirka
> + evlist__for_each_cpu (evsel_list, i, cpu) {
> + if (i >= ncpus)
> + break;
> + affinity__set(&affinity, cpu);
> +
> + evlist__for_each_entry(evsel_list, counter) {
> + if (evsel__cpu_iter_skip(counter, cpu))
> + continue;
> + if (!counter->err)
> + counter->err = read_counter(counter, rs, counter->cpu_iter - 1);
> + }
> + }
> + affinity__cleanup(&affinity);
SNIP
Powered by blists - more mailing lists