diff options
Diffstat (limited to 'tools/perf')
-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]; |