1 #ifndef __PERF_HEADER_H
2 #define __PERF_HEADER_H
4 #include <linux/perf_event.h>
10 #include <linux/bitmap.h>
13 HEADER_RESERVED
= 0, /* always cleared */
14 HEADER_FIRST_FEATURE
= 1,
15 HEADER_TRACING_DATA
= 1,
34 HEADER_FEAT_BITS
= 256,
37 struct perf_file_section
{
42 struct perf_file_header
{
46 struct perf_file_section attrs
;
47 struct perf_file_section data
;
48 struct perf_file_section event_types
;
49 DECLARE_BITMAP(adds_features
, HEADER_FEAT_BITS
);
52 struct perf_pipe_file_header
{
59 int perf_file_header__read(struct perf_file_header
*header
,
60 struct perf_header
*ph
, int fd
);
62 struct perf_session_env
{
71 unsigned long long total_mem
;
77 int nr_sibling_threads
;
78 char *sibling_threads
;
94 DECLARE_BITMAP(adds_features
, HEADER_FEAT_BITS
);
95 struct perf_session_env env
;
101 int perf_session__read_header(struct perf_session
*session
, int fd
);
102 int perf_session__write_header(struct perf_session
*session
,
103 struct perf_evlist
*evlist
,
104 int fd
, bool at_exit
);
105 int perf_header__write_pipe(int fd
);
107 int perf_header__push_event(u64 id
, const char *name
);
108 char *perf_header__find_event(u64 id
);
110 void perf_header__set_feat(struct perf_header
*header
, int feat
);
111 void perf_header__clear_feat(struct perf_header
*header
, int feat
);
112 bool perf_header__has_feat(const struct perf_header
*header
, int feat
);
114 int perf_header__set_cmdline(int argc
, const char **argv
);
116 int perf_header__process_sections(struct perf_header
*header
, int fd
,
118 int (*process
)(struct perf_file_section
*section
,
119 struct perf_header
*ph
,
120 int feat
, int fd
, void *data
));
122 int perf_header__fprintf_info(struct perf_session
*s
, FILE *fp
, bool full
);
124 int build_id_cache__add_s(const char *sbuild_id
, const char *debugdir
,
125 const char *name
, bool is_kallsyms
, bool is_vdso
);
126 int build_id_cache__remove_s(const char *sbuild_id
, const char *debugdir
);
128 int perf_event__synthesize_attr(struct perf_tool
*tool
,
129 struct perf_event_attr
*attr
, u32 ids
, u64
*id
,
130 perf_event__handler_t process
);
131 int perf_event__synthesize_attrs(struct perf_tool
*tool
,
132 struct perf_session
*session
,
133 perf_event__handler_t process
);
134 int perf_event__process_attr(union perf_event
*event
, struct perf_evlist
**pevlist
);
136 int perf_event__synthesize_event_type(struct perf_tool
*tool
,
137 u64 event_id
, char *name
,
138 perf_event__handler_t process
,
139 struct machine
*machine
);
140 int perf_event__synthesize_event_types(struct perf_tool
*tool
,
141 perf_event__handler_t process
,
142 struct machine
*machine
);
143 int perf_event__process_event_type(struct perf_tool
*tool
,
144 union perf_event
*event
);
146 int perf_event__synthesize_tracing_data(struct perf_tool
*tool
,
147 int fd
, struct perf_evlist
*evlist
,
148 perf_event__handler_t process
);
149 int perf_event__process_tracing_data(union perf_event
*event
,
150 struct perf_session
*session
);
152 int perf_event__synthesize_build_id(struct perf_tool
*tool
,
153 struct dso
*pos
, u16 misc
,
154 perf_event__handler_t process
,
155 struct machine
*machine
);
156 int perf_event__process_build_id(struct perf_tool
*tool
,
157 union perf_event
*event
,
158 struct perf_session
*session
);
159 bool is_perf_magic(u64 magic
);
162 * arch specific callback
164 int get_cpuid(char *buffer
, size_t sz
);
166 #endif /* __PERF_HEADER_H */