Commit | Line | Data |
---|---|---|
94c744b6 ACM |
1 | #ifndef __PERF_SESSION_H |
2 | #define __PERF_SESSION_H | |
3 | ||
301a0b02 | 4 | #include "event.h" |
94c744b6 | 5 | #include "header.h" |
9de89fe7 | 6 | #include "symbol.h" |
4aa65636 | 7 | #include "thread.h" |
b3165f41 | 8 | #include <linux/rbtree.h> |
f823e441 | 9 | #include "../../../include/linux/perf_event.h" |
b3165f41 | 10 | |
a328626b | 11 | struct ip_callchain; |
b3165f41 | 12 | struct thread; |
94c744b6 ACM |
13 | |
14 | struct perf_session { | |
15 | struct perf_header header; | |
16 | unsigned long size; | |
ec913369 | 17 | unsigned long mmap_window; |
4aa65636 | 18 | struct map_groups kmaps; |
b3165f41 ACM |
19 | struct rb_root threads; |
20 | struct thread *last_match; | |
de176489 | 21 | struct map *vmlinux_maps[MAP__NR_TYPES]; |
f823e441 | 22 | struct events_stats events_stats; |
cb8f0939 | 23 | struct rb_root stats_by_id; |
f823e441 | 24 | unsigned long event_total[PERF_RECORD_MAX]; |
31d337c4 | 25 | unsigned long unknown_events; |
4e4f06e4 | 26 | struct rb_root hists; |
c019879b | 27 | u64 sample_type; |
9de89fe7 | 28 | struct ref_reloc_sym ref_reloc_sym; |
94c744b6 | 29 | int fd; |
ec913369 ACM |
30 | int cwdlen; |
31 | char *cwd; | |
94c744b6 ACM |
32 | char filename[0]; |
33 | }; | |
34 | ||
301a0b02 ACM |
35 | typedef int (*event_op)(event_t *self, struct perf_session *session); |
36 | ||
37 | struct perf_event_ops { | |
55aa640f ACM |
38 | event_op sample, |
39 | mmap, | |
40 | comm, | |
41 | fork, | |
42 | exit, | |
43 | lost, | |
44 | read, | |
45 | throttle, | |
46 | unthrottle; | |
301a0b02 ACM |
47 | }; |
48 | ||
75be6cf4 | 49 | struct perf_session *perf_session__new(const char *filename, int mode, bool force); |
94c744b6 ACM |
50 | void perf_session__delete(struct perf_session *self); |
51 | ||
ba21594c ACM |
52 | void perf_event_header__bswap(struct perf_event_header *self); |
53 | ||
6122e4e4 ACM |
54 | int __perf_session__process_events(struct perf_session *self, |
55 | u64 data_offset, u64 data_size, u64 size, | |
56 | struct perf_event_ops *ops); | |
301a0b02 | 57 | int perf_session__process_events(struct perf_session *self, |
ec913369 | 58 | struct perf_event_ops *event_ops); |
301a0b02 | 59 | |
b3c9ac08 ACM |
60 | struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, |
61 | struct thread *thread, | |
62 | struct ip_callchain *chain, | |
63 | struct symbol **parent); | |
a328626b | 64 | |
d549c769 | 65 | bool perf_session__has_traces(struct perf_session *self, const char *msg); |
27295592 | 66 | |
ba21594c ACM |
67 | int perf_header__read_build_ids(struct perf_header *self, int input, |
68 | u64 offset, u64 file_size); | |
301a0b02 | 69 | |
56b03f3c ACM |
70 | int perf_session__set_kallsyms_ref_reloc_sym(struct perf_session *self, |
71 | const char *symbol_name, | |
72 | u64 addr); | |
56b03f3c | 73 | |
ba21594c ACM |
74 | void mem_bswap_64(void *src, int byte_size); |
75 | ||
9de89fe7 ACM |
76 | static inline int __perf_session__create_kernel_maps(struct perf_session *self, |
77 | struct dso *kernel) | |
78 | { | |
79 | return __map_groups__create_kernel_maps(&self->kmaps, | |
80 | self->vmlinux_maps, kernel); | |
81 | } | |
82 | ||
e727ca73 ACM |
83 | static inline int perf_session__create_kernel_maps(struct perf_session *self) |
84 | { | |
85 | return map_groups__create_kernel_maps(&self->kmaps, self->vmlinux_maps); | |
86 | } | |
87 | ||
9de89fe7 ACM |
88 | static inline struct map * |
89 | perf_session__new_module_map(struct perf_session *self, | |
90 | u64 start, const char *filename) | |
91 | { | |
92 | return map_groups__new_module(&self->kmaps, start, filename); | |
93 | } | |
f9224c5c ACM |
94 | |
95 | #ifdef NO_NEWT_SUPPORT | |
5f4d3f88 ACM |
96 | static inline int perf_session__browse_hists(struct rb_root *hists __used, |
97 | u64 nr_hists __used, | |
f9224c5c | 98 | u64 session_total __used, |
533c46c3 ACM |
99 | const char *helpline __used, |
100 | const char *input_name __used) | |
5f4d3f88 ACM |
101 | { |
102 | return 0; | |
103 | } | |
f9224c5c | 104 | #else |
5f4d3f88 | 105 | int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists, |
533c46c3 ACM |
106 | u64 session_total, const char *helpline, |
107 | const char *input_name); | |
f9224c5c | 108 | #endif |
94c744b6 | 109 | #endif /* __PERF_SESSION_H */ |