Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 1 | #ifndef __PERF_SESSION_H |
| 2 | #define __PERF_SESSION_H |
| 3 | |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 4 | #include "event.h" |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 5 | #include "header.h" |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 6 | #include "thread.h" |
Arnaldo Carvalho de Melo | b3165f4 | 2009-12-13 19:50:28 -0200 | [diff] [blame] | 7 | #include <linux/rbtree.h> |
| 8 | |
Arnaldo Carvalho de Melo | a328626 | 2009-12-14 14:22:59 -0200 | [diff] [blame] | 9 | struct ip_callchain; |
Arnaldo Carvalho de Melo | b3165f4 | 2009-12-13 19:50:28 -0200 | [diff] [blame] | 10 | struct thread; |
Arnaldo Carvalho de Melo | a328626 | 2009-12-14 14:22:59 -0200 | [diff] [blame] | 11 | struct symbol; |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 12 | struct symbol_conf; |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 13 | |
| 14 | struct perf_session { |
| 15 | struct perf_header header; |
| 16 | unsigned long size; |
Arnaldo Carvalho de Melo | ec91336 | 2009-12-13 19:50:27 -0200 | [diff] [blame] | 17 | unsigned long mmap_window; |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 18 | struct map_groups kmaps; |
Arnaldo Carvalho de Melo | b3165f4 | 2009-12-13 19:50:28 -0200 | [diff] [blame] | 19 | struct rb_root threads; |
| 20 | struct thread *last_match; |
Arnaldo Carvalho de Melo | 4e4f06e | 2009-12-14 13:10:39 -0200 | [diff] [blame] | 21 | struct rb_root hists; |
Arnaldo Carvalho de Melo | c019879 | 2009-12-14 14:23:00 -0200 | [diff] [blame^] | 22 | u64 sample_type; |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 23 | int fd; |
Arnaldo Carvalho de Melo | ec91336 | 2009-12-13 19:50:27 -0200 | [diff] [blame] | 24 | int cwdlen; |
| 25 | char *cwd; |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 26 | bool use_modules; |
Arnaldo Carvalho de Melo | 4e4f06e | 2009-12-14 13:10:39 -0200 | [diff] [blame] | 27 | bool use_callchain; |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 28 | char filename[0]; |
| 29 | }; |
| 30 | |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 31 | typedef int (*event_op)(event_t *self, struct perf_session *session); |
| 32 | |
| 33 | struct perf_event_ops { |
| 34 | event_op process_sample_event; |
| 35 | event_op process_mmap_event; |
| 36 | event_op process_comm_event; |
| 37 | event_op process_fork_event; |
| 38 | event_op process_exit_event; |
| 39 | event_op process_lost_event; |
| 40 | event_op process_read_event; |
| 41 | event_op process_throttle_event; |
| 42 | event_op process_unthrottle_event; |
Arnaldo Carvalho de Melo | c019879 | 2009-12-14 14:23:00 -0200 | [diff] [blame^] | 43 | int (*sample_type_check)(struct perf_session *session); |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 44 | unsigned long total_unknown; |
Arnaldo Carvalho de Melo | ec91336 | 2009-12-13 19:50:27 -0200 | [diff] [blame] | 45 | bool full_paths; |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | struct perf_session *perf_session__new(const char *filename, int mode, |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 49 | bool force, struct symbol_conf *conf); |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 50 | void perf_session__delete(struct perf_session *self); |
| 51 | |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 52 | int perf_session__process_events(struct perf_session *self, |
Arnaldo Carvalho de Melo | ec91336 | 2009-12-13 19:50:27 -0200 | [diff] [blame] | 53 | struct perf_event_ops *event_ops); |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 54 | |
Arnaldo Carvalho de Melo | a328626 | 2009-12-14 14:22:59 -0200 | [diff] [blame] | 55 | struct symbol **perf_session__resolve_callchain(struct perf_session *self, |
| 56 | struct thread *thread, |
| 57 | struct ip_callchain *chain, |
| 58 | struct symbol **parent); |
| 59 | |
Arnaldo Carvalho de Melo | 301a0b0 | 2009-12-13 19:50:25 -0200 | [diff] [blame] | 60 | int perf_header__read_build_ids(int input, u64 offset, u64 file_size); |
| 61 | |
Arnaldo Carvalho de Melo | 94c744b | 2009-12-11 21:24:02 -0200 | [diff] [blame] | 62 | #endif /* __PERF_SESSION_H */ |