Commit | Line | Data |
---|---|---|
16958497 ACM |
1 | #ifndef __PERF_MMAP_H |
2 | #define __PERF_MMAP_H 1 | |
3 | ||
547740f7 | 4 | #include <internal/mmap.h> |
16958497 | 5 | #include <linux/types.h> |
5d4da30f | 6 | #include <linux/bitops.h> |
6d18804b | 7 | #include <perf/cpumap.h> |
0b773831 AB |
8 | #ifdef HAVE_AIO_SUPPORT |
9 | #include <aio.h> | |
10 | #endif | |
16958497 | 11 | #include "auxtrace.h" |
75f5f1fc | 12 | #include "util/compress.h" |
16958497 | 13 | |
d3d1af6f | 14 | struct aiocb; |
9c080c02 AB |
15 | |
16 | struct mmap_cpu_mask { | |
17 | unsigned long *bits; | |
18 | size_t nbits; | |
19 | }; | |
20 | ||
21 | #define MMAP_CPU_MASK_BYTES(m) \ | |
22 | (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long)) | |
23 | ||
16958497 | 24 | /** |
a5830532 | 25 | * struct mmap - perf's ring buffer mmap details |
16958497 ACM |
26 | * |
27 | * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this | |
28 | */ | |
a5830532 | 29 | struct mmap { |
547740f7 | 30 | struct perf_mmap core; |
16958497 | 31 | struct auxtrace_mmap auxtrace_mmap; |
0b773831 AB |
32 | #ifdef HAVE_AIO_SUPPORT |
33 | struct { | |
93f20c0f AB |
34 | void **data; |
35 | struct aiocb *cblocks; | |
36 | struct aiocb **aiocb; | |
d3d1af6f | 37 | int nr_cblocks; |
0b773831 AB |
38 | } aio; |
39 | #endif | |
8384a260 | 40 | struct mmap_cpu_mask affinity_mask; |
51255a8a | 41 | void *data; |
56f735ff | 42 | struct perf_data_file *file; |
75f5f1fc | 43 | struct zstd_data zstd_data; |
16958497 ACM |
44 | }; |
45 | ||
16958497 | 46 | struct mmap_params { |
e440979f JO |
47 | struct perf_mmap_param core; |
48 | int nr_cblocks, affinity, flush, comp_level; | |
16958497 ACM |
49 | struct auxtrace_mmap_params auxtrace_mp; |
50 | }; | |
51 | ||
6d18804b | 52 | int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu); |
59d7ea62 | 53 | void mmap__munmap(struct mmap *map); |
16958497 | 54 | |
a5830532 | 55 | union perf_event *perf_mmap__read_forward(struct mmap *map); |
16958497 | 56 | |
a5830532 JO |
57 | int perf_mmap__push(struct mmap *md, void *to, |
58 | int push(struct mmap *map, void *to, void *buf, size_t size)); | |
73c17d81 | 59 | |
bf59b305 | 60 | size_t mmap__mmap_len(struct mmap *map); |
16958497 | 61 | |
9c080c02 AB |
62 | void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag); |
63 | ||
6bd006c6 RM |
64 | int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original, |
65 | struct mmap_cpu_mask *clone); | |
66 | ||
16958497 | 67 | #endif /*__PERF_MMAP_H */ |