[PATCH 06/10] perf trace: apply new mmap_read interfaces

From: kan . liang
Date: Tue Oct 10 2017 - 13:25:18 EST


From: Kan Liang <kan.liang@xxxxxxxxx>

no functional change

Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
---
tools/perf/builtin-trace.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index afef6fe..cd5aaf2 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -2424,8 +2424,14 @@ static int trace__run(struct trace *trace, int argc, const char **argv)

for (i = 0; i < evlist->nr_mmaps; i++) {
union perf_event *event;
+ struct perf_mmap_read read;

- while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) {
+ if (perf_evlist__mmap_read_init(evlist, i, &read, false)) {
+ fprintf(trace->output, "Can't get mmap information\n");
+ continue;
+ }
+
+ while ((event = perf_mmap__read_event(&read)) != NULL) {
struct perf_sample sample;

++trace->nr_events;
@@ -2448,6 +2454,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
draining = true;
}
}
+ perf_mmap__read_done(&read);
}

if (trace->nr_events == before) {
--
2.5.5