aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/python.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/python.c')
-rw-r--r--tools/perf/util/python.c14
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,
675 union perf_event *event; 675 union perf_event *event;
676 int sample_id_all = 1, cpu; 676 int sample_id_all = 1, cpu;
677 static char *kwlist[] = {"sample_id_all", NULL, NULL}; 677 static char *kwlist[] = {"sample_id_all", NULL, NULL};
678 int err;
678 679
679 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist, 680 if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|i", kwlist,
680 &cpu, &sample_id_all)) 681 &cpu, &sample_id_all))
@@ -690,12 +691,17 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist,
690 return PyErr_NoMemory(); 691 return PyErr_NoMemory();
691 692
692 first = list_entry(evlist->entries.next, struct perf_evsel, node); 693 first = list_entry(evlist->entries.next, struct perf_evsel, node);
693 perf_event__parse_sample(event, first->attr.sample_type, 694 err = perf_event__parse_sample(event, first->attr.sample_type,
694 perf_sample_size(first->attr.sample_type), 695 perf_sample_size(first->attr.sample_type),
695 sample_id_all, &pevent->sample); 696 sample_id_all, &pevent->sample);
697 if (err) {
698 pr_err("Can't parse sample, err = %d\n", err);
699 goto end;
700 }
701
696 return pyevent; 702 return pyevent;
697 } 703 }
698 704end:
699 Py_INCREF(Py_None); 705 Py_INCREF(Py_None);
700 return Py_None; 706 return Py_None;
701} 707}