Commit 377f698d authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf python: Add struct evsel into struct pyrf_event

To be able to find out event configuration info during sample parsing.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1468148882-10362-8-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1075fbb2
...@@ -48,6 +48,7 @@ PyMODINIT_FUNC initperf(void); ...@@ -48,6 +48,7 @@ PyMODINIT_FUNC initperf(void);
struct pyrf_event { struct pyrf_event {
PyObject_HEAD PyObject_HEAD
struct perf_evsel *evsel;
struct perf_sample sample; struct perf_sample sample;
union perf_event event; union perf_event event;
}; };
...@@ -865,11 +866,18 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, ...@@ -865,11 +866,18 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
if (event != NULL) { if (event != NULL) {
PyObject *pyevent = pyrf_event__new(event); PyObject *pyevent = pyrf_event__new(event);
struct pyrf_event *pevent = (struct pyrf_event *)pyevent; struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
struct perf_evsel *evsel;
if (pyevent == NULL) if (pyevent == NULL)
return PyErr_NoMemory(); return PyErr_NoMemory();
err = perf_evlist__parse_sample(evlist, event, &pevent->sample); evsel = perf_evlist__event2evsel(evlist, event);
if (!evsel)
return Py_None;
pevent->evsel = evsel;
err = perf_evsel__parse_sample(evsel, event, &pevent->sample);
/* Consume the even only after we parsed it out. */ /* Consume the even only after we parsed it out. */
perf_evlist__mmap_consume(evlist, cpu); perf_evlist__mmap_consume(evlist, cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment