perf: Fix performance issue with perf report
[platform/adaptation/renesas_rcar/renesas_kernel.git] / tools / perf / util / header.c
index 2b9f898..8847bec 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;