lkml.org 
[lkml]   [2019]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-11-15 15:56    [W:0.117 / U:30.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site