perf tools: Use rb_tree for maps
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / tools / perf / util / event.h
blob4c69eb5538071542500151fbee8370272d2ae8f9
1 #ifndef __PERF_RECORD_H
2 #define __PERF_RECORD_H
4 #include "../perf.h"
5 #include "util.h"
6 #include <linux/rbtree.h>
8 enum {
9 SHOW_KERNEL = 1,
10 SHOW_USER = 2,
11 SHOW_HV = 4,
15 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
17 struct ip_event {
18 struct perf_event_header header;
19 u64 ip;
20 u32 pid, tid;
21 unsigned char __more_data[];
24 struct mmap_event {
25 struct perf_event_header header;
26 u32 pid, tid;
27 u64 start;
28 u64 len;
29 u64 pgoff;
30 char filename[PATH_MAX];
33 struct comm_event {
34 struct perf_event_header header;
35 u32 pid, tid;
36 char comm[16];
39 struct fork_event {
40 struct perf_event_header header;
41 u32 pid, ppid;
42 u32 tid, ptid;
43 u64 time;
46 struct lost_event {
47 struct perf_event_header header;
48 u64 id;
49 u64 lost;
53 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
55 struct read_event {
56 struct perf_event_header header;
57 u32 pid, tid;
58 u64 value;
59 u64 time_enabled;
60 u64 time_running;
61 u64 id;
64 struct sample_event{
65 struct perf_event_header header;
66 u64 array[];
70 typedef union event_union {
71 struct perf_event_header header;
72 struct ip_event ip;
73 struct mmap_event mmap;
74 struct comm_event comm;
75 struct fork_event fork;
76 struct lost_event lost;
77 struct read_event read;
78 struct sample_event sample;
79 } event_t;
81 struct map {
82 struct rb_node rb_node;
83 u64 start;
84 u64 end;
85 u64 pgoff;
86 u64 (*map_ip)(struct map *, u64);
87 struct dso *dso;
90 static inline u64 map__map_ip(struct map *map, u64 ip)
92 return ip - map->start + map->pgoff;
95 static inline u64 vdso__map_ip(struct map *map __used, u64 ip)
97 return ip;
100 struct map *map__new(struct mmap_event *event, char *cwd, int cwdlen);
101 struct map *map__clone(struct map *self);
102 int map__overlap(struct map *l, struct map *r);
103 size_t map__fprintf(struct map *self, FILE *fp);
105 #endif /* __PERF_RECORD_H */