aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-11-11 04:51:05 +0100
committerIngo Molnar <mingo@elte.hu>2009-11-11 07:30:18 +0100
commit4778d2e4f410c6eea32f594cb2be9590bcb28b84 (patch)
tree99625c6a532d83606e0d6c8ec7c812d5d5047e50 /tools/perf/util/header.c
parent57f395a7eabb913d3605d7392be5bdb0837c9f3d (diff)
perf tools: Read the build-ids from the header layer
Keep the build-ids reading implementation in the data mapping but move its call to the headers so that we have a better control on it (offset seeking, size passing, etc..). Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp> LKML-Reference: <1257911467-28276-4-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 2f702c23f71..915b56edbf0 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -9,6 +9,8 @@
#include "../perf.h"
#include "trace-event.h"
#include "symbol.h"
+#include "data_map.h"
+#include "debug.h"
/*
* Create new perf.data header attribute:
@@ -322,6 +324,14 @@ static void perf_header__adds_read(struct perf_header *self, int fd)
trace_report(fd);
lseek(fd, trace_sec.offset + trace_sec.size, SEEK_SET);
}
+
+ if (perf_header__has_feat(self, HEADER_BUILD_ID)) {
+ struct stat input_stat;
+
+ fstat(fd, &input_stat);
+ if (perf_header__read_build_ids(self, fd, input_stat.st_size))
+ pr_debug("failed to read buildids, continuing...\n");
+ }
};
struct perf_header *perf_header__read(int fd)
@@ -382,14 +392,14 @@ struct perf_header *perf_header__read(int fd)
memcpy(&self->adds_features, &f_header.adds_features, sizeof(f_header.adds_features));
- perf_header__adds_read(self, fd);
-
self->event_offset = f_header.event_types.offset;
self->event_size = f_header.event_types.size;
self->data_offset = f_header.data.offset;
self->data_size = f_header.data.size;
+ perf_header__adds_read(self, fd);
+
lseek(fd, self->data_offset, SEEK_SET);
self->frozen = 1;