2017-10-06 06:31:47 -07:00
|
|
|
#ifndef __PERF_MMAP_H
|
|
|
|
#define __PERF_MMAP_H 1
|
|
|
|
|
2019-07-27 13:07:44 -07:00
|
|
|
#include <internal/mmap.h>
|
2017-10-06 06:31:47 -07:00
|
|
|
#include <linux/types.h>
|
2021-08-21 02:19:11 -07:00
|
|
|
#include <linux/bitops.h>
|
2022-01-04 23:13:51 -07:00
|
|
|
#include <perf/cpumap.h>
|
2018-11-06 02:03:35 -07:00
|
|
|
#ifdef HAVE_AIO_SUPPORT
|
|
|
|
#include <aio.h>
|
|
|
|
#endif
|
2017-10-06 06:31:47 -07:00
|
|
|
#include "auxtrace.h"
|
2022-01-17 11:34:30 -07:00
|
|
|
#include "util/compress.h"
|
2017-10-06 06:31:47 -07:00
|
|
|
|
2018-11-06 02:04:58 -07:00
|
|
|
struct aiocb;
|
2019-12-03 04:44:18 -07:00
|
|
|
|
|
|
|
struct mmap_cpu_mask {
|
|
|
|
unsigned long *bits;
|
|
|
|
size_t nbits;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MMAP_CPU_MASK_BYTES(m) \
|
|
|
|
(BITS_TO_LONGS(((struct mmap_cpu_mask *)m)->nbits) * sizeof(unsigned long))
|
|
|
|
|
2017-10-06 06:31:47 -07:00
|
|
|
/**
|
2019-07-27 11:30:53 -07:00
|
|
|
* struct mmap - perf's ring buffer mmap details
|
2017-10-06 06:31:47 -07:00
|
|
|
*
|
|
|
|
* @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this
|
|
|
|
*/
|
2019-07-27 11:30:53 -07:00
|
|
|
struct mmap {
|
2019-07-27 13:07:44 -07:00
|
|
|
struct perf_mmap core;
|
2017-10-06 06:31:47 -07:00
|
|
|
struct auxtrace_mmap auxtrace_mmap;
|
2018-11-06 02:03:35 -07:00
|
|
|
#ifdef HAVE_AIO_SUPPORT
|
|
|
|
struct {
|
2018-11-06 02:07:19 -07:00
|
|
|
void **data;
|
|
|
|
struct aiocb *cblocks;
|
|
|
|
struct aiocb **aiocb;
|
2018-11-06 02:04:58 -07:00
|
|
|
int nr_cblocks;
|
2018-11-06 02:03:35 -07:00
|
|
|
} aio;
|
|
|
|
#endif
|
2019-12-03 04:45:27 -07:00
|
|
|
struct mmap_cpu_mask affinity_mask;
|
2019-03-18 10:42:19 -07:00
|
|
|
void *data;
|
2022-01-17 11:34:28 -07:00
|
|
|
struct perf_data_file *file;
|
2022-01-17 11:34:30 -07:00
|
|
|
struct zstd_data zstd_data;
|
2017-10-06 06:31:47 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mmap_params {
|
2019-10-07 05:53:10 -07:00
|
|
|
struct perf_mmap_param core;
|
|
|
|
int nr_cblocks, affinity, flush, comp_level;
|
2017-10-06 06:31:47 -07:00
|
|
|
struct auxtrace_mmap_params auxtrace_mp;
|
|
|
|
};
|
|
|
|
|
2022-01-04 23:13:51 -07:00
|
|
|
int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu cpu);
|
2019-10-07 05:53:14 -07:00
|
|
|
void mmap__munmap(struct mmap *map);
|
2017-10-06 06:31:47 -07:00
|
|
|
|
2019-07-27 11:30:53 -07:00
|
|
|
union perf_event *perf_mmap__read_forward(struct mmap *map);
|
2017-10-06 06:31:47 -07:00
|
|
|
|
2019-07-27 11:30:53 -07:00
|
|
|
int perf_mmap__push(struct mmap *md, void *to,
|
|
|
|
int push(struct mmap *map, void *to, void *buf, size_t size));
|
2017-10-06 06:46:01 -07:00
|
|
|
|
2019-10-07 05:53:11 -07:00
|
|
|
size_t mmap__mmap_len(struct mmap *map);
|
2017-10-06 06:31:47 -07:00
|
|
|
|
2019-12-03 04:44:18 -07:00
|
|
|
void mmap_cpu_mask__scnprintf(struct mmap_cpu_mask *mask, const char *tag);
|
|
|
|
|
2021-08-21 02:19:10 -07:00
|
|
|
int mmap_cpu_mask__duplicate(struct mmap_cpu_mask *original,
|
|
|
|
struct mmap_cpu_mask *clone);
|
|
|
|
|
2017-10-06 06:31:47 -07:00
|
|
|
#endif /*__PERF_MMAP_H */
|