[PATCH 20/36] perf tools: Add perf_evlist__mmap_cb_mmap function

From: Jiri Olsa
Date: Mon Oct 07 2019 - 08:58:22 EST


Adding perf_evlist__mmap_cb_mmap function to call perf
specific mmap__mmap function during perf_evlist__mmap_ops
call.

Link: http://lkml.kernel.org/n/tip-38lonlyp6kzfartpl20qy2dy@xxxxxxxxxxxxxx
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/util/evlist.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a59303de3421..e7216139f37a 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -749,6 +749,16 @@ perf_evlist__mmap_cb_get(struct perf_evlist *_evlist, bool overwrite, int idx)
return &maps[idx].core;
}

+static int
+perf_evlist__mmap_cb_mmap(struct perf_mmap *_map, struct perf_mmap_param *_mp,
+ int output, int cpu)
+{
+ struct mmap *map = container_of(_map, struct mmap, core);
+ struct mmap_params *mp = container_of(_mp, struct mmap_params, core);
+
+ return mmap__mmap(map, mp, output, cpu);
+}
+
static int evlist__mmap_per_cpu(struct evlist *evlist,
struct mmap_params *mp)
{
@@ -946,8 +956,9 @@ int evlist__mmap_ex(struct evlist *evlist, unsigned int pages,
.comp_level = comp_level
};
struct perf_evlist_mmap_ops ops __maybe_unused = {
- .idx = perf_evlist__mmap_cb_idx,
- .get = perf_evlist__mmap_cb_get,
+ .idx = perf_evlist__mmap_cb_idx,
+ .get = perf_evlist__mmap_cb_get,
+ .mmap = perf_evlist__mmap_cb_mmap,
};

if (!evlist->mmap)
--
2.21.0