From d5fed6ffb9531e544ada6de0827e4fdcf780fce0 Mon Sep 17 00:00:00 2001 From: Franck Bui-Huu Date: Tue, 30 Nov 2010 12:50:14 +0100 Subject: [PATCH] --- yaml --- r: 223032 b: refs/heads/master c: 60e677373be9c0bf7c9a22937601d5a40e51c042 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/util/header.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index f0ad6fcd16ad..e59da1d312b7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d214afbd81405d4da2c5745fe867e6b313fd4178 +refs/heads/master: 60e677373be9c0bf7c9a22937601d5a40e51c042 diff --git a/trunk/tools/perf/util/header.c b/trunk/tools/perf/util/header.c index d7e67b167ea3..64a85bafde63 100644 --- a/trunk/tools/perf/util/header.c +++ b/trunk/tools/perf/util/header.c @@ -946,11 +946,16 @@ perf_header__find_attr(u64 id, struct perf_header *header) /* * We set id to -1 if the data file doesn't contain sample - * ids. Check for this and avoid walking through the entire - * list of ids which may be large. + * ids. This can happen when the data file contains one type + * of event and in that case, the header can still store the + * event attribute information. Check for this and avoid + * walking through the entire list of ids which may be large. */ - if (id == -1ULL) + if (id == -1ULL) { + if (header->attrs > 0) + return &header->attr[0]->attr; return NULL; + } for (i = 0; i < header->attrs; i++) { struct perf_header_attr *attr = header->attr[i];