aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-02-19 20:47:26 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-02-29 16:29:44 -0500
commit30e68bcc67e41ab6dab4e4e1efc7ea8ca893c0af (patch)
tree49934bc86d7df5a86311a1123c08f3a389e8b2aa /tools
parent30ce2f7eef095d1b8d070740f1948629814fe3c7 (diff)
perf evlist: Return first evsel for non-sample event on old kernel
On old kernels that don't support sample_id_all feature, perf_evlist__id2evsel() returns NULL for non-sampling events. This breaks perf top when multiple events are given on command line. Fix it by using first evsel in the evlist. This will also prevent getting the same (potential) problem in such new tool/ old kernel combo. Suggested-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1329702447-25045-1-git-send-email-namhyung.kim@lge.com Signed-off-by: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/evlist.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 3f16e08a5c8d..ea32a061f1c8 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
349 hlist_for_each_entry(sid, pos, head, node) 349 hlist_for_each_entry(sid, pos, head, node)
350 if (sid->id == id) 350 if (sid->id == id)
351 return sid->evsel; 351 return sid->evsel;
352
353 if (!perf_evlist__sample_id_all(evlist))
354 return list_entry(evlist->entries.next, struct perf_evsel, node);
355
352 return NULL; 356 return NULL;
353} 357}
354 358