blob: 4e8a21c5304cac64cb1c96b90cdf3541d3309b0c [file] [log] [blame]
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -02001#ifndef __PERF_SESSION_H
2#define __PERF_SESSION_H
3
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -02004#include "event.h"
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -02005#include "header.h"
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -02006#include "thread.h"
Arnaldo Carvalho de Melob3165f42009-12-13 19:50:28 -02007#include <linux/rbtree.h>
8
Arnaldo Carvalho de Meloa3286262009-12-14 14:22:59 -02009struct ip_callchain;
Arnaldo Carvalho de Melob3165f42009-12-13 19:50:28 -020010struct thread;
Arnaldo Carvalho de Meloa3286262009-12-14 14:22:59 -020011struct symbol;
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -020012struct symbol_conf;
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -020013
14struct perf_session {
15 struct perf_header header;
16 unsigned long size;
Arnaldo Carvalho de Meloec913362009-12-13 19:50:27 -020017 unsigned long mmap_window;
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -020018 struct map_groups kmaps;
Arnaldo Carvalho de Melob3165f42009-12-13 19:50:28 -020019 struct rb_root threads;
20 struct thread *last_match;
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -020021 struct rb_root hists;
Arnaldo Carvalho de Meloc0198792009-12-14 14:23:00 -020022 u64 sample_type;
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -020023 int fd;
Arnaldo Carvalho de Meloec913362009-12-13 19:50:27 -020024 int cwdlen;
25 char *cwd;
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -020026 bool use_modules;
Arnaldo Carvalho de Melo4e4f06e2009-12-14 13:10:39 -020027 bool use_callchain;
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -020028 char filename[0];
29};
30
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -020031typedef int (*event_op)(event_t *self, struct perf_session *session);
32
33struct 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 Meloc0198792009-12-14 14:23:00 -020043 int (*sample_type_check)(struct perf_session *session);
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -020044 unsigned long total_unknown;
Arnaldo Carvalho de Meloec913362009-12-13 19:50:27 -020045 bool full_paths;
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -020046};
47
48struct perf_session *perf_session__new(const char *filename, int mode,
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -020049 bool force, struct symbol_conf *conf);
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -020050void perf_session__delete(struct perf_session *self);
51
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -020052int perf_session__process_events(struct perf_session *self,
Arnaldo Carvalho de Meloec913362009-12-13 19:50:27 -020053 struct perf_event_ops *event_ops);
Arnaldo Carvalho de Melo301a0b02009-12-13 19:50:25 -020054
Arnaldo Carvalho de Meloa3286262009-12-14 14:22:59 -020055struct 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 Melo301a0b02009-12-13 19:50:25 -020060int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
61
Arnaldo Carvalho de Melo94c744b2009-12-11 21:24:02 -020062#endif /* __PERF_SESSION_H */