2019-10-07 12:57:03

by Jiri Olsa

[permalink] [raw]
Subject: [PATCH 18/36] perf tools: Add perf_evlist__mmap_cb_idx function

Adding perf_evlist__mmap_cb_idx function to call
auxtrace_mmap_params__set_idx on each new index
during perf_evlist__mmap_ops call.

Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
---
tools/perf/util/evlist.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 09fe8fe9805d..71fdc6c92920 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -715,6 +715,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)
{
@@ -911,6 +922,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);
--
2.21.0


Subject: [tip: perf/core] perf tools: Introduce perf_evlist__mmap_cb_idx()

The following commit has been merged into the perf/core branch of tip:

Commit-ID: 9abd2ab2377613425e1c362694f85b110f5bace2
Gitweb: https://git.kernel.org/tip/9abd2ab2377613425e1c362694f85b110f5bace2
Author: Jiri Olsa <[email protected]>
AuthorDate: Mon, 07 Oct 2019 14:53:26 +02:00
Committer: Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Thu, 10 Oct 2019 12:23:52 -03:00

perf tools: Introduce perf_evlist__mmap_cb_idx()

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 <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Michael Petlan <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/perf/util/evlist.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a9b189a..11716f2 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -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);