Path: blob/master/tools/lib/perf/include/internal/mmap.h
26302 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __LIBPERF_INTERNAL_MMAP_H2#define __LIBPERF_INTERNAL_MMAP_H34#include <linux/compiler.h>5#include <linux/refcount.h>6#include <linux/types.h>7#include <stdbool.h>8#include <internal/cpumap.h>910/* perf sample has 16 bits size limit */11#define PERF_SAMPLE_MAX_SIZE (1 << 16)1213struct perf_mmap;14struct perf_counts_values;1516typedef void (*libperf_unmap_cb_t)(struct perf_mmap *map);1718/**19* struct perf_mmap - perf's ring buffer mmap details20*21* @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this22*/23struct perf_mmap {24void *base;25int mask;26int fd;27struct perf_cpu cpu;28refcount_t refcnt;29u64 prev;30u64 start;31u64 end;32bool overwrite;33u64 flush;34libperf_unmap_cb_t unmap_cb;35void *event_copy;36size_t event_copy_sz;37struct perf_mmap *next;38};3940struct perf_mmap_param {41int prot;42int mask;43};4445size_t perf_mmap__mmap_len(struct perf_mmap *map);4647void perf_mmap__init(struct perf_mmap *map, struct perf_mmap *prev,48bool overwrite, libperf_unmap_cb_t unmap_cb);49int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp,50int fd, struct perf_cpu cpu);51void perf_mmap__munmap(struct perf_mmap *map);52void perf_mmap__get(struct perf_mmap *map);53void perf_mmap__put(struct perf_mmap *map);5455u64 perf_mmap__read_head(struct perf_mmap *map);5657int perf_mmap__read_self(struct perf_mmap *map, struct perf_counts_values *count);5859#endif /* __LIBPERF_INTERNAL_MMAP_H */606162