summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.h
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-16 16:32:43 -0200
committerIngo Molnar <mingo@elte.hu>2009-11-16 22:05:50 +0100
commit37562eac3767c7f07bb1a1329708ff6453e47570 (patch)
treebd60ab6dcdce361cef82129e06b0d51a14ff9fe0 /tools/perf/util/header.h
parent8f41146aedf803856fb6477056e3960cb9ba8f9c (diff)
downloadlinux-37562eac3767c7f07bb1a1329708ff6453e47570.tar.gz
linux-37562eac3767c7f07bb1a1329708ff6453e47570.tar.bz2
linux-37562eac3767c7f07bb1a1329708ff6453e47570.zip
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 {
off_t id_offset;
};
-#define HEADER_TRACE_INFO 1
-#define HEADER_BUILD_ID 2
+enum {
+ HEADER_TRACE_INFO = 1,
+ HEADER_BUILD_ID,
+ HEADER_LAST_FEATURE,
+};
#define HEADER_FEAT_BITS 256
+struct perf_file_section {
+ u64 offset;
+ u64 size;
+};
+
+struct perf_file_header {
+ u64 magic;
+ u64 size;
+ u64 attr_size;
+ struct perf_file_section attrs;
+ struct perf_file_section data;
+ struct perf_file_section event_types;
+ DECLARE_BITMAP(adds_features, HEADER_FEAT_BITS);
+};
+
+struct perf_header;
+
+int perf_file_header__read(struct perf_file_header *self,
+ struct perf_header *ph, int fd);
+
struct perf_header {
int frozen;
int attrs, size;
@@ -54,4 +77,8 @@ bool perf_header__has_feat(const struct perf_header *self, int feat);
struct perf_header *perf_header__new(void);
+int perf_header__process_sections(struct perf_header *self, int fd,
+ int (*process)(struct perf_file_section *self,
+ int feat, int fd));
+
#endif /* __PERF_HEADER_H */