[PATCH v10 03/10] perf record: Prepare picking perf_event_mmap_page from multiple evlists

From: Wang Nan
Date: Thu Jun 23 2016 - 01:31:18 EST


Following commits introduce new evlists to record. This patch adjusts
record__pick_pc() and introduces perf_evlist__pick_pc() to read control
page from one specific evlist. record__pick_pc() will be improved to search
control page from multiple evlists.

Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
---
tools/perf/builtin-record.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bc34e6b..10e6e89 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -685,10 +685,21 @@ perf_event__synth_time_conv(const struct perf_event_mmap_page *pc __maybe_unused
return 0;
}

+static const struct perf_event_mmap_page *
+perf_evlist__pick_pc(struct perf_evlist *evlist)
+{
+ if (evlist && evlist->mmap && evlist->mmap[0].base)
+ return evlist->mmap[0].base;
+ return NULL;
+}
+
static const struct perf_event_mmap_page *record__pick_pc(struct record *rec)
{
- if (rec->evlist && rec->evlist->mmap && rec->evlist->mmap[0].base)
- return rec->evlist->mmap[0].base;
+ const struct perf_event_mmap_page *pc;
+
+ pc = perf_evlist__pick_pc(rec->evlist);
+ if (pc)
+ return pc;
return NULL;
}

--
1.8.3.4