aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-16 13:32:43 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-16 16:05:50 -0500
commit37562eac3767c7f07bb1a1329708ff6453e47570 (patch)
treebd60ab6dcdce361cef82129e06b0d51a14ff9fe0 /tools/perf/util/header.h
parent8f41146aedf803856fb6477056e3960cb9ba8f9c (diff)
perf tools: Generalize perf_header__adds_read()
Renaming it to perf_header__process_sections() and passing a callback to handle each feature. The next changesets will introduce 'perf buildid-list' that will handle just the HEADER_BUILD_ID table, ignoring all the other features. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1258396365-29217-3-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/header.h')
-rw-r--r--tools/perf/util/header.h31
1 files changed, 29 insertions, 2 deletions
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h
index a22d70b07571..f1b3bf7bdfc1 100644
--- a/tools/perf/util/header.h
+++ b/tools/perf/util/header.h
@@ -15,11 +15,34 @@ struct perf_header_attr {
15 off_t id_offset; 15 off_t id_offset;
16}; 16};
17 17
18#define HEADER_TRACE_INFO 1 18enum {
19#define HEADER_BUILD_ID 2 19 HEADER_TRACE_INFO = 1,
20 HEADER_BUILD_ID,
21 HEADER_LAST_FEATURE,
22};
20 23
21#define HEADER_FEAT_BITS 256 24#define HEADER_FEAT_BITS 256
22 25
26struct perf_file_section {
27 u64 offset;
28 u64 size;
29};
30
31struct perf_file_header {
32 u64 magic;
33 u64 size;
34 u64 attr_size;
35 struct perf_file_section attrs;
36 struct perf_file_section data;
37 struct perf_file_section event_types;
38 DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
39};
40
41struct perf_header;
42
43int perf_file_header__read(struct perf_file_header *self,
44 struct perf_header *ph, int fd);
45
23struct perf_header { 46struct perf_header {
24 int frozen; 47 int frozen;
25 int attrs, size; 48 int attrs, size;
@@ -54,4 +77,8 @@ bool perf_header__has_feat(const struct perf_header *self, int feat);
54 77
55struct perf_header *perf_header__new(void); 78struct perf_header *perf_header__new(void);
56 79
80int perf_header__process_sections(struct perf_header *self, int fd,
81 int (*process)(struct perf_file_section *self,
82 int feat, int fd));
83
57#endif /* __PERF_HEADER_H */ 84#endif /* __PERF_HEADER_H */