[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1519945751-37786-3-git-send-email-kan.liang@linux.intel.com>
Date: Thu, 1 Mar 2018 18:09:00 -0500
From: kan.liang@...ux.intel.com
To: acme@...nel.org, mingo@...hat.com, linux-kernel@...r.kernel.org
Cc: jolsa@...hat.com, namhyung@...nel.org, wangnan0@...wei.com,
ak@...ux.intel.com, Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH 03/14] perf python: Apply new perf_mmap__read_event() interface
From: Kan Liang <kan.liang@...ux.intel.com>
The perf python still use the legacy interface.
No functional change.
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
tools/perf/util/python.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 2918cac..62aed42 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -983,13 +983,19 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
union perf_event *event;
int sample_id_all = 1, cpu;
static char *kwlist[] = { "cpu", "sample_id_all", NULL };
+ struct perf_mmap *md;
+ u64 end, start;
int err;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist,
&cpu, &sample_id_all))
return NULL;
- event = perf_evlist__mmap_read(evlist, cpu);
+ md = &evlist->mmap[cpu];
+ if (perf_mmap__read_init(md, 0, &start, &end) < 0)
+ goto end;
+
+ event = perf_mmap__read_event(md, 0, &start, end);
if (event != NULL) {
PyObject *pyevent = pyrf_event__new(event);
struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
@@ -1007,14 +1013,14 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
err = perf_evsel__parse_sample(evsel, event, &pevent->sample);
/* Consume the even only after we parsed it out. */
- perf_evlist__mmap_consume(evlist, cpu);
+ perf_mmap__consume(md, 0);
if (err)
return PyErr_Format(PyExc_OSError,
"perf: can't parse sample, err=%d", err);
return pyevent;
}
-
+end:
Py_INCREF(Py_None);
return Py_None;
}
--
2.4.11
Powered by blists - more mailing lists