1 #ifndef __PERF_RECORD_H
2 #define __PERF_RECORD_H
12 struct perf_event_header header;
17 char filename[PATH_MAX];
21 struct perf_event_header header;
32 char filename[PATH_MAX];
36 struct perf_event_header header;
42 struct perf_event_header header;
49 struct perf_event_header header;
55 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
58 struct perf_event_header header;
66 struct throttle_event {
67 struct perf_event_header header;
73 #define PERF_SAMPLE_MASK \
74 (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
75 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
76 PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \
77 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
78 PERF_SAMPLE_IDENTIFIER)
80 /* perf sample has 16 bits size limit */
81 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
84 struct perf_event_header header;
100 struct sample_read_value {
111 struct sample_read_value *values;
113 struct sample_read_value one;
117 struct ip_callchain {
122 struct branch_flags {
130 struct branch_entry {
133 struct branch_flags flags;
136 struct branch_stack {
138 struct branch_entry entries[0];
155 struct ip_callchain *callchain;
156 struct branch_stack *branch_stack;
157 struct regs_dump user_regs;
158 struct stack_dump user_stack;
159 struct sample_read read;
162 #define PERF_MEM_DATA_SRC_NONE \
163 (PERF_MEM_S(OP, NA) |\
164 PERF_MEM_S(LVL, NA) |\
165 PERF_MEM_S(SNOOP, NA) |\
166 PERF_MEM_S(LOCK, NA) |\
169 struct build_id_event {
170 struct perf_event_header header;
172 u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
176 enum perf_user_event_type { /* above any possible kernel type */
177 PERF_RECORD_USER_TYPE_START = 64,
178 PERF_RECORD_HEADER_ATTR = 64,
179 PERF_RECORD_HEADER_EVENT_TYPE = 65, /* depreceated */
180 PERF_RECORD_HEADER_TRACING_DATA = 66,
181 PERF_RECORD_HEADER_BUILD_ID = 67,
182 PERF_RECORD_FINISHED_ROUND = 68,
183 PERF_RECORD_HEADER_MAX
187 struct perf_event_header header;
188 struct perf_event_attr attr;
192 #define MAX_EVENT_NAME 64
194 struct perf_trace_event_type {
196 char name[MAX_EVENT_NAME];
199 struct event_type_event {
200 struct perf_event_header header;
201 struct perf_trace_event_type event_type;
204 struct tracing_data_event {
205 struct perf_event_header header;
210 struct perf_event_header header;
211 struct mmap_event mmap;
212 struct mmap2_event mmap2;
213 struct comm_event comm;
214 struct fork_event fork;
215 struct lost_event lost;
216 struct read_event read;
217 struct throttle_event throttle;
218 struct sample_event sample;
219 struct attr_event attr;
220 struct event_type_event event_type;
221 struct tracing_data_event tracing_data;
222 struct build_id_event build_id;
225 void perf_event__print_totals(void);
230 typedef int (*perf_event__handler_t)(struct perf_tool *tool,
231 union perf_event *event,
232 struct perf_sample *sample,
233 struct machine *machine);
235 int perf_event__synthesize_thread_map(struct perf_tool *tool,
236 struct thread_map *threads,
237 perf_event__handler_t process,
238 struct machine *machine, bool mmap_data);
239 int perf_event__synthesize_threads(struct perf_tool *tool,
240 perf_event__handler_t process,
241 struct machine *machine, bool mmap_data);
242 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
243 perf_event__handler_t process,
244 struct machine *machine);
246 int perf_event__synthesize_modules(struct perf_tool *tool,
247 perf_event__handler_t process,
248 struct machine *machine);
250 int perf_event__process_comm(struct perf_tool *tool,
251 union perf_event *event,
252 struct perf_sample *sample,
253 struct machine *machine);
254 int perf_event__process_lost(struct perf_tool *tool,
255 union perf_event *event,
256 struct perf_sample *sample,
257 struct machine *machine);
258 int perf_event__process_mmap(struct perf_tool *tool,
259 union perf_event *event,
260 struct perf_sample *sample,
261 struct machine *machine);
262 int perf_event__process_mmap2(struct perf_tool *tool,
263 union perf_event *event,
264 struct perf_sample *sample,
265 struct machine *machine);
266 int perf_event__process_fork(struct perf_tool *tool,
267 union perf_event *event,
268 struct perf_sample *sample,
269 struct machine *machine);
270 int perf_event__process_exit(struct perf_tool *tool,
271 union perf_event *event,
272 struct perf_sample *sample,
273 struct machine *machine);
274 int perf_event__process(struct perf_tool *tool,
275 union perf_event *event,
276 struct perf_sample *sample,
277 struct machine *machine);
279 struct addr_location;
281 int perf_event__preprocess_sample(const union perf_event *event,
282 struct machine *machine,
283 struct addr_location *al,
284 struct perf_sample *sample);
286 const char *perf_event__name(unsigned int id);
288 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
290 int perf_event__synthesize_sample(union perf_event *event, u64 type,
292 const struct perf_sample *sample,
295 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
296 union perf_event *event,
297 pid_t pid, pid_t tgid,
298 perf_event__handler_t process,
299 struct machine *machine,
302 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
303 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
304 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
305 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
306 size_t perf_event__fprintf(union perf_event *event, FILE *fp);
308 u64 kallsyms__get_function_start(const char *kallsyms_filename,
309 const char *symbol_name);
311 #endif /* __PERF_RECORD_H */