Re: [PATCH V1 07/23] libperf evlist: Move ->idx() into mmap_per_evsel()

From: Ian Rogers
Date: Thu May 05 2022 - 19:09:42 EST


On Thu, May 5, 2022 at 9:57 AM Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
>
> Move ->idx() into mmap_per_evsel() in preparation for adding evsel as a
> parameter.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>

Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

Thanks,
Ian

> ---
> tools/lib/perf/evlist.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/tools/lib/perf/evlist.c b/tools/lib/perf/evlist.c
> index 6d0fa7b2f417..673c267f900e 100644
> --- a/tools/lib/perf/evlist.c
> +++ b/tools/lib/perf/evlist.c
> @@ -474,6 +474,9 @@ mmap_per_evsel(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
> */
> refcount_set(&map->refcnt, 2);
>
> + if (ops->idx)
> + ops->idx(evlist, mp, idx);
> +
> if (ops->mmap(map, mp, *output, evlist_cpu) < 0)
> return -1;
>
> @@ -516,9 +519,6 @@ mmap_per_thread(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
> int output = -1;
> int output_overwrite = -1;
>
> - if (ops->idx)
> - ops->idx(evlist, mp, thread);
> -
> if (mmap_per_evsel(evlist, ops, thread, mp, 0, thread,
> &output, &output_overwrite))
> goto out_unmap;
> @@ -543,9 +543,6 @@ mmap_per_cpu(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
> int output = -1;
> int output_overwrite = -1;
>
> - if (ops->idx)
> - ops->idx(evlist, mp, cpu);
> -
> for (thread = 0; thread < nr_threads; thread++) {
> if (mmap_per_evsel(evlist, ops, cpu, mp, cpu,
> thread, &output, &output_overwrite))
> --
> 2.25.1
>