summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.h
diff options
context:
space:
mode:
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 */