1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LIBPERF_INTERNAL_MMAP_H
3 #define __LIBPERF_INTERNAL_MMAP_H
4
5 #include <linux/compiler.h>
6 #include <linux/refcount.h>
7 #include <linux/types.h>
8 #include <stdbool.h>
9
10 /* perf sample has 16 bits size limit */
11 #define PERF_SAMPLE_MAX_SIZE (1 << 16)
12
13 /**
14 * struct perf_mmap - perf's ring buffer mmap details
15 *
16 * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
17 */
18 struct perf_mmap {
19 void *base;
20 int mask;
21 int fd;
22 int cpu;
23 refcount_t refcnt;
24 u64 prev;
25 u64 start;
26 u64 end;
27 bool overwrite;
28 u64 flush;
29 char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
30 };
31
32 #endif /* __LIBPERF_INTERNAL_MMAP_H */