diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2013-09-04 16:18:17 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-09-05 15:18:08 -0400 |
commit | 98be6966ed7ed977881305aff5a1bfb305090f43 (patch) | |
tree | defc5bbc7232ec4d88df9422f3faa25791241d6a | |
parent | 53a277e5c9b55ed3e91345fb98e5f57d6d70efd6 (diff) |
perf evlist: Fix parsing with no sample_id_all bit set
The perf_evlist__event2evsel() is changed to handle non-sample events
(such as mmap events) that have no id sample appended i.e. when
sample_id_all is not set.
Note that such events have a fixed format, so that the selected event
(evsel) they are associated with is immaterial.
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: David Ahern <dsahern@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1378325897-3840-3-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/evlist.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index b8727ae45e3b..7101283ac3c5 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c | |||
@@ -446,20 +446,25 @@ static int perf_evlist__event2id(struct perf_evlist *evlist, | |||
446 | static struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist, | 446 | static struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist, |
447 | union perf_event *event) | 447 | union perf_event *event) |
448 | { | 448 | { |
449 | struct perf_evsel *first = perf_evlist__first(evlist); | ||
449 | struct hlist_head *head; | 450 | struct hlist_head *head; |
450 | struct perf_sample_id *sid; | 451 | struct perf_sample_id *sid; |
451 | int hash; | 452 | int hash; |
452 | u64 id; | 453 | u64 id; |
453 | 454 | ||
454 | if (evlist->nr_entries == 1) | 455 | if (evlist->nr_entries == 1) |
455 | return perf_evlist__first(evlist); | 456 | return first; |
457 | |||
458 | if (!first->attr.sample_id_all && | ||
459 | event->header.type != PERF_RECORD_SAMPLE) | ||
460 | return first; | ||
456 | 461 | ||
457 | if (perf_evlist__event2id(evlist, event, &id)) | 462 | if (perf_evlist__event2id(evlist, event, &id)) |
458 | return NULL; | 463 | return NULL; |
459 | 464 | ||
460 | /* Synthesized events have an id of zero */ | 465 | /* Synthesized events have an id of zero */ |
461 | if (!id) | 466 | if (!id) |
462 | return perf_evlist__first(evlist); | 467 | return first; |
463 | 468 | ||
464 | hash = hash_64(id, PERF_EVLIST__HLIST_BITS); | 469 | hash = hash_64(id, PERF_EVLIST__HLIST_BITS); |
465 | head = &evlist->heads[hash]; | 470 | head = &evlist->heads[hash]; |