From ee667f947c926eda1b8d6eccd0894bfbed75b6e3 Mon Sep 17 00:00:00 2001 From: Wang Nan Date: Mon, 27 Jun 2016 10:24:05 +0000 Subject: [PATCH] perf record: Prepare picking perf_event_mmap_page from multiple evlists 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 Cc: He Kuang Cc: Jiri Olsa Cc: Masami Hiramatsu Cc: Namhyung Kim Cc: Nilay Vaish Cc: Zefan Li Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1467023052-146749-4-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- 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 18e9abc90759..b2b3b600adf5 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -686,10 +686,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; } -- 2.30.2