[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120151223.GF4007@krava>
Date: Wed, 20 Nov 2019 16:12:23 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v7 10/12] perf stat: Use affinity for reading
On Fri, Nov 15, 2019 at 09:52:27PM -0800, Andi Kleen wrote:
SNIP
> + perf_evsel__name(counter),
> + cpu,
> + count->val, count->ena, count->run);
> + }
> }
>
> return 0;
> @@ -325,15 +318,36 @@ 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;
please use perf_cpu_map__nr
> + if (!target__has_cpu(&target) || target__has_per_thread(&target))
> + ncpus = 1;
> + 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_cpu(counter, rs,
> + counter->cpu_iter - 1);
please use { } to enclose multiline if legs
thanks,
jirka
Powered by blists - more mailing lists