[PATCH 08/10] perf python: apply new mmap_read interfaces
From: kan . liang
Date: Tue Oct 10 2017 - 13:24:35 EST
From: Kan Liang <kan.liang@xxxxxxxxx>
no functional change
Signed-off-by: Kan Liang <kan.liang@xxxxxxxxx>
---
tools/perf/util/python.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index c129e99..cfbaa86 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -948,6 +948,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
{
struct perf_evlist *evlist = &pevlist->evlist;
union perf_event *event;
+ struct perf_mmap_read read;
int sample_id_all = 1, cpu;
static char *kwlist[] = { "cpu", "sample_id_all", NULL };
int err;
@@ -956,7 +957,11 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
&cpu, &sample_id_all))
return NULL;
- event = perf_evlist__mmap_read(evlist, cpu);
+ if (perf_evlist__mmap_read_init(evlist, cpu, &read, false))
+ return PyErr_Format(PyExc_OSError,
+ "Can't get mmap information\n");
+
+ event = perf_mmap__read_event(&read);
if (event != NULL) {
PyObject *pyevent = pyrf_event__new(event);
struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
@@ -975,7 +980,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
/* Consume the even only after we parsed it out. */
perf_evlist__mmap_consume(evlist, cpu);
-
+ perf_mmap__read_done(&read);
if (err)
return PyErr_Format(PyExc_OSError,
"perf: can't parse sample, err=%d", err);
--
2.5.5