John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 1 | #ifndef __PERF_HEADER_H |
| 2 | #define __PERF_HEADER_H |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 3 | |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 4 | #include "../../../include/linux/perf_event.h" |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 5 | #include <sys/types.h> |
| 6 | #include "types.h" |
| 7 | |
| 8 | struct perf_header_attr { |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 9 | struct perf_event_attr attr; |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 10 | int ids, size; |
| 11 | u64 *id; |
| 12 | off_t id_offset; |
| 13 | }; |
| 14 | |
| 15 | struct perf_header { |
| 16 | int frozen; |
| 17 | int attrs, size; |
| 18 | struct perf_header_attr **attr; |
Arjan van de Ven | dfe5a50 | 2009-07-20 22:54:26 -0700 | [diff] [blame] | 19 | s64 attr_offset; |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 20 | u64 data_offset; |
| 21 | u64 data_size; |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 22 | u64 event_offset; |
| 23 | u64 event_size; |
Frederic Weisbecker | 03456a1 | 2009-10-06 23:36:47 +0200 | [diff] [blame] | 24 | u64 trace_info_offset; |
| 25 | u64 trace_info_size; |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | struct perf_header *perf_header__read(int fd); |
| 29 | void perf_header__write(struct perf_header *self, int fd); |
| 30 | |
| 31 | void perf_header__add_attr(struct perf_header *self, |
| 32 | struct perf_header_attr *attr); |
| 33 | |
Arjan van de Ven | 8755a8f | 2009-09-12 07:52:51 +0200 | [diff] [blame] | 34 | void perf_header__push_event(u64 id, const char *name); |
| 35 | char *perf_header__find_event(u64 id); |
| 36 | |
| 37 | |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 38 | struct perf_header_attr * |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 39 | perf_header_attr__new(struct perf_event_attr *attr); |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 40 | void perf_header_attr__add_id(struct perf_header_attr *self, u64 id); |
| 41 | |
Frederic Weisbecker | 0d3a5c8 | 2009-08-16 20:56:37 +0200 | [diff] [blame] | 42 | u64 perf_header__sample_type(struct perf_header *header); |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 43 | struct perf_event_attr * |
Frederic Weisbecker | 0d3a5c8 | 2009-08-16 20:56:37 +0200 | [diff] [blame] | 44 | perf_header__find_attr(u64 id, struct perf_header *header); |
Frederic Weisbecker | 03456a1 | 2009-10-06 23:36:47 +0200 | [diff] [blame] | 45 | void perf_header__set_trace_info(void); |
Peter Zijlstra | 7c6a1c6 | 2009-06-25 17:05:54 +0200 | [diff] [blame] | 46 | |
| 47 | struct perf_header *perf_header__new(void); |
| 48 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 49 | #endif /* __PERF_HEADER_H */ |