Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | #ifndef __LIBPERF_INTERNAL_MMAP_H | ||||
3 | #define __LIBPERF_INTERNAL_MMAP_H | ||||
4 | |||||
Jiri Olsa | 4443e6d | 2019-07-27 22:47:58 +0200 | [diff] [blame] | 5 | #include <linux/compiler.h> |
Jiri Olsa | e03edfe | 2019-07-27 22:35:35 +0200 | [diff] [blame] | 6 | #include <linux/refcount.h> |
Jiri Olsa | ebe4d72 | 2019-07-27 22:39:53 +0200 | [diff] [blame] | 7 | #include <linux/types.h> |
Jiri Olsa | 8df7a86 | 2019-07-27 22:42:56 +0200 | [diff] [blame] | 8 | #include <stdbool.h> |
Jiri Olsa | e03edfe | 2019-07-27 22:35:35 +0200 | [diff] [blame] | 9 | |
Jiri Olsa | 4443e6d | 2019-07-27 22:47:58 +0200 | [diff] [blame] | 10 | /* perf sample has 16 bits size limit */ |
11 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) | ||||
12 | |||||
Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 13 | /** |
14 | * struct perf_mmap - perf's ring buffer mmap details | ||||
15 | * | ||||
16 | * @refcnt - e.g. code using PERF_EVENT_IOC_SET_OUTPUT to share this | ||||
17 | */ | ||||
18 | struct perf_mmap { | ||||
19 | void *base; | ||||
Jiri Olsa | 4fd0cef | 2019-07-27 22:27:55 +0200 | [diff] [blame] | 20 | int mask; |
Jiri Olsa | 2cf07b2 | 2019-07-27 22:31:17 +0200 | [diff] [blame] | 21 | int fd; |
Jiri Olsa | 56a9470 | 2019-07-27 22:33:20 +0200 | [diff] [blame] | 22 | int cpu; |
Jiri Olsa | e03edfe | 2019-07-27 22:35:35 +0200 | [diff] [blame] | 23 | refcount_t refcnt; |
Jiri Olsa | ebe4d72 | 2019-07-27 22:39:53 +0200 | [diff] [blame] | 24 | u64 prev; |
25 | u64 start; | ||||
26 | u64 end; | ||||
Jiri Olsa | 8df7a86 | 2019-07-27 22:42:56 +0200 | [diff] [blame] | 27 | bool overwrite; |
Jiri Olsa | 65aa2e6 | 2019-08-27 16:05:18 +0200 | [diff] [blame] | 28 | u64 flush; |
Jiri Olsa | 4443e6d | 2019-07-27 22:47:58 +0200 | [diff] [blame] | 29 | char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8); |
Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 30 | }; |
31 | |||||
Jiri Olsa | 353120b | 2019-10-07 14:53:09 +0200 | [diff] [blame^] | 32 | void perf_mmap__init(struct perf_mmap *map, bool overwrite); |
33 | |||||
Jiri Olsa | 547740f | 2019-07-27 22:07:44 +0200 | [diff] [blame] | 34 | #endif /* __LIBPERF_INTERNAL_MMAP_H */ |