perf session: Keep pointers to the vmlinux maps
[linux-2.6.git] / tools / perf / util / session.h
1 #ifndef __PERF_SESSION_H
2 #define __PERF_SESSION_H
3
4 #include "event.h"
5 #include "header.h"
6 #include "thread.h"
7 #include <linux/rbtree.h>
8 #include "../../../include/linux/perf_event.h"
9
10 struct ip_callchain;
11 struct thread;
12 struct symbol;
13
14 struct perf_session {
15         struct perf_header      header;
16         unsigned long           size;
17         unsigned long           mmap_window;
18         struct map_groups       kmaps;
19         struct rb_root          threads;
20         struct thread           *last_match;
21         struct map              *vmlinux_maps[MAP__NR_TYPES];
22         struct events_stats     events_stats;
23         unsigned long           event_total[PERF_RECORD_MAX];
24         unsigned long           unknown_events;
25         struct rb_root          hists;
26         u64                     sample_type;
27         int                     fd;
28         int                     cwdlen;
29         char                    *cwd;
30         char filename[0];
31 };
32
33 typedef int (*event_op)(event_t *self, struct perf_session *session);
34
35 struct perf_event_ops {
36         event_op sample,
37                  mmap,
38                  comm,
39                  fork,
40                  exit,
41                  lost,
42                  read,
43                  throttle,
44                  unthrottle;
45 };
46
47 struct perf_session *perf_session__new(const char *filename, int mode, bool force);
48 void perf_session__delete(struct perf_session *self);
49
50 int perf_session__process_events(struct perf_session *self,
51                                  struct perf_event_ops *event_ops);
52
53 struct symbol **perf_session__resolve_callchain(struct perf_session *self,
54                                                 struct thread *thread,
55                                                 struct ip_callchain *chain,
56                                                 struct symbol **parent);
57
58 bool perf_session__has_traces(struct perf_session *self, const char *msg);
59
60 int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
61
62 #endif /* __PERF_SESSION_H */