diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-25 08:42:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-26 08:25:02 -0400 |
commit | 727ab04edbc4767711a7aeff5e00249b267ed4c1 (patch) | |
tree | 9cebc2c392b9b3bcaf68f0a50144273ef52a04f1 /tools/perf/util/python.c | |
parent | c752d04066a36ae30b29795f3fa3f536292c1f8c (diff) |
perf evlist: Fix grouping of multiple events
The __perf_evsel__open routing was grouping just the threads for that
specific events per cpu when we want to group all threads in all events
to the first fd opened on that cpu.
So pass the xyarray with the first event, where the other events will be
able to get that first per cpu fd.
At some point top and record will switch to using perf_evlist__open that
takes care of this detail and probably will also handle the fallback
from hw to soft counters, etc.
Reported-by: Deng-Cheng Zhu <dczhu@mips.com>
Tested-by: Deng-Cheng Zhu <dczhu@mips.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-ebm34rh098i9y9v4cytfdp0x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/python.c')
-rw-r--r-- | tools/perf/util/python.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 7624324efad4..9dd47a4f2596 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c | |||
@@ -623,7 +623,11 @@ static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel, | |||
623 | cpus = ((struct pyrf_cpu_map *)pcpus)->cpus; | 623 | cpus = ((struct pyrf_cpu_map *)pcpus)->cpus; |
624 | 624 | ||
625 | evsel->attr.inherit = inherit; | 625 | evsel->attr.inherit = inherit; |
626 | if (perf_evsel__open(evsel, cpus, threads, group) < 0) { | 626 | /* |
627 | * This will group just the fds for this single evsel, to group | ||
628 | * multiple events, use evlist.open(). | ||
629 | */ | ||
630 | if (perf_evsel__open(evsel, cpus, threads, group, NULL) < 0) { | ||
627 | PyErr_SetFromErrno(PyExc_OSError); | 631 | PyErr_SetFromErrno(PyExc_OSError); |
628 | return NULL; | 632 | return NULL; |
629 | } | 633 | } |
@@ -814,6 +818,25 @@ static PyObject *pyrf_evlist__read_on_cpu(struct pyrf_evlist *pevlist, | |||
814 | return Py_None; | 818 | return Py_None; |
815 | } | 819 | } |
816 | 820 | ||
821 | static PyObject *pyrf_evlist__open(struct pyrf_evlist *pevlist, | ||
822 | PyObject *args, PyObject *kwargs) | ||
823 | { | ||
824 | struct perf_evlist *evlist = &pevlist->evlist; | ||
825 | int group = 0; | ||
826 | static char *kwlist[] = { "group", NULL }; | ||
827 | |||
828 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOii", kwlist, &group)) | ||
829 | return NULL; | ||
830 | |||
831 | if (perf_evlist__open(evlist, group) < 0) { | ||
832 | PyErr_SetFromErrno(PyExc_OSError); | ||
833 | return NULL; | ||
834 | } | ||
835 | |||
836 | Py_INCREF(Py_None); | ||
837 | return Py_None; | ||
838 | } | ||
839 | |||
817 | static PyMethodDef pyrf_evlist__methods[] = { | 840 | static PyMethodDef pyrf_evlist__methods[] = { |
818 | { | 841 | { |
819 | .ml_name = "mmap", | 842 | .ml_name = "mmap", |
@@ -822,6 +845,12 @@ static PyMethodDef pyrf_evlist__methods[] = { | |||
822 | .ml_doc = PyDoc_STR("mmap the file descriptor table.") | 845 | .ml_doc = PyDoc_STR("mmap the file descriptor table.") |
823 | }, | 846 | }, |
824 | { | 847 | { |
848 | .ml_name = "open", | ||
849 | .ml_meth = (PyCFunction)pyrf_evlist__open, | ||
850 | .ml_flags = METH_VARARGS | METH_KEYWORDS, | ||
851 | .ml_doc = PyDoc_STR("open the file descriptors.") | ||
852 | }, | ||
853 | { | ||
825 | .ml_name = "poll", | 854 | .ml_name = "poll", |
826 | .ml_meth = (PyCFunction)pyrf_evlist__poll, | 855 | .ml_meth = (PyCFunction)pyrf_evlist__poll, |
827 | .ml_flags = METH_VARARGS | METH_KEYWORDS, | 856 | .ml_flags = METH_VARARGS | METH_KEYWORDS, |