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 typedef union event_union {
73 struct perf_event_header header;
75 struct mmap_event mmap;
76 struct comm_event comm;
77 struct fork_event fork;
78 struct lost_event lost;
79 struct read_event read;
80 struct sample_event sample;
88 void event__print_totals(void);
98 struct rb_node rb_node;
99 struct list_head node;
105 u64 (*map_ip)(struct map *, u64);
106 u64 (*unmap_ip)(struct map *, u64);
110 static inline u64 map__map_ip(struct map *map, u64 ip)
112 return ip - map->start + map->pgoff;
115 static inline u64 map__unmap_ip(struct map *map, u64 ip)
117 return ip + map->start - map->pgoff;
120 static inline u64 identity__map_ip(struct map *map __used, u64 ip)
127 typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym);
129 void map__init(struct map *self, enum map_type type,
130 u64 start, u64 end, u64 pgoff, struct dso *dso);
131 struct map *map__new(struct mmap_event *event, enum map_type,
132 char *cwd, int cwdlen);
133 void map__delete(struct map *self);
134 struct map *map__clone(struct map *self);
135 int map__overlap(struct map *l, struct map *r);
136 size_t map__fprintf(struct map *self, FILE *fp);
137 struct symbol *map__find_symbol(struct map *self, u64 addr,
138 symbol_filter_t filter);
139 void map__fixup_start(struct map *self);
140 void map__fixup_end(struct map *self);
142 int event__synthesize_thread(pid_t pid, int (*process)(event_t *event));
143 void event__synthesize_threads(int (*process)(event_t *event));
145 extern char *event__cwd;
146 extern int event__cwdlen;
147 extern struct events_stats event__stats;
148 extern unsigned long event__total[PERF_RECORD_MAX];
150 int event__process_comm(event_t *self);
151 int event__process_lost(event_t *self);
152 int event__process_mmap(event_t *self);
153 int event__process_task(event_t *self);
155 #endif /* __PERF_RECORD_H */