lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 30 Oct 2019 11:05:47 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Andi Kleen <andi@...stfloor.org>
Cc:     acme@...nel.org, jolsa@...nel.org, eranian@...gle.com,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v3 3/7] perf evsel: Add iterator to iterate over events
 ordered by CPU

On Fri, Oct 25, 2019 at 11:14:13AM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
> 
> Add some common code that is needed to iterate over all events
> in CPU order. Used in followon patches
> 
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>
> 
> ---
> 
> v2: Add cpumap__for_each_cpu macro to factor out some common code
> ---
>  tools/perf/util/cpumap.h |  8 ++++++++
>  tools/perf/util/evlist.c | 33 +++++++++++++++++++++++++++++++++
>  tools/perf/util/evlist.h |  4 ++++
>  tools/perf/util/evsel.h  |  1 +
>  4 files changed, 46 insertions(+)
> 
> diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
> index 2553bef1279d..a9b13d72fd29 100644
> --- a/tools/perf/util/cpumap.h
> +++ b/tools/perf/util/cpumap.h
> @@ -60,4 +60,12 @@ int cpu_map__build_map(struct perf_cpu_map *cpus, struct perf_cpu_map **res,
>  
>  int cpu_map__cpu(struct perf_cpu_map *cpus, int idx);
>  bool cpu_map__has(struct perf_cpu_map *cpus, int cpu);
> +
> +#define __cpumap__for_each_cpu(cpus, index, cpu, maxcpu)\
> +	for ((index) = 0; 				\
> +	     (cpu) = (index) < (maxcpu) ? (cpus)->map[index] : -1, (index) < (maxcpu); \
> +	     (index)++)
> +#define cpumap__for_each_cpu(cpus, index, cpu) \
> +	__cpumap__for_each_cpu(cpus, index, cpu, (cpus)->nr)

there's perf_cpu_map__for_each_cpu macro in libperf

jirka

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ