xref: /openbmc/linux/tools/perf/util/session.h (revision 4aa65636)
1 #ifndef __PERF_SESSION_H
2 #define __PERF_SESSION_H
3 
4 #include "event.h"
5 #include "header.h"
6 #include "thread.h"
7 #include <linux/rbtree.h>
8 
9 struct thread;
10 struct symbol_conf;
11 
12 struct perf_session {
13 	struct perf_header	header;
14 	unsigned long		size;
15 	unsigned long		mmap_window;
16 	struct map_groups	kmaps;
17 	struct rb_root		threads;
18 	struct thread		*last_match;
19 	int			fd;
20 	int			cwdlen;
21 	char			*cwd;
22 	bool			use_modules;
23 	char filename[0];
24 };
25 
26 typedef int (*event_op)(event_t *self, struct perf_session *session);
27 
28 struct perf_event_ops {
29 	event_op	process_sample_event;
30 	event_op	process_mmap_event;
31 	event_op	process_comm_event;
32 	event_op	process_fork_event;
33 	event_op	process_exit_event;
34 	event_op	process_lost_event;
35 	event_op	process_read_event;
36 	event_op	process_throttle_event;
37 	event_op	process_unthrottle_event;
38 	int		(*sample_type_check)(u64 sample_type);
39 	unsigned long	total_unknown;
40 	bool		full_paths;
41 };
42 
43 struct perf_session *perf_session__new(const char *filename, int mode,
44 				       bool force, struct symbol_conf *conf);
45 void perf_session__delete(struct perf_session *self);
46 
47 int perf_session__process_events(struct perf_session *self,
48 				 struct perf_event_ops *event_ops);
49 
50 int perf_header__read_build_ids(int input, u64 offset, u64 file_size);
51 
52 #endif /* __PERF_SESSION_H */
53