1 #ifndef __PERF_RECORD_H
2 #define __PERF_RECORD_H
12 struct perf_event_header header;
17 char filename[PATH_MAX];
21 struct perf_event_header header;
30 char filename[PATH_MAX];
34 struct perf_event_header header;
40 struct perf_event_header header;
47 struct perf_event_header header;
53 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID
56 struct perf_event_header header;
64 struct throttle_event {
65 struct perf_event_header header;
71 #define PERF_SAMPLE_MASK \
72 (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \
73 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
74 PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \
75 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
76 PERF_SAMPLE_IDENTIFIER)
78 /* perf sample has 16 bits size limit */
79 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
82 struct perf_event_header header;
97 struct sample_read_value {
108 struct sample_read_value *values;
110 struct sample_read_value one;
128 struct ip_callchain *callchain;
129 struct branch_stack *branch_stack;
130 struct regs_dump user_regs;
131 struct stack_dump user_stack;
132 struct sample_read read;
135 #define PERF_MEM_DATA_SRC_NONE \
136 (PERF_MEM_S(OP, NA) |\
137 PERF_MEM_S(LVL, NA) |\
138 PERF_MEM_S(SNOOP, NA) |\
139 PERF_MEM_S(LOCK, NA) |\
142 struct build_id_event {
143 struct perf_event_header header;
145 u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))];
149 enum perf_user_event_type { /* above any possible kernel type */
150 PERF_RECORD_USER_TYPE_START = 64,
151 PERF_RECORD_HEADER_ATTR = 64,
152 PERF_RECORD_HEADER_EVENT_TYPE = 65, /* depreceated */
153 PERF_RECORD_HEADER_TRACING_DATA = 66,
154 PERF_RECORD_HEADER_BUILD_ID = 67,
155 PERF_RECORD_FINISHED_ROUND = 68,
156 PERF_RECORD_HEADER_MAX
160 struct perf_event_header header;
161 struct perf_event_attr attr;
165 #define MAX_EVENT_NAME 64
167 struct perf_trace_event_type {
169 char name[MAX_EVENT_NAME];
172 struct event_type_event {
173 struct perf_event_header header;
174 struct perf_trace_event_type event_type;
177 struct tracing_data_event {
178 struct perf_event_header header;
183 struct perf_event_header header;
184 struct mmap_event mmap;
185 struct mmap2_event mmap2;
186 struct comm_event comm;
187 struct fork_event fork;
188 struct lost_event lost;
189 struct read_event read;
190 struct throttle_event throttle;
191 struct sample_event sample;
192 struct attr_event attr;
193 struct event_type_event event_type;
194 struct tracing_data_event tracing_data;
195 struct build_id_event build_id;
198 void perf_event__print_totals(void);
203 typedef int (*perf_event__handler_t)(struct perf_tool *tool,
204 union perf_event *event,
205 struct perf_sample *sample,
206 struct machine *machine);
208 int perf_event__synthesize_thread_map(struct perf_tool *tool,
209 struct thread_map *threads,
210 perf_event__handler_t process,
211 struct machine *machine, bool mmap_data);
212 int perf_event__synthesize_threads(struct perf_tool *tool,
213 perf_event__handler_t process,
214 struct machine *machine, bool mmap_data);
215 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
216 perf_event__handler_t process,
217 struct machine *machine);
219 int perf_event__synthesize_modules(struct perf_tool *tool,
220 perf_event__handler_t process,
221 struct machine *machine);
223 int perf_event__process_comm(struct perf_tool *tool,
224 union perf_event *event,
225 struct perf_sample *sample,
226 struct machine *machine);
227 int perf_event__process_lost(struct perf_tool *tool,
228 union perf_event *event,
229 struct perf_sample *sample,
230 struct machine *machine);
231 int perf_event__process_mmap(struct perf_tool *tool,
232 union perf_event *event,
233 struct perf_sample *sample,
234 struct machine *machine);
235 int perf_event__process_mmap2(struct perf_tool *tool,
236 union perf_event *event,
237 struct perf_sample *sample,
238 struct machine *machine);
239 int perf_event__process_fork(struct perf_tool *tool,
240 union perf_event *event,
241 struct perf_sample *sample,
242 struct machine *machine);
243 int perf_event__process_exit(struct perf_tool *tool,
244 union perf_event *event,
245 struct perf_sample *sample,
246 struct machine *machine);
247 int perf_event__process(struct perf_tool *tool,
248 union perf_event *event,
249 struct perf_sample *sample,
250 struct machine *machine);
252 struct addr_location;
254 int perf_event__preprocess_sample(const union perf_event *event,
255 struct machine *machine,
256 struct addr_location *al,
257 struct perf_sample *sample);
259 const char *perf_event__name(unsigned int id);
261 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
262 u64 sample_regs_user, u64 read_format);
263 int perf_event__synthesize_sample(union perf_event *event, u64 type,
264 u64 sample_regs_user, u64 read_format,
265 const struct perf_sample *sample,
268 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
269 union perf_event *event,
270 pid_t pid, pid_t tgid,
271 perf_event__handler_t process,
272 struct machine *machine,
275 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
276 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
277 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
278 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
279 size_t perf_event__fprintf(union perf_event *event, FILE *fp);
281 u64 kallsyms__get_function_start(const char *kallsyms_filename,
282 const char *symbol_name);
284 #endif /* __PERF_RECORD_H */