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