summaryrefslogtreecommitdiff
path: root/src/perf_event_struct.h
blob: d9020f6e928b4a671e0917ec89472e9f473594b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Copyright (c) 2016-2018 Eugene Syromyatnikov <evgsyr@gmail.com>
 * Copyright (c) 2016-2021 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#ifndef STRACE_LINUX_PERF_EVENT_STRUCT_H
# define STRACE_LINUX_PERF_EVENT_STRUCT_H

# include <stdint.h>

# define PERF_PMU_TYPE_SHIFT            32
# define PERF_HW_EVENT_MASK             0xffffffff

struct perf_event_attr {
	uint32_t type;
	uint32_t size;
	uint64_t config;
	union {
		uint64_t sample_period;
		uint64_t sample_freq;
	};
	uint64_t sample_type;
	uint64_t read_format;
	uint64_t disabled			:1,
		 inherit			:1,
		 pinned				:1,
		 exclusive			:1,
		 exclude_user			:1,
		 exclude_kernel			:1,
		 exclude_hv			:1,
		 exclude_idle			:1,
		 mmap				:1,
		 comm				:1,
		 freq				:1,
		 inherit_stat			:1,
		 enable_on_exec			:1,
		 task				:1,
		 watermark			:1,
		 precise_ip			:2,
		 mmap_data			:1,
		 sample_id_all			:1,
		 exclude_host			:1,
		 exclude_guest			:1,
		 exclude_callchain_kernel	:1,
		 exclude_callchain_user		:1,
		 mmap2				:1,
		 comm_exec			:1,
		 use_clockid			:1,
		 context_switch			:1,
		 write_backward			:1,
		 namespaces			:1,
		 ksymbol			:1,
		 bpf_event			:1,
		 aux_output			:1,
		 cgroup				:1,
		 text_poke			:1,
		 build_id			:1,
		 inherit_thread			:1,
		 remove_on_exec			:1,
		 sigtrap			:1,
		 __reserved_1			:26;
	union {
		uint32_t wakeup_events;
		uint32_t wakeup_watermark;
	};
	uint32_t bp_type;
	union {
		uint64_t bp_addr;
		uint64_t config1;
	};
	/* End of ver 0 - 64 bytes */
	union {
		uint64_t bp_len;
		uint64_t config2;
	};
	/* End of ver 1 - 72 bytes */
	uint64_t branch_sample_type;
	/* End of ver 2 - 80 bytes */
	uint64_t sample_regs_user;
	uint32_t sample_stack_user;
	int32_t  clockid;
	/* End of ver 3 - 96 bytes */
	uint64_t sample_regs_intr;
	/* End of ver 4 - 104 bytes */
	uint32_t aux_watermark;
	uint16_t sample_max_stack;
	uint16_t __reserved_2;
	/* End of ver 5 - 112 bytes */
	uint32_t aux_sample_size;
	uint32_t __reserved_3;
	/* End of ver 6 - 120 bytes */
	uint64_t sig_data;
	/* End of ver 7 - 128 bytes */
};

struct perf_event_query_bpf {
        uint32_t ids_len;
        uint32_t prog_cnt;
        uint32_t ids[0];
};

#endif /* !STRACE_LINUX_PERF_EVENT_STRUCT_H */