Re: [PATCH v6 10/12] perf stat: Use affinity for reading

From: Jiri Olsa
Date: Fri Nov 15 2019 - 09:55:37 EST


On Mon, Nov 11, 2019 at 04:59:39PM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> Restructure event reading to use affinity to minimize the number
> of IPIs needed.
>
> Before on a large test case with 94 CPUs:
>
> % time seconds usecs/call calls errors syscall
> ------ ----------- ----------- --------- --------- ----------------
> 3.16 0.106079 4 22082 read
>
> After:
>
> 3.43 0.081295 3 22082 read
>
> Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
>
> ---
>
> v2: Use new iterator macros
> v3: Use new iterator macros
> v4: Change iterator macros even more
> v5: Preserve counter->err in all cases
> ---
> tools/perf/builtin-stat.c | 95 ++++++++++++++++++++++-----------------
> tools/perf/util/evsel.h | 1 +
> 2 files changed, 55 insertions(+), 41 deletions(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index 039aefb07777..7784f5a93944 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -266,15 +266,10 @@ static int read_single_counter(struct evsel *counter, int cpu,
> * Read out the results of a single counter:
> * do not aggregate counts across CPUs in system-wide mode
> */
> -static int read_counter(struct evsel *counter, struct timespec *rs)
> +static int read_counter(struct evsel *counter, struct timespec *rs, int cpu)

please rename this to read_counter_cpu

thanks,
jirka