]>
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 | |
c61e52ee | 11 | struct sample_queue; |
a328626b | 12 | struct ip_callchain; |
b3165f41 | 13 | struct thread; |
94c744b6 | 14 | |
c61e52ee FW |
15 | struct ordered_samples { |
16 | u64 last_flush; | |
17 | u64 flush_limit; | |
18 | struct list_head samples_head; | |
19 | struct sample_queue *last_inserted; | |
20 | }; | |
21 | ||
94c744b6 ACM |
22 | struct perf_session { |
23 | struct perf_header header; | |
24 | unsigned long size; | |
ec913369 | 25 | unsigned long mmap_window; |
b3165f41 ACM |
26 | struct rb_root threads; |
27 | struct thread *last_match; | |
a1645ce1 | 28 | struct rb_root kerninfo_root; |
f823e441 | 29 | struct events_stats events_stats; |
cb8f0939 | 30 | struct rb_root stats_by_id; |
f823e441 | 31 | unsigned long event_total[PERF_RECORD_MAX]; |
31d337c4 | 32 | unsigned long unknown_events; |
4e4f06e4 | 33 | struct rb_root hists; |
c019879b | 34 | u64 sample_type; |
94c744b6 | 35 | int fd; |
8dc58101 | 36 | bool fd_pipe; |
ec913369 ACM |
37 | int cwdlen; |
38 | char *cwd; | |
c61e52ee | 39 | struct ordered_samples ordered_samples; |
94c744b6 ACM |
40 | char filename[0]; |
41 | }; | |
42 | ||
301a0b02 ACM |
43 | typedef int (*event_op)(event_t *self, struct perf_session *session); |
44 | ||
45 | struct perf_event_ops { | |
55aa640f ACM |
46 | event_op sample, |
47 | mmap, | |
48 | comm, | |
49 | fork, | |
50 | exit, | |
51 | lost, | |
52 | read, | |
53 | throttle, | |
2c46dbb5 | 54 | unthrottle, |
cd19a035 | 55 | attr, |
9215545e | 56 | event_type, |
c7929e47 TZ |
57 | tracing_data, |
58 | build_id; | |
c61e52ee | 59 | bool ordered_samples; |
301a0b02 ACM |
60 | }; |
61 | ||
75be6cf4 | 62 | struct perf_session *perf_session__new(const char *filename, int mode, bool force); |
94c744b6 ACM |
63 | void perf_session__delete(struct perf_session *self); |
64 | ||
ba21594c ACM |
65 | void perf_event_header__bswap(struct perf_event_header *self); |
66 | ||
6122e4e4 ACM |
67 | int __perf_session__process_events(struct perf_session *self, |
68 | u64 data_offset, u64 data_size, u64 size, | |
69 | struct perf_event_ops *ops); | |
301a0b02 | 70 | int perf_session__process_events(struct perf_session *self, |
ec913369 | 71 | struct perf_event_ops *event_ops); |
301a0b02 | 72 | |
b3c9ac08 ACM |
73 | struct map_symbol *perf_session__resolve_callchain(struct perf_session *self, |
74 | struct thread *thread, | |
75 | struct ip_callchain *chain, | |
76 | struct symbol **parent); | |
a328626b | 77 | |
d549c769 | 78 | bool perf_session__has_traces(struct perf_session *self, const char *msg); |
27295592 | 79 | |
a1645ce1 | 80 | int perf_session__set_kallsyms_ref_reloc_sym(struct map **maps, |
56b03f3c ACM |
81 | const char *symbol_name, |
82 | u64 addr); | |
56b03f3c | 83 | |
ba21594c ACM |
84 | void mem_bswap_64(void *src, int byte_size); |
85 | ||
a1645ce1 | 86 | int perf_session__create_kernel_maps(struct perf_session *self); |
f9224c5c | 87 | |
8dc58101 TZ |
88 | int do_read(int fd, void *buf, size_t size); |
89 | void perf_session__update_sample_type(struct perf_session *self); | |
90 | ||
f9224c5c | 91 | #ifdef NO_NEWT_SUPPORT |
5f4d3f88 ACM |
92 | static inline int perf_session__browse_hists(struct rb_root *hists __used, |
93 | u64 nr_hists __used, | |
f9224c5c | 94 | u64 session_total __used, |
533c46c3 ACM |
95 | const char *helpline __used, |
96 | const char *input_name __used) | |
5f4d3f88 ACM |
97 | { |
98 | return 0; | |
99 | } | |
f9224c5c | 100 | #else |
5f4d3f88 | 101 | int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists, |
533c46c3 ACM |
102 | u64 session_total, const char *helpline, |
103 | const char *input_name); | |
f9224c5c | 104 | #endif |
94c744b6 | 105 | #endif /* __PERF_SESSION_H */ |