xref: /openbmc/linux/tools/perf/util/mmap.h (revision 1a18374f)
1 #ifndef __PERF_MMAP_H
2 #define __PERF_MMAP_H 1
3 
4 #include <internal/mmap.h>
5 #include <linux/compiler.h>
6 #include <linux/refcount.h>
7 #include <linux/types.h>
8 #include <linux/ring_buffer.h>
9 #include <stdbool.h>
10 #include <pthread.h> // for cpu_set_t
11 #ifdef HAVE_AIO_SUPPORT
12 #include <aio.h>
13 #endif
14 #include "auxtrace.h"
15 #include "event.h"
16 
17 struct aiocb;
18 /**
19  * struct mmap - perf's ring buffer mmap details
20  *
21  * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
22  */
23 struct mmap {
24 	struct perf_mmap	core;
25 	struct auxtrace_mmap auxtrace_mmap;
26 #ifdef HAVE_AIO_SUPPORT
27 	struct {
28 		void		 **data;
29 		struct aiocb	 *cblocks;
30 		struct aiocb	 **aiocb;
31 		int		 nr_cblocks;
32 	} aio;
33 #endif
34 	cpu_set_t	affinity_mask;
35 	void		*data;
36 	int		comp_level;
37 };
38 
39 struct mmap_params {
40 	struct perf_mmap_param core;
41 	int nr_cblocks, affinity, flush, comp_level;
42 	struct auxtrace_mmap_params auxtrace_mp;
43 };
44 
45 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu);
46 void mmap__munmap(struct mmap *map);
47 
48 union perf_event *perf_mmap__read_forward(struct mmap *map);
49 
50 int perf_mmap__push(struct mmap *md, void *to,
51 		    int push(struct mmap *map, void *to, void *buf, size_t size));
52 
53 size_t mmap__mmap_len(struct mmap *map);
54 
55 #endif /*__PERF_MMAP_H */
56