Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1440078 > unrolled thread

[PATCH 07/10] perf python: Add struct evsel into struct pyrf_event

Started byJiri Olsa <jolsa@kernel.org>
First post2016-07-10 13:10 +0200
Last post2016-07-13 09:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 07/10] perf python: Add struct evsel into struct pyrf_event Jiri Olsa <jolsa@kernel.org> - 2016-07-10 13:10 +0200
    [tip:perf/core] perf python: Add struct evsel into struct  pyrf_event tip-bot for Jiri Olsa <tipbot@zytor.com> - 2016-07-13 09:30 +0200

#1440078 — [PATCH 07/10] perf python: Add struct evsel into struct pyrf_event

FromJiri Olsa <jolsa@kernel.org>
Date2016-07-10 13:10 +0200
Subject[PATCH 07/10] perf python: Add struct evsel into struct pyrf_event
Message-ID<rTkMy-8fe-21@gated-at.bofh.it>
To be able to find out event configuration info
during sample parsing.

Link: http://lkml.kernel.org/n/tip-b63rh6l44ort2t76etobvvui@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/python.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 45fdd4a68721..dc7adaa3a02c 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -48,6 +48,7 @@ PyMODINIT_FUNC initperf(void);
 
 struct pyrf_event {
 	PyObject_HEAD
+	struct perf_evsel *evsel;
 	struct perf_sample sample;
 	union perf_event   event;
 };
@@ -865,11 +866,18 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
 	if (event != NULL) {
 		PyObject *pyevent = pyrf_event__new(event);
 		struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
+		struct perf_evsel *evsel;
 
 		if (pyevent == NULL)
 			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. */
 		perf_evlist__mmap_consume(evlist, cpu);
-- 
2.4.11

[toc] | [next] | [standalone]


#1442109 — [tip:perf/core] perf python: Add struct evsel into struct pyrf_event

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2016-07-13 09:30 +0200
Subject[tip:perf/core] perf python: Add struct evsel into struct pyrf_event
Message-ID<rUmMj-8ia-49@gated-at.bofh.it>
In reply to#1440078
Commit-ID:  377f698db12150a1cf79987dca1d3990fa14a1f8
Gitweb:     http://git.kernel.org/tip/377f698db12150a1cf79987dca1d3990fa14a1f8
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Sun, 10 Jul 2016 13:07:59 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 12 Jul 2016 16:18:36 -0300

perf python: Add struct evsel into struct pyrf_event

To be able to find out event configuration info during sample parsing.

Signed-off-by: Jiri 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/python.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 45fdd4a..dc7adaa 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -48,6 +48,7 @@ PyMODINIT_FUNC initperf(void);
 
 struct pyrf_event {
 	PyObject_HEAD
+	struct perf_evsel *evsel;
 	struct perf_sample sample;
 	union perf_event   event;
 };
@@ -865,11 +866,18 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
 	if (event != NULL) {
 		PyObject *pyevent = pyrf_event__new(event);
 		struct pyrf_event *pevent = (struct pyrf_event *)pyevent;
+		struct perf_evsel *evsel;
 
 		if (pyevent == NULL)
 			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. */
 		perf_evlist__mmap_consume(evlist, cpu);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web