]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - tools/perf/util/header.c
perf: Fix performance issue with perf report
[net-next-2.6.git] / tools / perf / util / header.c
index 2b9f898efea6479290018d3aa7c6339586d4b45f..8847bec64c54119fc0e006dbd6350b231203dbd9 100644 (file)
@@ -922,6 +922,14 @@ perf_header__find_attr(u64 id, struct perf_header *header)
 {
        int i;
 
+       /*
+        * 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.
+        */
+       if (id == -1ULL)
+               return NULL;
+
        for (i = 0; i < header->attrs; i++) {
                struct perf_header_attr *attr = header->attr[i];
                int j;