Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 1 | #ifndef __PERF_MMAP_H |
| 2 | #define __PERF_MMAP_H 1 |
| 3 | |
Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 4 | #include <internal/mmap.h> |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 5 | #include <linux/compiler.h> |
| 6 | #include <linux/refcount.h> |
| 7 | #include <linux/types.h> |
Daniel Borkmann | 09d62154 | 2018-10-19 15:51:02 +0200 | [diff] [blame] | 8 | #include <linux/ring_buffer.h> |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 9 | #include <stdbool.h> |
Arnaldo Carvalho de Melo | f2a39fe | 2019-08-30 14:45:20 -0300 | [diff] [blame] | 10 | #include <pthread.h> // for cpu_set_t |
Alexey Budankov | 0b77383 | 2018-11-06 12:03:35 +0300 | [diff] [blame] | 11 | #ifdef HAVE_AIO_SUPPORT |
| 12 | #include <aio.h> |
| 13 | #endif |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 14 | #include "auxtrace.h" |
| 15 | #include "event.h" |
| 16 | |
Alexey Budankov | d3d1af6 | 2018-11-06 12:04:58 +0300 | [diff] [blame] | 17 | struct aiocb; |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 18 | /** |
Jiri Olsa | a583053 | 2019-07-27 20:30:53 +0200 | [diff] [blame] | 19 | * struct mmap - perf's ring buffer mmap details |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 20 | * |
| 21 | * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this |
| 22 | */ |
Jiri Olsa | a583053 | 2019-07-27 20:30:53 +0200 | [diff] [blame] | 23 | struct mmap { |
Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 24 | struct perf_mmap core; |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 25 | struct auxtrace_mmap auxtrace_mmap; |
Alexey Budankov | 0b77383 | 2018-11-06 12:03:35 +0300 | [diff] [blame] | 26 | #ifdef HAVE_AIO_SUPPORT |
| 27 | struct { |
Alexey Budankov | 93f20c0 | 2018-11-06 12:07:19 +0300 | [diff] [blame] | 28 | void **data; |
| 29 | struct aiocb *cblocks; |
| 30 | struct aiocb **aiocb; |
Alexey Budankov | d3d1af6 | 2018-11-06 12:04:58 +0300 | [diff] [blame] | 31 | int nr_cblocks; |
Alexey Budankov | 0b77383 | 2018-11-06 12:03:35 +0300 | [diff] [blame] | 32 | } aio; |
| 33 | #endif |
Alexey Budankov | 9d2ed64 | 2019-01-22 20:47:43 +0300 | [diff] [blame] | 34 | cpu_set_t affinity_mask; |
Alexey Budankov | 51255a8 | 2019-03-18 20:42:19 +0300 | [diff] [blame] | 35 | void *data; |
| 36 | int comp_level; |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 37 | }; |
| 38 | |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 39 | struct mmap_params { |
Jiri Olsa | e440979 | 2019-10-07 14:53:10 +0200 | [diff] [blame] | 40 | struct perf_mmap_param core; |
| 41 | int nr_cblocks, affinity, flush, comp_level; |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 42 | struct auxtrace_mmap_params auxtrace_mp; |
| 43 | }; |
| 44 | |
Jiri Olsa | 32c261c | 2019-10-07 14:53:12 +0200 | [diff] [blame] | 45 | int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu); |
Jiri Olsa | 59d7ea62 | 2019-10-07 14:53:14 +0200 | [diff] [blame] | 46 | void mmap__munmap(struct mmap *map); |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 47 | |
Jiri Olsa | a583053 | 2019-07-27 20:30:53 +0200 | [diff] [blame] | 48 | union perf_event *perf_mmap__read_forward(struct mmap *map); |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 49 | |
Jiri Olsa | a583053 | 2019-07-27 20:30:53 +0200 | [diff] [blame] | 50 | union perf_event *perf_mmap__read_event(struct mmap *map); |
Kan Liang | 7bb4597 | 2018-01-18 13:26:23 -0800 | [diff] [blame] | 51 | |
Jiri Olsa | a583053 | 2019-07-27 20:30:53 +0200 | [diff] [blame] | 52 | int perf_mmap__push(struct mmap *md, void *to, |
| 53 | int push(struct mmap *map, void *to, void *buf, size_t size)); |
Arnaldo Carvalho de Melo | 73c17d8 | 2017-10-06 10:46:01 -0300 | [diff] [blame] | 54 | |
Jiri Olsa | bf59b30 | 2019-10-07 14:53:11 +0200 | [diff] [blame] | 55 | size_t mmap__mmap_len(struct mmap *map); |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 56 | |
Arnaldo Carvalho de Melo | 1695849 | 2017-10-06 10:31:47 -0300 | [diff] [blame] | 57 | #endif /*__PERF_MMAP_H */ |