[PATCH 04/10] perf tool: perf_mmap__read_init wrapper for evlist

From: kan . liang
Date: Tue Oct 10 2017 - 13:21:23 EST


From: Kan Liang <kan.liang@xxxxxxxxx>

Add a wrapper perf_evlist__mmap_read_init for perf_mmap__read_init.

Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
---
tools/perf/util/evlist.c | 9 +++++++++
tools/perf/util/evlist.h | 2 ++
2 files changed, 11 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index b36211e..f7fefdb 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -781,6 +781,15 @@ int perf_mmap__read_init(struct perf_mmap *md, struct perf_mmap_read *read,
&read->start, &read->end, backward);
}

+int perf_evlist__mmap_read_init(struct perf_evlist *evlist, int idx,
+ struct perf_mmap_read* read, bool backward)
+{
+ struct perf_mmap *md;
+
+ md = backward ? &evlist->backward_mmap[idx] : &evlist->mmap[idx];
+ return perf_mmap__read_init(md, read, evlist->overwrite, backward);
+}
+
/*
* Read the ring buffer in the range which specified in struct perf_mmap_read,
* and write to file.
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 53baf26..f292936 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -209,6 +209,8 @@ int perf_mmap__read_to_file(struct perf_mmap_read *read,
struct perf_data_file *file);
union perf_event *perf_mmap__read_event(struct perf_mmap_read *read);
void perf_mmap__read_done(struct perf_mmap_read *read);
+int perf_evlist__mmap_read_init(struct perf_evlist *evlist, int idx,
+ struct perf_mmap_read* read, bool backward);

int perf_evlist__open(struct perf_evlist *evlist);
void perf_evlist__close(struct perf_evlist *evlist);
--
2.5.5