diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2011-05-22 04:17:22 +0400 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2011-05-22 05:38:49 +0400 |
commit | 5538becaec9ca2ff21e7826372941dc46f498487 (patch) | |
tree | 66b51fae732a6993f4af1434a1ffe4a83110c71c /tools/perf/util/python.c | |
parent | 98e1da905cbe64bb023a165c7c01eef5e800609e (diff) | |
download | linux-5538becaec9ca2ff21e7826372941dc46f498487.tar.xz |
perf tools: Propagate event parse error handling
Better handle event parsing error by propagating the details
in upper layers or by dumping some failure message. So that
the user knows he has some crazy events in the batch.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Diffstat (limited to 'tools/perf/util/python.c')
-rw-r--r-- | tools/perf/util/python.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 4174c0990320..3344d6e6f048 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -675,6 +675,7 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, union perf_event *event; int sample_id_all = 1, cpu; static char *kwlist[] = {"sample_id_all", NULL, NULL}; + int err; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist, &cpu, &sample_id_all)) @@ -690,12 +691,17 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, return PyErr_NoMemory(); first = list_entry(evlist->entries.next, struct perf_evsel, node); - perf_event__parse_sample(event, first->attr.sample_type, - perf_sample_size(first->attr.sample_type), - sample_id_all, &pevent->sample); + err = perf_event__parse_sample(event, first->attr.sample_type, + perf_sample_size(first->attr.sample_type), + sample_id_all, &pevent->sample); + if (err) { + pr_err("Can't parse sample, err = %d\n", err); + goto end; + } + return pyevent; } - +end: Py_INCREF(Py_None); return Py_None; } |