Commit | Line | Data |
---|---|---|
94c744b6 ACM |
1 | #ifndef __PERF_SESSION_H |
2 | #define __PERF_SESSION_H | |
3 | ||
29f5ffd3 | 4 | #include "trace-event.h" |
301a0b02 | 5 | #include "event.h" |
94c744b6 | 6 | #include "header.h" |
69d2591a | 7 | #include "machine.h" |
9de89fe7 | 8 | #include "symbol.h" |
4aa65636 | 9 | #include "thread.h" |
f5fc1412 | 10 | #include "data.h" |
5f86b80b | 11 | #include "ordered-events.h" |
b3165f41 | 12 | #include <linux/rbtree.h> |
d2709c7c | 13 | #include <linux/perf_event.h> |
b3165f41 | 14 | |
a328626b | 15 | struct ip_callchain; |
b3165f41 | 16 | struct thread; |
94c744b6 | 17 | |
c446870d | 18 | struct auxtrace; |
f6986c95 | 19 | struct itrace_synth_opts; |
c446870d | 20 | |
94c744b6 ACM |
21 | struct perf_session { |
22 | struct perf_header header; | |
876650e6 | 23 | struct machines machines; |
e248de33 | 24 | struct perf_evlist *evlist; |
c446870d | 25 | struct auxtrace *auxtrace; |
f6986c95 | 26 | struct itrace_synth_opts *itrace_synth_opts; |
99fa2984 | 27 | struct list_head auxtrace_index; |
29f5ffd3 | 28 | struct trace_event tevent; |
46bc29b9 | 29 | struct time_conv_event time_conv; |
454c407e | 30 | bool repipe; |
919d86d3 AH |
31 | bool one_mmap; |
32 | void *one_mmap_addr; | |
33 | u64 one_mmap_offset; | |
37e39aa8 | 34 | struct ordered_events ordered_events; |
cc9784bd | 35 | struct perf_data_file *file; |
9870d780 | 36 | struct perf_tool *tool; |
94c744b6 ACM |
37 | }; |
38 | ||
a6ffaf91 DA |
39 | #define PRINT_IP_OPT_IP (1<<0) |
40 | #define PRINT_IP_OPT_SYM (1<<1) | |
41 | #define PRINT_IP_OPT_DSO (1<<2) | |
42 | #define PRINT_IP_OPT_SYMOFFSET (1<<3) | |
b0b35f01 | 43 | #define PRINT_IP_OPT_ONELINE (1<<4) |
cc8fae1d | 44 | #define PRINT_IP_OPT_SRCLINE (1<<5) |
fd4be130 | 45 | #define PRINT_IP_OPT_UNKNOWN_AS_ADDR (1<<6) |
a6ffaf91 | 46 | |
45694aa7 | 47 | struct perf_tool; |
301a0b02 | 48 | |
f5fc1412 JO |
49 | struct perf_session *perf_session__new(struct perf_data_file *file, |
50 | bool repipe, struct perf_tool *tool); | |
876650e6 | 51 | void perf_session__delete(struct perf_session *session); |
94c744b6 | 52 | |
316c7136 | 53 | void perf_event_header__bswap(struct perf_event_header *hdr); |
ba21594c | 54 | |
5a52f33a AH |
55 | int perf_session__peek_event(struct perf_session *session, off_t file_offset, |
56 | void *buf, size_t buf_sz, | |
57 | union perf_event **event_ptr, | |
58 | struct perf_sample *sample); | |
59 | ||
b7b61cbe | 60 | int perf_session__process_events(struct perf_session *session); |
301a0b02 | 61 | |
b7b61cbe ACM |
62 | int perf_session__queue_event(struct perf_session *s, union perf_event *event, |
63 | struct perf_sample *sample, u64 file_offset); | |
9c501402 DA |
64 | |
65 | void perf_tool__fill_defaults(struct perf_tool *tool); | |
66 | ||
316c7136 ACM |
67 | int perf_session__resolve_callchain(struct perf_session *session, |
68 | struct perf_evsel *evsel, | |
1b3a0e95 FW |
69 | struct thread *thread, |
70 | struct ip_callchain *chain, | |
71 | struct symbol **parent); | |
a328626b | 72 | |
316c7136 | 73 | bool perf_session__has_traces(struct perf_session *session, const char *msg); |
27295592 | 74 | |
eda3913b | 75 | void perf_event__attr_swap(struct perf_event_attr *attr); |
ba21594c | 76 | |
316c7136 | 77 | int perf_session__create_kernel_maps(struct perf_session *session); |
f9224c5c | 78 | |
7b56cce2 | 79 | void perf_session__set_id_hdr_size(struct perf_session *session); |
8dc58101 | 80 | |
23346f21 | 81 | static inline |
316c7136 | 82 | struct machine *perf_session__find_machine(struct perf_session *session, pid_t pid) |
23346f21 | 83 | { |
316c7136 | 84 | return machines__find(&session->machines, pid); |
23346f21 ACM |
85 | } |
86 | ||
87 | static inline | |
316c7136 | 88 | struct machine *perf_session__findnew_machine(struct perf_session *session, pid_t pid) |
23346f21 | 89 | { |
316c7136 | 90 | return machines__findnew(&session->machines, pid); |
23346f21 ACM |
91 | } |
92 | ||
316c7136 | 93 | struct thread *perf_session__findnew(struct perf_session *session, pid_t pid); |
9d8b172f | 94 | int perf_session__register_idle_thread(struct perf_session *session); |
c53d138d | 95 | |
316c7136 | 96 | size_t perf_session__fprintf(struct perf_session *session, FILE *fp); |
743eb868 | 97 | |
316c7136 | 98 | size_t perf_session__fprintf_dsos(struct perf_session *session, FILE *fp); |
cbf69680 | 99 | |
417c2ff6 ACM |
100 | size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp, |
101 | bool (fn)(struct dso *dso, int parm), int parm); | |
c8446b9b | 102 | |
e248de33 | 103 | size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp); |
d0dd74e8 | 104 | |
9cbdb702 DA |
105 | struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session, |
106 | unsigned int type); | |
107 | ||
ff0c1078 ACM |
108 | int perf_evsel__fprintf_sym(struct perf_evsel *evsel, struct perf_sample *sample, |
109 | struct addr_location *al, int left_alignment, | |
110 | unsigned int print_opts, unsigned int stack_depth, | |
111 | FILE *fp); | |
c0230b2b | 112 | |
5d67be97 AB |
113 | int perf_session__cpu_bitmap(struct perf_session *session, |
114 | const char *cpu_list, unsigned long *cpu_bitmap); | |
115 | ||
fbe96f29 | 116 | void perf_session__fprintf_info(struct perf_session *s, FILE *fp, bool full); |
da378962 ACM |
117 | |
118 | struct perf_evsel_str_handler; | |
119 | ||
120 | int __perf_session__set_tracepoints_handlers(struct perf_session *session, | |
121 | const struct perf_evsel_str_handler *assocs, | |
122 | size_t nr_assocs); | |
123 | ||
124 | #define perf_session__set_tracepoints_handlers(session, array) \ | |
125 | __perf_session__set_tracepoints_handlers(session, array, ARRAY_SIZE(array)) | |
33e940a2 ACM |
126 | |
127 | extern volatile int session_done; | |
128 | ||
1da34daf | 129 | #define session_done() ACCESS_ONCE(session_done) |
3c659eed | 130 | |
a293829d AH |
131 | int perf_session__deliver_synth_event(struct perf_session *session, |
132 | union perf_event *event, | |
b7b61cbe | 133 | struct perf_sample *sample); |
a293829d | 134 | |
3c659eed AH |
135 | int perf_event__process_id_index(struct perf_tool *tool, |
136 | union perf_event *event, | |
137 | struct perf_session *session); | |
138 | ||
139 | int perf_event__synthesize_id_index(struct perf_tool *tool, | |
140 | perf_event__handler_t process, | |
141 | struct perf_evlist *evlist, | |
142 | struct machine *machine); | |
143 | ||
94c744b6 | 144 | #endif /* __PERF_SESSION_H */ |