perf tools: Introduce perf_evlist__mmap_cb_idx()
authorJiri Olsa <jolsa@kernel.org>
Mon, 7 Oct 2019 12:53:26 +0000 (14:53 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 10 Oct 2019 15:23:52 +0000 (12:23 -0300)
Add perf_evlist__mmap_cb_idx function to call auxtrace_mmap_params__set_idx()
on each new index during perf_evlist__mmap_ops call.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20191007125344.14268-19-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evlist.c

index a9b189ac859bba175471b161d653db2414f63d6f..11716f2b965aefe12d8e75304559bd19e4a4bb26 100644 (file)
@@ -739,6 +739,17 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx,
        return 0;
 }
 
+static void
+perf_evlist__mmap_cb_idx(struct perf_evlist *_evlist,
+                        struct perf_mmap_param *_mp,
+                        int idx, bool per_cpu)
+{
+       struct evlist *evlist = container_of(_evlist, struct evlist, core);
+       struct mmap_params *mp = container_of(_mp, struct mmap_params, core);
+
+       auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, idx, per_cpu);
+}
+
 static int evlist__mmap_per_cpu(struct evlist *evlist,
                                     struct mmap_params *mp)
 {
@@ -935,6 +946,9 @@ int evlist__mmap_ex(struct evlist *evlist, unsigned int pages,
                .flush          = flush,
                .comp_level     = comp_level
        };
+       struct perf_evlist_mmap_ops ops __maybe_unused = {
+               .idx = perf_evlist__mmap_cb_idx,
+       };
 
        if (!evlist->mmap)
                evlist->mmap = evlist__alloc_mmap(evlist, false);