1 #ifndef __PERF_RECORD_H
2 #define __PERF_RECORD_H
6 #include <linux/list.h>
7 #include <linux/rbtree.h>
10 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
13 struct perf_event_header header;
16 unsigned char __more_data[];
20 struct perf_event_header header;
25 char filename[PATH_MAX];
29 struct perf_event_header header;
35 struct perf_event_header header;
42 struct perf_event_header header;
48 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
51 struct perf_event_header header;
60 struct perf_event_header header;
64 #define BUILD_ID_SIZE 20
66 struct build_id_event {
67 struct perf_event_header header;
68 u8 build_id[ALIGN(BUILD_ID_SIZE, sizeof(u64))];
72 struct build_id_list {
73 struct build_id_event event;
74 struct list_head list;
79 typedef union event_union {
80 struct perf_event_header header;
82 struct mmap_event mmap;
83 struct comm_event comm;
84 struct fork_event fork;
85 struct lost_event lost;
86 struct read_event read;
87 struct sample_event sample;
92 struct rb_node rb_node;
93 struct list_head node;
98 u64 (*map_ip)(struct map *, u64);
99 u64 (*unmap_ip)(struct map *, u64);
103 static inline u64 map__map_ip(struct map *map, u64 ip)
105 return ip - map->start + map->pgoff;
108 static inline u64 map__unmap_ip(struct map *map, u64 ip)
110 return ip + map->start - map->pgoff;
113 static inline u64 identity__map_ip(struct map *map __used, u64 ip)
120 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
122 void map__init(struct map *self, u64 start, u64 end, u64 pgoff,
124 struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
125 struct map *map__clone(struct map *self);
126 int map__overlap(struct map *l, struct map *r);
127 size_t map__fprintf(struct map *self, FILE *fp);
128 struct symbol *map__find_symbol(struct map *self, u64 ip, symbol_filter_t filter);
130 int event__synthesize_thread(pid_t pid, int (*process)(event_t *event));
131 void event__synthesize_threads(int (*process)(event_t *event));
133 #endif /* __PERF_RECORD_H */