1e0da9ca31aa0bdd0812420020654fba5487d44a
[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
7 struct perf_session {
8         struct perf_header      header;
9         unsigned long           size;
10         unsigned long           mmap_window;
11         int                     fd;
12         int                     cwdlen;
13         char                    *cwd;
14         char filename[0];
15 };
16
17 typedef int (*event_op)(event_t *self, struct perf_session *session);
18
19 struct perf_event_ops {
20         event_op        process_sample_event;
21         event_op        process_mmap_event;
22         event_op        process_comm_event;
23         event_op        process_fork_event;
24         event_op        process_exit_event;
25         event_op        process_lost_event;
26         event_op        process_read_event;
27         event_op        process_throttle_event;
28         event_op        process_unthrottle_event;
29         int             (*sample_type_check)(u64 sample_type);
30         unsigned long   total_unknown;
31         bool            full_paths;
32 };
33
34 struct perf_session *perf_session__new(const char *filename, int mode,
35                                        bool force);
36 void perf_session__delete(struct perf_session *self);
37
38 int perf_session__process_events(struct perf_session *self,
39                                  struct perf_event_ops *event_ops);
40
41 int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
42
43 #endif /* __PERF_SESSION_H */