perf record: Prepare picking perf_event_mmap_page from multiple evlists
authorWang Nan <[email protected]>
Mon, 27 Jun 2016 10:24:05 +0000 (10:24 +0000)
committerArnaldo Carvalho de Melo <[email protected]>
Tue, 28 Jun 2016 13:54:54 +0000 (10:54 -0300)
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 <[email protected]>
Cc: He Kuang <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nilay Vaish <[email protected]>
Cc: Zefan Li <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/builtin-record.c

index 18e9abc90759a316f41a582c1569d80f2a19fd56..b2b3b600adf536a9b94551c6e68e402e858dfd20 100644 (file)
@@ -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;
 }