Back to home page

OSCL-LXR

 
 

    


0001 #ifndef __PERF_MMAP_H
0002 #define __PERF_MMAP_H 1
0003 
0004 #include <internal/mmap.h>
0005 #include <linux/compiler.h>
0006 #include <linux/refcount.h>
0007 #include <linux/types.h>
0008 #include <linux/ring_buffer.h>
0009 #include <linux/bitops.h>
0010 #include <perf/cpumap.h>
0011 #include <stdbool.h>
0012 #include <pthread.h> // for cpu_set_t
0013 #ifdef HAVE_AIO_SUPPORT
0014 #include <aio.h>
0015 #endif
0016 #include "auxtrace.h"
0017 #include "event.h"
0018 #include "util/compress.h"
0019 
0020 struct aiocb;
0021 
0022 struct mmap_cpu_mask {
0023     unsigned long *bits;
0024     size_t nbits;
0025 };
0026 
0027 #define MMAP_CPU_MASK_BYTES(m) \
0028     (BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long))
0029 
0030 /**
0031  * struct mmap - perf's ring buffer mmap details
0032  *
0033  * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
0034  */
0035 struct mmap {
0036     struct perf_mmap    core;
0037     struct auxtrace_mmap auxtrace_mmap;
0038 #ifdef HAVE_AIO_SUPPORT
0039     struct {
0040         void         **data;
0041         struct aiocb     *cblocks;
0042         struct aiocb     **aiocb;
0043         int      nr_cblocks;
0044     } aio;
0045 #endif
0046     struct mmap_cpu_mask    affinity_mask;
0047     void        *data;
0048     int     comp_level;
0049     struct perf_data_file *file;
0050     struct zstd_data      zstd_data;
0051 };
0052 
0053 struct mmap_params {
0054     struct perf_mmap_param core;
0055     int nr_cblocks, affinity, flush, comp_level;
0056     struct auxtrace_mmap_params auxtrace_mp;
0057 };
0058 
0059 int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu);
0060 void mmap__munmap(struct mmap *map);
0061 
0062 union perf_event *perf_mmap__read_forward(struct mmap *map);
0063 
0064 int perf_mmap__push(struct mmap *md, void *to,
0065             int push(struct mmap *map, void *to, void *buf, size_t size));
0066 
0067 size_t mmap__mmap_len(struct mmap *map);
0068 
0069 void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag);
0070 
0071 int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original,
0072                 struct mmap_cpu_mask *clone);
0073 
0074 #endif /*__PERF_MMAP_H */