1 #ifndef __PERF_HEADER_H
2 #define __PERF_HEADER_H
4 #include "../../../include/linux/perf_event.h"
9 #include <linux/bitmap.h>
11 struct perf_header_attr
{
12 struct perf_event_attr attr
;
19 HEADER_TRACE_INFO
= 1,
24 #define HEADER_FEAT_BITS 256
26 struct perf_file_section
{
31 struct perf_file_header
{
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
);
43 int perf_file_header__read(struct perf_file_header
*self
,
44 struct perf_header
*ph
, int fd
);
49 struct perf_header_attr
**attr
;
55 DECLARE_BITMAP(adds_features
, HEADER_FEAT_BITS
);
58 int perf_header__init(struct perf_header
*self
);
59 void perf_header__exit(struct perf_header
*self
);
61 int perf_header__read(struct perf_header
*self
, int fd
);
62 int perf_header__write(struct perf_header
*self
, int fd
, bool at_exit
);
64 int perf_header__add_attr(struct perf_header
*self
,
65 struct perf_header_attr
*attr
);
67 void perf_header__push_event(u64 id
, const char *name
);
68 char *perf_header__find_event(u64 id
);
70 struct perf_header_attr
*perf_header_attr__new(struct perf_event_attr
*attr
);
71 void perf_header_attr__delete(struct perf_header_attr
*self
);
73 int perf_header_attr__add_id(struct perf_header_attr
*self
, u64 id
);
75 u64
perf_header__sample_type(struct perf_header
*header
);
76 struct perf_event_attr
*
77 perf_header__find_attr(u64 id
, struct perf_header
*header
);
78 void perf_header__set_feat(struct perf_header
*self
, int feat
);
79 bool perf_header__has_feat(const struct perf_header
*self
, int feat
);
81 int perf_header__process_sections(struct perf_header
*self
, int fd
,
82 int (*process
)(struct perf_file_section
*self
,
85 #endif /* __PERF_HEADER_H */