aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-top.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2011-10-25 08:42:19 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2011-10-26 08:25:02 -0400
commit727ab04edbc4767711a7aeff5e00249b267ed4c1 (patch)
tree9cebc2c392b9b3bcaf68f0a50144273ef52a04f1 /tools/perf/builtin-top.c
parentc752d04066a36ae30b29795f3fa3f536292c1f8c (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/builtin-top.c')
-rw-r--r--tools/perf/builtin-top.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 7a871714d44e..d2fc7542e826 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -834,10 +834,16 @@ static void perf_session__mmap_read(struct perf_session *self)
834 834
835static void start_counters(struct perf_evlist *evlist) 835static void start_counters(struct perf_evlist *evlist)
836{ 836{
837 struct perf_evsel *counter; 837 struct perf_evsel *counter, *first;
838
839 first = list_entry(evlist->entries.next, struct perf_evsel, node);
838 840
839 list_for_each_entry(counter, &evlist->entries, node) { 841 list_for_each_entry(counter, &evlist->entries, node) {
840 struct perf_event_attr *attr = &counter->attr; 842 struct perf_event_attr *attr = &counter->attr;
843 struct xyarray *group_fd = NULL;
844
845 if (group && counter != first)
846 group_fd = first->fd;
841 847
842 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID; 848 attr->sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
843 849
@@ -860,7 +866,8 @@ static void start_counters(struct perf_evlist *evlist)
860 attr->inherit = inherit; 866 attr->inherit = inherit;
861try_again: 867try_again:
862 if (perf_evsel__open(counter, top.evlist->cpus, 868 if (perf_evsel__open(counter, top.evlist->cpus,
863 top.evlist->threads, group) < 0) { 869 top.evlist->threads, group,
870 group_fd) < 0) {
864 int err = errno; 871 int err = errno;
865 872
866 if (err == EPERM || err == EACCES) { 873 if (err == EPERM || err == EACCES) {