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 <linux/bitops.h> 10 #include <perf/cpumap.h> 11 #include <stdbool.h> 12 #include <pthread.h> // for cpu_set_t 13 #ifdef HAVE_AIO_SUPPORT 14 #include <aio.h> 15 #endif 16 #include "auxtrace.h" 17 #include "event.h" 18 19 struct aiocb; 20 21 struct mmap_cpu_mask { 22 unsigned long *bits; 23 size_t nbits; 24 }; 25 26 #define MMAP_CPU_MASK_BYTES(m) \ 27 (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long)) 28 29 /** 30 * struct mmap - perf's ring buffer mmap details 31 * 32 * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this 33 */ 34 struct mmap { 35 struct perf_mmap core; 36 struct auxtrace_mmap auxtrace_mmap; 37 #ifdef HAVE_AIO_SUPPORT 38 struct { 39 void **data; 40 struct aiocb *cblocks; 41 struct aiocb **aiocb; 42 int nr_cblocks; 43 } aio; 44 #endif 45 struct mmap_cpu_mask affinity_mask; 46 void *data; 47 int comp_level; 48 }; 49 50 struct mmap_params { 51 struct perf_mmap_param core; 52 int nr_cblocks, affinity, flush, comp_level; 53 struct auxtrace_mmap_params auxtrace_mp; 54 }; 55 56 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu); 57 void mmap__munmap(struct mmap *map); 58 59 union perf_event *perf_mmap__read_forward(struct mmap *map); 60 61 int perf_mmap__push(struct mmap *md, void *to, 62 int push(struct mmap *map, void *to, void *buf, size_t size)); 63 64 size_t mmap__mmap_len(struct mmap *map); 65 66 void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag); 67 68 int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original, 69 struct mmap_cpu_mask *clone); 70 71 #endif /*__PERF_MMAP_H */ 72