Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / util / mmap.h
blob9d5f589f02ae70e187539ad08202157c08801771
1 #ifndef __PERF_MMAP_H
2 #define __PERF_MMAP_H 1
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 <stdbool.h>
10 #include <pthread.h> // for cpu_set_t
11 #ifdef HAVE_AIO_SUPPORT
12 #include <aio.h>
13 #endif
14 #include "auxtrace.h"
15 #include "event.h"
17 struct aiocb;
19 struct mmap_cpu_mask {
20 unsigned long *bits;
21 size_t nbits;
24 #define MMAP_CPU_MASK_BYTES(m) \
25 (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long))
27 /**
28 * struct mmap - perf's ring buffer mmap details
30 * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
32 struct mmap {
33 struct perf_mmap core;
34 struct auxtrace_mmap auxtrace_mmap;
35 #ifdef HAVE_AIO_SUPPORT
36 struct {
37 void **data;
38 struct aiocb *cblocks;
39 struct aiocb **aiocb;
40 int nr_cblocks;
41 } aio;
42 #endif
43 struct mmap_cpu_mask affinity_mask;
44 void *data;
45 int comp_level;
48 struct mmap_params {
49 struct perf_mmap_param core;
50 int nr_cblocks, affinity, flush, comp_level;
51 struct auxtrace_mmap_params auxtrace_mp;
54 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu);
55 void mmap__munmap(struct mmap *map);
57 union perf_event *perf_mmap__read_forward(struct mmap *map);
59 int perf_mmap__push(struct mmap *md, void *to,
60 int push(struct mmap *map, void *to, void *buf, size_t size));
62 size_t mmap__mmap_len(struct mmap *map);
64 void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag);
66 #endif /*__PERF_MMAP_H */