xref: /aosp_15_r20/external/libbpf/include/uapi/linux/perf_event.h (revision f7c14bbac8cf49633f2740db462ea43457973ec4)
1*f7c14bbaSAndroid Build Coastguard Worker /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*f7c14bbaSAndroid Build Coastguard Worker /*
3*f7c14bbaSAndroid Build Coastguard Worker  * Performance events:
4*f7c14bbaSAndroid Build Coastguard Worker  *
5*f7c14bbaSAndroid Build Coastguard Worker  *    Copyright (C) 2008-2009, Thomas Gleixner <[email protected]>
6*f7c14bbaSAndroid Build Coastguard Worker  *    Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
7*f7c14bbaSAndroid Build Coastguard Worker  *    Copyright (C) 2008-2011, Red Hat, Inc., Peter Zijlstra
8*f7c14bbaSAndroid Build Coastguard Worker  *
9*f7c14bbaSAndroid Build Coastguard Worker  * Data type definitions, declarations, prototypes.
10*f7c14bbaSAndroid Build Coastguard Worker  *
11*f7c14bbaSAndroid Build Coastguard Worker  *    Started by: Thomas Gleixner and Ingo Molnar
12*f7c14bbaSAndroid Build Coastguard Worker  *
13*f7c14bbaSAndroid Build Coastguard Worker  * For licencing details see kernel-base/COPYING
14*f7c14bbaSAndroid Build Coastguard Worker  */
15*f7c14bbaSAndroid Build Coastguard Worker #ifndef _UAPI_LINUX_PERF_EVENT_H
16*f7c14bbaSAndroid Build Coastguard Worker #define _UAPI_LINUX_PERF_EVENT_H
17*f7c14bbaSAndroid Build Coastguard Worker 
18*f7c14bbaSAndroid Build Coastguard Worker #include <linux/types.h>
19*f7c14bbaSAndroid Build Coastguard Worker #include <linux/ioctl.h>
20*f7c14bbaSAndroid Build Coastguard Worker #include <asm/byteorder.h>
21*f7c14bbaSAndroid Build Coastguard Worker 
22*f7c14bbaSAndroid Build Coastguard Worker /*
23*f7c14bbaSAndroid Build Coastguard Worker  * User-space ABI bits:
24*f7c14bbaSAndroid Build Coastguard Worker  */
25*f7c14bbaSAndroid Build Coastguard Worker 
26*f7c14bbaSAndroid Build Coastguard Worker /*
27*f7c14bbaSAndroid Build Coastguard Worker  * attr.type
28*f7c14bbaSAndroid Build Coastguard Worker  */
29*f7c14bbaSAndroid Build Coastguard Worker enum perf_type_id {
30*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_HARDWARE			= 0,
31*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_SOFTWARE			= 1,
32*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_TRACEPOINT			= 2,
33*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_HW_CACHE			= 3,
34*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_RAW				= 4,
35*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_BREAKPOINT			= 5,
36*f7c14bbaSAndroid Build Coastguard Worker 
37*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TYPE_MAX,				/* non-ABI */
38*f7c14bbaSAndroid Build Coastguard Worker };
39*f7c14bbaSAndroid Build Coastguard Worker 
40*f7c14bbaSAndroid Build Coastguard Worker /*
41*f7c14bbaSAndroid Build Coastguard Worker  * attr.config layout for type PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE
42*f7c14bbaSAndroid Build Coastguard Worker  * PERF_TYPE_HARDWARE:			0xEEEEEEEE000000AA
43*f7c14bbaSAndroid Build Coastguard Worker  *					AA: hardware event ID
44*f7c14bbaSAndroid Build Coastguard Worker  *					EEEEEEEE: PMU type ID
45*f7c14bbaSAndroid Build Coastguard Worker  * PERF_TYPE_HW_CACHE:			0xEEEEEEEE00DDCCBB
46*f7c14bbaSAndroid Build Coastguard Worker  *					BB: hardware cache ID
47*f7c14bbaSAndroid Build Coastguard Worker  *					CC: hardware cache op ID
48*f7c14bbaSAndroid Build Coastguard Worker  *					DD: hardware cache op result ID
49*f7c14bbaSAndroid Build Coastguard Worker  *					EEEEEEEE: PMU type ID
50*f7c14bbaSAndroid Build Coastguard Worker  * If the PMU type ID is 0, the PERF_TYPE_RAW will be applied.
51*f7c14bbaSAndroid Build Coastguard Worker  */
52*f7c14bbaSAndroid Build Coastguard Worker #define PERF_PMU_TYPE_SHIFT		32
53*f7c14bbaSAndroid Build Coastguard Worker #define PERF_HW_EVENT_MASK		0xffffffff
54*f7c14bbaSAndroid Build Coastguard Worker 
55*f7c14bbaSAndroid Build Coastguard Worker /*
56*f7c14bbaSAndroid Build Coastguard Worker  * Generalized performance event event_id types, used by the
57*f7c14bbaSAndroid Build Coastguard Worker  * attr.event_id parameter of the sys_perf_event_open()
58*f7c14bbaSAndroid Build Coastguard Worker  * syscall:
59*f7c14bbaSAndroid Build Coastguard Worker  */
60*f7c14bbaSAndroid Build Coastguard Worker enum perf_hw_id {
61*f7c14bbaSAndroid Build Coastguard Worker 	/*
62*f7c14bbaSAndroid Build Coastguard Worker 	 * Common hardware events, generalized by the kernel:
63*f7c14bbaSAndroid Build Coastguard Worker 	 */
64*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CPU_CYCLES		= 0,
65*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_INSTRUCTIONS		= 1,
66*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_REFERENCES		= 2,
67*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_MISSES		= 3,
68*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_BRANCH_INSTRUCTIONS	= 4,
69*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_BRANCH_MISSES		= 5,
70*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_BUS_CYCLES		= 6,
71*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_STALLED_CYCLES_FRONTEND	= 7,
72*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_STALLED_CYCLES_BACKEND	= 8,
73*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_REF_CPU_CYCLES		= 9,
74*f7c14bbaSAndroid Build Coastguard Worker 
75*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_MAX,			/* non-ABI */
76*f7c14bbaSAndroid Build Coastguard Worker };
77*f7c14bbaSAndroid Build Coastguard Worker 
78*f7c14bbaSAndroid Build Coastguard Worker /*
79*f7c14bbaSAndroid Build Coastguard Worker  * Generalized hardware cache events:
80*f7c14bbaSAndroid Build Coastguard Worker  *
81*f7c14bbaSAndroid Build Coastguard Worker  *       { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
82*f7c14bbaSAndroid Build Coastguard Worker  *       { read, write, prefetch } x
83*f7c14bbaSAndroid Build Coastguard Worker  *       { accesses, misses }
84*f7c14bbaSAndroid Build Coastguard Worker  */
85*f7c14bbaSAndroid Build Coastguard Worker enum perf_hw_cache_id {
86*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_L1D			= 0,
87*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_L1I			= 1,
88*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_LL			= 2,
89*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_DTLB		= 3,
90*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_ITLB		= 4,
91*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_BPU			= 5,
92*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_NODE		= 6,
93*f7c14bbaSAndroid Build Coastguard Worker 
94*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_MAX,		/* non-ABI */
95*f7c14bbaSAndroid Build Coastguard Worker };
96*f7c14bbaSAndroid Build Coastguard Worker 
97*f7c14bbaSAndroid Build Coastguard Worker enum perf_hw_cache_op_id {
98*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_OP_READ		= 0,
99*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_OP_WRITE		= 1,
100*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_OP_PREFETCH		= 2,
101*f7c14bbaSAndroid Build Coastguard Worker 
102*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_OP_MAX,		/* non-ABI */
103*f7c14bbaSAndroid Build Coastguard Worker };
104*f7c14bbaSAndroid Build Coastguard Worker 
105*f7c14bbaSAndroid Build Coastguard Worker enum perf_hw_cache_op_result_id {
106*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_RESULT_ACCESS	= 0,
107*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_RESULT_MISS		= 1,
108*f7c14bbaSAndroid Build Coastguard Worker 
109*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_HW_CACHE_RESULT_MAX,		/* non-ABI */
110*f7c14bbaSAndroid Build Coastguard Worker };
111*f7c14bbaSAndroid Build Coastguard Worker 
112*f7c14bbaSAndroid Build Coastguard Worker /*
113*f7c14bbaSAndroid Build Coastguard Worker  * Special "software" events provided by the kernel, even if the hardware
114*f7c14bbaSAndroid Build Coastguard Worker  * does not support performance events. These events measure various
115*f7c14bbaSAndroid Build Coastguard Worker  * physical and sw events of the kernel (and allow the profiling of them as
116*f7c14bbaSAndroid Build Coastguard Worker  * well):
117*f7c14bbaSAndroid Build Coastguard Worker  */
118*f7c14bbaSAndroid Build Coastguard Worker enum perf_sw_ids {
119*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_CPU_CLOCK			= 0,
120*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_TASK_CLOCK		= 1,
121*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_PAGE_FAULTS		= 2,
122*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_CONTEXT_SWITCHES		= 3,
123*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_CPU_MIGRATIONS		= 4,
124*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_PAGE_FAULTS_MIN		= 5,
125*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_PAGE_FAULTS_MAJ		= 6,
126*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_ALIGNMENT_FAULTS		= 7,
127*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_EMULATION_FAULTS		= 8,
128*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_DUMMY			= 9,
129*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_BPF_OUTPUT		= 10,
130*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_CGROUP_SWITCHES		= 11,
131*f7c14bbaSAndroid Build Coastguard Worker 
132*f7c14bbaSAndroid Build Coastguard Worker 	PERF_COUNT_SW_MAX,			/* non-ABI */
133*f7c14bbaSAndroid Build Coastguard Worker };
134*f7c14bbaSAndroid Build Coastguard Worker 
135*f7c14bbaSAndroid Build Coastguard Worker /*
136*f7c14bbaSAndroid Build Coastguard Worker  * Bits that can be set in attr.sample_type to request information
137*f7c14bbaSAndroid Build Coastguard Worker  * in the overflow packets.
138*f7c14bbaSAndroid Build Coastguard Worker  */
139*f7c14bbaSAndroid Build Coastguard Worker enum perf_event_sample_format {
140*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_IP				= 1U << 0,
141*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_TID				= 1U << 1,
142*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_TIME			= 1U << 2,
143*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_ADDR			= 1U << 3,
144*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_READ			= 1U << 4,
145*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_CALLCHAIN			= 1U << 5,
146*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_ID				= 1U << 6,
147*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_CPU				= 1U << 7,
148*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_PERIOD			= 1U << 8,
149*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_STREAM_ID			= 1U << 9,
150*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_RAW				= 1U << 10,
151*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_STACK		= 1U << 11,
152*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_REGS_USER			= 1U << 12,
153*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_STACK_USER			= 1U << 13,
154*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_WEIGHT			= 1U << 14,
155*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_DATA_SRC			= 1U << 15,
156*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_IDENTIFIER			= 1U << 16,
157*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_TRANSACTION			= 1U << 17,
158*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_REGS_INTR			= 1U << 18,
159*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_PHYS_ADDR			= 1U << 19,
160*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_AUX				= 1U << 20,
161*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_CGROUP			= 1U << 21,
162*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_DATA_PAGE_SIZE		= 1U << 22,
163*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_CODE_PAGE_SIZE		= 1U << 23,
164*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_WEIGHT_STRUCT		= 1U << 24,
165*f7c14bbaSAndroid Build Coastguard Worker 
166*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_MAX = 1U << 25,		/* non-ABI */
167*f7c14bbaSAndroid Build Coastguard Worker };
168*f7c14bbaSAndroid Build Coastguard Worker 
169*f7c14bbaSAndroid Build Coastguard Worker #define PERF_SAMPLE_WEIGHT_TYPE	(PERF_SAMPLE_WEIGHT | PERF_SAMPLE_WEIGHT_STRUCT)
170*f7c14bbaSAndroid Build Coastguard Worker /*
171*f7c14bbaSAndroid Build Coastguard Worker  * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
172*f7c14bbaSAndroid Build Coastguard Worker  *
173*f7c14bbaSAndroid Build Coastguard Worker  * If the user does not pass priv level information via branch_sample_type,
174*f7c14bbaSAndroid Build Coastguard Worker  * the kernel uses the event's priv level. Branch and event priv levels do
175*f7c14bbaSAndroid Build Coastguard Worker  * not have to match. Branch priv level is checked for permissions.
176*f7c14bbaSAndroid Build Coastguard Worker  *
177*f7c14bbaSAndroid Build Coastguard Worker  * The branch types can be combined, however BRANCH_ANY covers all types
178*f7c14bbaSAndroid Build Coastguard Worker  * of branches and therefore it supersedes all the other types.
179*f7c14bbaSAndroid Build Coastguard Worker  */
180*f7c14bbaSAndroid Build Coastguard Worker enum perf_branch_sample_type_shift {
181*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_USER_SHIFT		= 0, /* user branches */
182*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_KERNEL_SHIFT		= 1, /* kernel branches */
183*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_HV_SHIFT		= 2, /* hypervisor branches */
184*f7c14bbaSAndroid Build Coastguard Worker 
185*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY_SHIFT		= 3, /* any branch types */
186*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT	= 4, /* any call branch */
187*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT	= 5, /* any return branch */
188*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IND_CALL_SHIFT	= 6, /* indirect calls */
189*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT	= 7, /* transaction aborts */
190*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IN_TX_SHIFT		= 8, /* in transaction */
191*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_TX_SHIFT		= 9, /* not in transaction */
192*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_COND_SHIFT		= 10, /* conditional branches */
193*f7c14bbaSAndroid Build Coastguard Worker 
194*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT	= 11, /* call/ret stack */
195*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT	= 12, /* indirect jumps */
196*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_CALL_SHIFT		= 13, /* direct call */
197*f7c14bbaSAndroid Build Coastguard Worker 
198*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT	= 14, /* no flags */
199*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT	= 15, /* no cycles */
200*f7c14bbaSAndroid Build Coastguard Worker 
201*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT	= 16, /* save branch type */
202*f7c14bbaSAndroid Build Coastguard Worker 
203*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT	= 17, /* save low level index of raw branch records */
204*f7c14bbaSAndroid Build Coastguard Worker 
205*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT	= 18, /* save privilege mode */
206*f7c14bbaSAndroid Build Coastguard Worker 
207*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_COUNTERS_SHIFT	= 19, /* save occurrences of events on a branch */
208*f7c14bbaSAndroid Build Coastguard Worker 
209*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_MAX_SHIFT		/* non-ABI */
210*f7c14bbaSAndroid Build Coastguard Worker };
211*f7c14bbaSAndroid Build Coastguard Worker 
212*f7c14bbaSAndroid Build Coastguard Worker enum perf_branch_sample_type {
213*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_USER		= 1U << PERF_SAMPLE_BRANCH_USER_SHIFT,
214*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_KERNEL	= 1U << PERF_SAMPLE_BRANCH_KERNEL_SHIFT,
215*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_HV		= 1U << PERF_SAMPLE_BRANCH_HV_SHIFT,
216*f7c14bbaSAndroid Build Coastguard Worker 
217*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY		= 1U << PERF_SAMPLE_BRANCH_ANY_SHIFT,
218*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY_CALL	= 1U << PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT,
219*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ANY_RETURN	= 1U << PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT,
220*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IND_CALL	= 1U << PERF_SAMPLE_BRANCH_IND_CALL_SHIFT,
221*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_ABORT_TX	= 1U << PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT,
222*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IN_TX	= 1U << PERF_SAMPLE_BRANCH_IN_TX_SHIFT,
223*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_TX	= 1U << PERF_SAMPLE_BRANCH_NO_TX_SHIFT,
224*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_COND		= 1U << PERF_SAMPLE_BRANCH_COND_SHIFT,
225*f7c14bbaSAndroid Build Coastguard Worker 
226*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_CALL_STACK	= 1U << PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT,
227*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_IND_JUMP	= 1U << PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT,
228*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_CALL		= 1U << PERF_SAMPLE_BRANCH_CALL_SHIFT,
229*f7c14bbaSAndroid Build Coastguard Worker 
230*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_FLAGS	= 1U << PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT,
231*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_NO_CYCLES	= 1U << PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT,
232*f7c14bbaSAndroid Build Coastguard Worker 
233*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_TYPE_SAVE	=
234*f7c14bbaSAndroid Build Coastguard Worker 		1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT,
235*f7c14bbaSAndroid Build Coastguard Worker 
236*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_HW_INDEX	= 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT,
237*f7c14bbaSAndroid Build Coastguard Worker 
238*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_PRIV_SAVE	= 1U << PERF_SAMPLE_BRANCH_PRIV_SAVE_SHIFT,
239*f7c14bbaSAndroid Build Coastguard Worker 
240*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_COUNTERS	= 1U << PERF_SAMPLE_BRANCH_COUNTERS_SHIFT,
241*f7c14bbaSAndroid Build Coastguard Worker 
242*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_BRANCH_MAX		= 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT,
243*f7c14bbaSAndroid Build Coastguard Worker };
244*f7c14bbaSAndroid Build Coastguard Worker 
245*f7c14bbaSAndroid Build Coastguard Worker /*
246*f7c14bbaSAndroid Build Coastguard Worker  * Common flow change classification
247*f7c14bbaSAndroid Build Coastguard Worker  */
248*f7c14bbaSAndroid Build Coastguard Worker enum {
249*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_UNKNOWN		= 0,	/* unknown */
250*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_COND		= 1,	/* conditional */
251*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_UNCOND		= 2,	/* unconditional  */
252*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_IND		= 3,	/* indirect */
253*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_CALL		= 4,	/* function call */
254*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_IND_CALL	= 5,	/* indirect function call */
255*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_RET		= 6,	/* function return */
256*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SYSCALL		= 7,	/* syscall */
257*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SYSRET		= 8,	/* syscall return */
258*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_COND_CALL	= 9,	/* conditional function call */
259*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_COND_RET	= 10,	/* conditional function return */
260*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_ERET		= 11,	/* exception return */
261*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_IRQ		= 12,	/* irq */
262*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SERROR		= 13,	/* system error */
263*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NO_TX		= 14,	/* not in transaction */
264*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_EXTEND_ABI	= 15,	/* extend ABI */
265*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_MAX,
266*f7c14bbaSAndroid Build Coastguard Worker };
267*f7c14bbaSAndroid Build Coastguard Worker 
268*f7c14bbaSAndroid Build Coastguard Worker /*
269*f7c14bbaSAndroid Build Coastguard Worker  * Common branch speculation outcome classification
270*f7c14bbaSAndroid Build Coastguard Worker  */
271*f7c14bbaSAndroid Build Coastguard Worker enum {
272*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SPEC_NA			= 0,	/* Not available */
273*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SPEC_WRONG_PATH		= 1,	/* Speculative but on wrong path */
274*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NON_SPEC_CORRECT_PATH	= 2,	/* Non-speculative but on correct path */
275*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SPEC_CORRECT_PATH	= 3,	/* Speculative and on correct path */
276*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_SPEC_MAX,
277*f7c14bbaSAndroid Build Coastguard Worker };
278*f7c14bbaSAndroid Build Coastguard Worker 
279*f7c14bbaSAndroid Build Coastguard Worker enum {
280*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_FAULT_ALGN		= 0,    /* Alignment fault */
281*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_FAULT_DATA		= 1,    /* Data fault */
282*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_FAULT_INST		= 2,    /* Inst fault */
283*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_ARCH_1		= 3,    /* Architecture specific */
284*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_ARCH_2		= 4,    /* Architecture specific */
285*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_ARCH_3		= 5,    /* Architecture specific */
286*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_ARCH_4		= 6,    /* Architecture specific */
287*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_ARCH_5		= 7,    /* Architecture specific */
288*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_NEW_MAX,
289*f7c14bbaSAndroid Build Coastguard Worker };
290*f7c14bbaSAndroid Build Coastguard Worker 
291*f7c14bbaSAndroid Build Coastguard Worker enum {
292*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_PRIV_UNKNOWN	= 0,
293*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_PRIV_USER	= 1,
294*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_PRIV_KERNEL	= 2,
295*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BR_PRIV_HV		= 3,
296*f7c14bbaSAndroid Build Coastguard Worker };
297*f7c14bbaSAndroid Build Coastguard Worker 
298*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BR_ARM64_FIQ		PERF_BR_NEW_ARCH_1
299*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BR_ARM64_DEBUG_HALT	PERF_BR_NEW_ARCH_2
300*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BR_ARM64_DEBUG_EXIT	PERF_BR_NEW_ARCH_3
301*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BR_ARM64_DEBUG_INST	PERF_BR_NEW_ARCH_4
302*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BR_ARM64_DEBUG_DATA	PERF_BR_NEW_ARCH_5
303*f7c14bbaSAndroid Build Coastguard Worker 
304*f7c14bbaSAndroid Build Coastguard Worker #define PERF_SAMPLE_BRANCH_PLM_ALL \
305*f7c14bbaSAndroid Build Coastguard Worker 	(PERF_SAMPLE_BRANCH_USER|\
306*f7c14bbaSAndroid Build Coastguard Worker 	 PERF_SAMPLE_BRANCH_KERNEL|\
307*f7c14bbaSAndroid Build Coastguard Worker 	 PERF_SAMPLE_BRANCH_HV)
308*f7c14bbaSAndroid Build Coastguard Worker 
309*f7c14bbaSAndroid Build Coastguard Worker /*
310*f7c14bbaSAndroid Build Coastguard Worker  * Values to determine ABI of the registers dump.
311*f7c14bbaSAndroid Build Coastguard Worker  */
312*f7c14bbaSAndroid Build Coastguard Worker enum perf_sample_regs_abi {
313*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_REGS_ABI_NONE	= 0,
314*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_REGS_ABI_32		= 1,
315*f7c14bbaSAndroid Build Coastguard Worker 	PERF_SAMPLE_REGS_ABI_64		= 2,
316*f7c14bbaSAndroid Build Coastguard Worker };
317*f7c14bbaSAndroid Build Coastguard Worker 
318*f7c14bbaSAndroid Build Coastguard Worker /*
319*f7c14bbaSAndroid Build Coastguard Worker  * Values for the memory transaction event qualifier, mostly for
320*f7c14bbaSAndroid Build Coastguard Worker  * abort events. Multiple bits can be set.
321*f7c14bbaSAndroid Build Coastguard Worker  */
322*f7c14bbaSAndroid Build Coastguard Worker enum {
323*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_ELISION        = (1 << 0), /* From elision */
324*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_TRANSACTION    = (1 << 1), /* From transaction */
325*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_SYNC           = (1 << 2), /* Instruction is related */
326*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_ASYNC          = (1 << 3), /* Instruction not related */
327*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_RETRY          = (1 << 4), /* Retry possible */
328*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_CONFLICT       = (1 << 5), /* Conflict abort */
329*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */
330*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_CAPACITY_READ  = (1 << 7), /* Capacity read abort */
331*f7c14bbaSAndroid Build Coastguard Worker 
332*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_MAX	        = (1 << 8), /* non-ABI */
333*f7c14bbaSAndroid Build Coastguard Worker 
334*f7c14bbaSAndroid Build Coastguard Worker 	/* bits 32..63 are reserved for the abort code */
335*f7c14bbaSAndroid Build Coastguard Worker 
336*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_ABORT_MASK  = (0xffffffffULL << 32),
337*f7c14bbaSAndroid Build Coastguard Worker 	PERF_TXN_ABORT_SHIFT = 32,
338*f7c14bbaSAndroid Build Coastguard Worker };
339*f7c14bbaSAndroid Build Coastguard Worker 
340*f7c14bbaSAndroid Build Coastguard Worker /*
341*f7c14bbaSAndroid Build Coastguard Worker  * The format of the data returned by read() on a perf event fd,
342*f7c14bbaSAndroid Build Coastguard Worker  * as specified by attr.read_format:
343*f7c14bbaSAndroid Build Coastguard Worker  *
344*f7c14bbaSAndroid Build Coastguard Worker  * struct read_format {
345*f7c14bbaSAndroid Build Coastguard Worker  *	{ u64		value;
346*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
347*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
348*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		id;           } && PERF_FORMAT_ID
349*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		lost;         } && PERF_FORMAT_LOST
350*f7c14bbaSAndroid Build Coastguard Worker  *	} && !PERF_FORMAT_GROUP
351*f7c14bbaSAndroid Build Coastguard Worker  *
352*f7c14bbaSAndroid Build Coastguard Worker  *	{ u64		nr;
353*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
354*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
355*f7c14bbaSAndroid Build Coastguard Worker  *	  { u64		value;
356*f7c14bbaSAndroid Build Coastguard Worker  *	    { u64	id;           } && PERF_FORMAT_ID
357*f7c14bbaSAndroid Build Coastguard Worker  *	    { u64	lost;         } && PERF_FORMAT_LOST
358*f7c14bbaSAndroid Build Coastguard Worker  *	  }		cntr[nr];
359*f7c14bbaSAndroid Build Coastguard Worker  *	} && PERF_FORMAT_GROUP
360*f7c14bbaSAndroid Build Coastguard Worker  * };
361*f7c14bbaSAndroid Build Coastguard Worker  */
362*f7c14bbaSAndroid Build Coastguard Worker enum perf_event_read_format {
363*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_TOTAL_TIME_ENABLED		= 1U << 0,
364*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_TOTAL_TIME_RUNNING		= 1U << 1,
365*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_ID				= 1U << 2,
366*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_GROUP			= 1U << 3,
367*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_LOST			= 1U << 4,
368*f7c14bbaSAndroid Build Coastguard Worker 
369*f7c14bbaSAndroid Build Coastguard Worker 	PERF_FORMAT_MAX = 1U << 5,		/* non-ABI */
370*f7c14bbaSAndroid Build Coastguard Worker };
371*f7c14bbaSAndroid Build Coastguard Worker 
372*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER0	64	/* sizeof first published struct */
373*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER1	72	/* add: config2 */
374*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER2	80	/* add: branch_sample_type */
375*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER3	96	/* add: sample_regs_user */
376*f7c14bbaSAndroid Build Coastguard Worker 					/* add: sample_stack_user */
377*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER4	104	/* add: sample_regs_intr */
378*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER5	112	/* add: aux_watermark */
379*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER6	120	/* add: aux_sample_size */
380*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER7	128	/* add: sig_data */
381*f7c14bbaSAndroid Build Coastguard Worker #define PERF_ATTR_SIZE_VER8	136	/* add: config3 */
382*f7c14bbaSAndroid Build Coastguard Worker 
383*f7c14bbaSAndroid Build Coastguard Worker /*
384*f7c14bbaSAndroid Build Coastguard Worker  * Hardware event_id to monitor via a performance monitoring event:
385*f7c14bbaSAndroid Build Coastguard Worker  *
386*f7c14bbaSAndroid Build Coastguard Worker  * @sample_max_stack: Max number of frame pointers in a callchain,
387*f7c14bbaSAndroid Build Coastguard Worker  *		      should be < /proc/sys/kernel/perf_event_max_stack
388*f7c14bbaSAndroid Build Coastguard Worker  */
389*f7c14bbaSAndroid Build Coastguard Worker struct perf_event_attr {
390*f7c14bbaSAndroid Build Coastguard Worker 
391*f7c14bbaSAndroid Build Coastguard Worker 	/*
392*f7c14bbaSAndroid Build Coastguard Worker 	 * Major type: hardware/software/tracepoint/etc.
393*f7c14bbaSAndroid Build Coastguard Worker 	 */
394*f7c14bbaSAndroid Build Coastguard Worker 	__u32			type;
395*f7c14bbaSAndroid Build Coastguard Worker 
396*f7c14bbaSAndroid Build Coastguard Worker 	/*
397*f7c14bbaSAndroid Build Coastguard Worker 	 * Size of the attr structure, for fwd/bwd compat.
398*f7c14bbaSAndroid Build Coastguard Worker 	 */
399*f7c14bbaSAndroid Build Coastguard Worker 	__u32			size;
400*f7c14bbaSAndroid Build Coastguard Worker 
401*f7c14bbaSAndroid Build Coastguard Worker 	/*
402*f7c14bbaSAndroid Build Coastguard Worker 	 * Type specific configuration information.
403*f7c14bbaSAndroid Build Coastguard Worker 	 */
404*f7c14bbaSAndroid Build Coastguard Worker 	__u64			config;
405*f7c14bbaSAndroid Build Coastguard Worker 
406*f7c14bbaSAndroid Build Coastguard Worker 	union {
407*f7c14bbaSAndroid Build Coastguard Worker 		__u64		sample_period;
408*f7c14bbaSAndroid Build Coastguard Worker 		__u64		sample_freq;
409*f7c14bbaSAndroid Build Coastguard Worker 	};
410*f7c14bbaSAndroid Build Coastguard Worker 
411*f7c14bbaSAndroid Build Coastguard Worker 	__u64			sample_type;
412*f7c14bbaSAndroid Build Coastguard Worker 	__u64			read_format;
413*f7c14bbaSAndroid Build Coastguard Worker 
414*f7c14bbaSAndroid Build Coastguard Worker 	__u64			disabled       :  1, /* off by default        */
415*f7c14bbaSAndroid Build Coastguard Worker 				inherit	       :  1, /* children inherit it   */
416*f7c14bbaSAndroid Build Coastguard Worker 				pinned	       :  1, /* must always be on PMU */
417*f7c14bbaSAndroid Build Coastguard Worker 				exclusive      :  1, /* only group on PMU     */
418*f7c14bbaSAndroid Build Coastguard Worker 				exclude_user   :  1, /* don't count user      */
419*f7c14bbaSAndroid Build Coastguard Worker 				exclude_kernel :  1, /* ditto kernel          */
420*f7c14bbaSAndroid Build Coastguard Worker 				exclude_hv     :  1, /* ditto hypervisor      */
421*f7c14bbaSAndroid Build Coastguard Worker 				exclude_idle   :  1, /* don't count when idle */
422*f7c14bbaSAndroid Build Coastguard Worker 				mmap           :  1, /* include mmap data     */
423*f7c14bbaSAndroid Build Coastguard Worker 				comm	       :  1, /* include comm data     */
424*f7c14bbaSAndroid Build Coastguard Worker 				freq           :  1, /* use freq, not period  */
425*f7c14bbaSAndroid Build Coastguard Worker 				inherit_stat   :  1, /* per task counts       */
426*f7c14bbaSAndroid Build Coastguard Worker 				enable_on_exec :  1, /* next exec enables     */
427*f7c14bbaSAndroid Build Coastguard Worker 				task           :  1, /* trace fork/exit       */
428*f7c14bbaSAndroid Build Coastguard Worker 				watermark      :  1, /* wakeup_watermark      */
429*f7c14bbaSAndroid Build Coastguard Worker 				/*
430*f7c14bbaSAndroid Build Coastguard Worker 				 * precise_ip:
431*f7c14bbaSAndroid Build Coastguard Worker 				 *
432*f7c14bbaSAndroid Build Coastguard Worker 				 *  0 - SAMPLE_IP can have arbitrary skid
433*f7c14bbaSAndroid Build Coastguard Worker 				 *  1 - SAMPLE_IP must have constant skid
434*f7c14bbaSAndroid Build Coastguard Worker 				 *  2 - SAMPLE_IP requested to have 0 skid
435*f7c14bbaSAndroid Build Coastguard Worker 				 *  3 - SAMPLE_IP must have 0 skid
436*f7c14bbaSAndroid Build Coastguard Worker 				 *
437*f7c14bbaSAndroid Build Coastguard Worker 				 *  See also PERF_RECORD_MISC_EXACT_IP
438*f7c14bbaSAndroid Build Coastguard Worker 				 */
439*f7c14bbaSAndroid Build Coastguard Worker 				precise_ip     :  2, /* skid constraint       */
440*f7c14bbaSAndroid Build Coastguard Worker 				mmap_data      :  1, /* non-exec mmap data    */
441*f7c14bbaSAndroid Build Coastguard Worker 				sample_id_all  :  1, /* sample_type all events */
442*f7c14bbaSAndroid Build Coastguard Worker 
443*f7c14bbaSAndroid Build Coastguard Worker 				exclude_host   :  1, /* don't count in host   */
444*f7c14bbaSAndroid Build Coastguard Worker 				exclude_guest  :  1, /* don't count in guest  */
445*f7c14bbaSAndroid Build Coastguard Worker 
446*f7c14bbaSAndroid Build Coastguard Worker 				exclude_callchain_kernel : 1, /* exclude kernel callchains */
447*f7c14bbaSAndroid Build Coastguard Worker 				exclude_callchain_user   : 1, /* exclude user callchains */
448*f7c14bbaSAndroid Build Coastguard Worker 				mmap2          :  1, /* include mmap with inode data     */
449*f7c14bbaSAndroid Build Coastguard Worker 				comm_exec      :  1, /* flag comm events that are due to an exec */
450*f7c14bbaSAndroid Build Coastguard Worker 				use_clockid    :  1, /* use @clockid for time fields */
451*f7c14bbaSAndroid Build Coastguard Worker 				context_switch :  1, /* context switch data */
452*f7c14bbaSAndroid Build Coastguard Worker 				write_backward :  1, /* Write ring buffer from end to beginning */
453*f7c14bbaSAndroid Build Coastguard Worker 				namespaces     :  1, /* include namespaces data */
454*f7c14bbaSAndroid Build Coastguard Worker 				ksymbol        :  1, /* include ksymbol events */
455*f7c14bbaSAndroid Build Coastguard Worker 				bpf_event      :  1, /* include bpf events */
456*f7c14bbaSAndroid Build Coastguard Worker 				aux_output     :  1, /* generate AUX records instead of events */
457*f7c14bbaSAndroid Build Coastguard Worker 				cgroup         :  1, /* include cgroup events */
458*f7c14bbaSAndroid Build Coastguard Worker 				text_poke      :  1, /* include text poke events */
459*f7c14bbaSAndroid Build Coastguard Worker 				build_id       :  1, /* use build id in mmap2 events */
460*f7c14bbaSAndroid Build Coastguard Worker 				inherit_thread :  1, /* children only inherit if cloned with CLONE_THREAD */
461*f7c14bbaSAndroid Build Coastguard Worker 				remove_on_exec :  1, /* event is removed from task on exec */
462*f7c14bbaSAndroid Build Coastguard Worker 				sigtrap        :  1, /* send synchronous SIGTRAP on event */
463*f7c14bbaSAndroid Build Coastguard Worker 				__reserved_1   : 26;
464*f7c14bbaSAndroid Build Coastguard Worker 
465*f7c14bbaSAndroid Build Coastguard Worker 	union {
466*f7c14bbaSAndroid Build Coastguard Worker 		__u32		wakeup_events;	  /* wakeup every n events */
467*f7c14bbaSAndroid Build Coastguard Worker 		__u32		wakeup_watermark; /* bytes before wakeup   */
468*f7c14bbaSAndroid Build Coastguard Worker 	};
469*f7c14bbaSAndroid Build Coastguard Worker 
470*f7c14bbaSAndroid Build Coastguard Worker 	__u32			bp_type;
471*f7c14bbaSAndroid Build Coastguard Worker 	union {
472*f7c14bbaSAndroid Build Coastguard Worker 		__u64		bp_addr;
473*f7c14bbaSAndroid Build Coastguard Worker 		__u64		kprobe_func; /* for perf_kprobe */
474*f7c14bbaSAndroid Build Coastguard Worker 		__u64		uprobe_path; /* for perf_uprobe */
475*f7c14bbaSAndroid Build Coastguard Worker 		__u64		config1; /* extension of config */
476*f7c14bbaSAndroid Build Coastguard Worker 	};
477*f7c14bbaSAndroid Build Coastguard Worker 	union {
478*f7c14bbaSAndroid Build Coastguard Worker 		__u64		bp_len;
479*f7c14bbaSAndroid Build Coastguard Worker 		__u64		kprobe_addr; /* when kprobe_func == NULL */
480*f7c14bbaSAndroid Build Coastguard Worker 		__u64		probe_offset; /* for perf_[k,u]probe */
481*f7c14bbaSAndroid Build Coastguard Worker 		__u64		config2; /* extension of config1 */
482*f7c14bbaSAndroid Build Coastguard Worker 	};
483*f7c14bbaSAndroid Build Coastguard Worker 	__u64	branch_sample_type; /* enum perf_branch_sample_type */
484*f7c14bbaSAndroid Build Coastguard Worker 
485*f7c14bbaSAndroid Build Coastguard Worker 	/*
486*f7c14bbaSAndroid Build Coastguard Worker 	 * Defines set of user regs to dump on samples.
487*f7c14bbaSAndroid Build Coastguard Worker 	 * See asm/perf_regs.h for details.
488*f7c14bbaSAndroid Build Coastguard Worker 	 */
489*f7c14bbaSAndroid Build Coastguard Worker 	__u64	sample_regs_user;
490*f7c14bbaSAndroid Build Coastguard Worker 
491*f7c14bbaSAndroid Build Coastguard Worker 	/*
492*f7c14bbaSAndroid Build Coastguard Worker 	 * Defines size of the user stack to dump on samples.
493*f7c14bbaSAndroid Build Coastguard Worker 	 */
494*f7c14bbaSAndroid Build Coastguard Worker 	__u32	sample_stack_user;
495*f7c14bbaSAndroid Build Coastguard Worker 
496*f7c14bbaSAndroid Build Coastguard Worker 	__s32	clockid;
497*f7c14bbaSAndroid Build Coastguard Worker 	/*
498*f7c14bbaSAndroid Build Coastguard Worker 	 * Defines set of regs to dump for each sample
499*f7c14bbaSAndroid Build Coastguard Worker 	 * state captured on:
500*f7c14bbaSAndroid Build Coastguard Worker 	 *  - precise = 0: PMU interrupt
501*f7c14bbaSAndroid Build Coastguard Worker 	 *  - precise > 0: sampled instruction
502*f7c14bbaSAndroid Build Coastguard Worker 	 *
503*f7c14bbaSAndroid Build Coastguard Worker 	 * See asm/perf_regs.h for details.
504*f7c14bbaSAndroid Build Coastguard Worker 	 */
505*f7c14bbaSAndroid Build Coastguard Worker 	__u64	sample_regs_intr;
506*f7c14bbaSAndroid Build Coastguard Worker 
507*f7c14bbaSAndroid Build Coastguard Worker 	/*
508*f7c14bbaSAndroid Build Coastguard Worker 	 * Wakeup watermark for AUX area
509*f7c14bbaSAndroid Build Coastguard Worker 	 */
510*f7c14bbaSAndroid Build Coastguard Worker 	__u32	aux_watermark;
511*f7c14bbaSAndroid Build Coastguard Worker 	__u16	sample_max_stack;
512*f7c14bbaSAndroid Build Coastguard Worker 	__u16	__reserved_2;
513*f7c14bbaSAndroid Build Coastguard Worker 	__u32	aux_sample_size;
514*f7c14bbaSAndroid Build Coastguard Worker 	__u32	__reserved_3;
515*f7c14bbaSAndroid Build Coastguard Worker 
516*f7c14bbaSAndroid Build Coastguard Worker 	/*
517*f7c14bbaSAndroid Build Coastguard Worker 	 * User provided data if sigtrap=1, passed back to user via
518*f7c14bbaSAndroid Build Coastguard Worker 	 * siginfo_t::si_perf_data, e.g. to permit user to identify the event.
519*f7c14bbaSAndroid Build Coastguard Worker 	 * Note, siginfo_t::si_perf_data is long-sized, and sig_data will be
520*f7c14bbaSAndroid Build Coastguard Worker 	 * truncated accordingly on 32 bit architectures.
521*f7c14bbaSAndroid Build Coastguard Worker 	 */
522*f7c14bbaSAndroid Build Coastguard Worker 	__u64	sig_data;
523*f7c14bbaSAndroid Build Coastguard Worker 
524*f7c14bbaSAndroid Build Coastguard Worker 	__u64	config3; /* extension of config2 */
525*f7c14bbaSAndroid Build Coastguard Worker };
526*f7c14bbaSAndroid Build Coastguard Worker 
527*f7c14bbaSAndroid Build Coastguard Worker /*
528*f7c14bbaSAndroid Build Coastguard Worker  * Structure used by below PERF_EVENT_IOC_QUERY_BPF command
529*f7c14bbaSAndroid Build Coastguard Worker  * to query bpf programs attached to the same perf tracepoint
530*f7c14bbaSAndroid Build Coastguard Worker  * as the given perf event.
531*f7c14bbaSAndroid Build Coastguard Worker  */
532*f7c14bbaSAndroid Build Coastguard Worker struct perf_event_query_bpf {
533*f7c14bbaSAndroid Build Coastguard Worker 	/*
534*f7c14bbaSAndroid Build Coastguard Worker 	 * The below ids array length
535*f7c14bbaSAndroid Build Coastguard Worker 	 */
536*f7c14bbaSAndroid Build Coastguard Worker 	__u32	ids_len;
537*f7c14bbaSAndroid Build Coastguard Worker 	/*
538*f7c14bbaSAndroid Build Coastguard Worker 	 * Set by the kernel to indicate the number of
539*f7c14bbaSAndroid Build Coastguard Worker 	 * available programs
540*f7c14bbaSAndroid Build Coastguard Worker 	 */
541*f7c14bbaSAndroid Build Coastguard Worker 	__u32	prog_cnt;
542*f7c14bbaSAndroid Build Coastguard Worker 	/*
543*f7c14bbaSAndroid Build Coastguard Worker 	 * User provided buffer to store program ids
544*f7c14bbaSAndroid Build Coastguard Worker 	 */
545*f7c14bbaSAndroid Build Coastguard Worker 	__u32	ids[];
546*f7c14bbaSAndroid Build Coastguard Worker };
547*f7c14bbaSAndroid Build Coastguard Worker 
548*f7c14bbaSAndroid Build Coastguard Worker /*
549*f7c14bbaSAndroid Build Coastguard Worker  * Ioctls that can be done on a perf event fd:
550*f7c14bbaSAndroid Build Coastguard Worker  */
551*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_ENABLE			_IO ('$', 0)
552*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_DISABLE			_IO ('$', 1)
553*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_REFRESH			_IO ('$', 2)
554*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_RESET			_IO ('$', 3)
555*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_PERIOD			_IOW('$', 4, __u64)
556*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_SET_OUTPUT		_IO ('$', 5)
557*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_SET_FILTER		_IOW('$', 6, char *)
558*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_ID			_IOR('$', 7, __u64 *)
559*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_SET_BPF			_IOW('$', 8, __u32)
560*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_PAUSE_OUTPUT		_IOW('$', 9, __u32)
561*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_QUERY_BPF		_IOWR('$', 10, struct perf_event_query_bpf *)
562*f7c14bbaSAndroid Build Coastguard Worker #define PERF_EVENT_IOC_MODIFY_ATTRIBUTES	_IOW('$', 11, struct perf_event_attr *)
563*f7c14bbaSAndroid Build Coastguard Worker 
564*f7c14bbaSAndroid Build Coastguard Worker enum perf_event_ioc_flags {
565*f7c14bbaSAndroid Build Coastguard Worker 	PERF_IOC_FLAG_GROUP		= 1U << 0,
566*f7c14bbaSAndroid Build Coastguard Worker };
567*f7c14bbaSAndroid Build Coastguard Worker 
568*f7c14bbaSAndroid Build Coastguard Worker /*
569*f7c14bbaSAndroid Build Coastguard Worker  * Structure of the page that can be mapped via mmap
570*f7c14bbaSAndroid Build Coastguard Worker  */
571*f7c14bbaSAndroid Build Coastguard Worker struct perf_event_mmap_page {
572*f7c14bbaSAndroid Build Coastguard Worker 	__u32	version;		/* version number of this structure */
573*f7c14bbaSAndroid Build Coastguard Worker 	__u32	compat_version;		/* lowest version this is compat with */
574*f7c14bbaSAndroid Build Coastguard Worker 
575*f7c14bbaSAndroid Build Coastguard Worker 	/*
576*f7c14bbaSAndroid Build Coastguard Worker 	 * Bits needed to read the hw events in user-space.
577*f7c14bbaSAndroid Build Coastguard Worker 	 *
578*f7c14bbaSAndroid Build Coastguard Worker 	 *   u32 seq, time_mult, time_shift, index, width;
579*f7c14bbaSAndroid Build Coastguard Worker 	 *   u64 count, enabled, running;
580*f7c14bbaSAndroid Build Coastguard Worker 	 *   u64 cyc, time_offset;
581*f7c14bbaSAndroid Build Coastguard Worker 	 *   s64 pmc = 0;
582*f7c14bbaSAndroid Build Coastguard Worker 	 *
583*f7c14bbaSAndroid Build Coastguard Worker 	 *   do {
584*f7c14bbaSAndroid Build Coastguard Worker 	 *     seq = pc->lock;
585*f7c14bbaSAndroid Build Coastguard Worker 	 *     barrier()
586*f7c14bbaSAndroid Build Coastguard Worker 	 *
587*f7c14bbaSAndroid Build Coastguard Worker 	 *     enabled = pc->time_enabled;
588*f7c14bbaSAndroid Build Coastguard Worker 	 *     running = pc->time_running;
589*f7c14bbaSAndroid Build Coastguard Worker 	 *
590*f7c14bbaSAndroid Build Coastguard Worker 	 *     if (pc->cap_usr_time && enabled != running) {
591*f7c14bbaSAndroid Build Coastguard Worker 	 *       cyc = rdtsc();
592*f7c14bbaSAndroid Build Coastguard Worker 	 *       time_offset = pc->time_offset;
593*f7c14bbaSAndroid Build Coastguard Worker 	 *       time_mult   = pc->time_mult;
594*f7c14bbaSAndroid Build Coastguard Worker 	 *       time_shift  = pc->time_shift;
595*f7c14bbaSAndroid Build Coastguard Worker 	 *     }
596*f7c14bbaSAndroid Build Coastguard Worker 	 *
597*f7c14bbaSAndroid Build Coastguard Worker 	 *     index = pc->index;
598*f7c14bbaSAndroid Build Coastguard Worker 	 *     count = pc->offset;
599*f7c14bbaSAndroid Build Coastguard Worker 	 *     if (pc->cap_user_rdpmc && index) {
600*f7c14bbaSAndroid Build Coastguard Worker 	 *       width = pc->pmc_width;
601*f7c14bbaSAndroid Build Coastguard Worker 	 *       pmc = rdpmc(index - 1);
602*f7c14bbaSAndroid Build Coastguard Worker 	 *     }
603*f7c14bbaSAndroid Build Coastguard Worker 	 *
604*f7c14bbaSAndroid Build Coastguard Worker 	 *     barrier();
605*f7c14bbaSAndroid Build Coastguard Worker 	 *   } while (pc->lock != seq);
606*f7c14bbaSAndroid Build Coastguard Worker 	 *
607*f7c14bbaSAndroid Build Coastguard Worker 	 * NOTE: for obvious reason this only works on self-monitoring
608*f7c14bbaSAndroid Build Coastguard Worker 	 *       processes.
609*f7c14bbaSAndroid Build Coastguard Worker 	 */
610*f7c14bbaSAndroid Build Coastguard Worker 	__u32	lock;			/* seqlock for synchronization */
611*f7c14bbaSAndroid Build Coastguard Worker 	__u32	index;			/* hardware event identifier */
612*f7c14bbaSAndroid Build Coastguard Worker 	__s64	offset;			/* add to hardware event value */
613*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_enabled;		/* time event active */
614*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_running;		/* time event on cpu */
615*f7c14bbaSAndroid Build Coastguard Worker 	union {
616*f7c14bbaSAndroid Build Coastguard Worker 		__u64	capabilities;
617*f7c14bbaSAndroid Build Coastguard Worker 		struct {
618*f7c14bbaSAndroid Build Coastguard Worker 			__u64	cap_bit0		: 1, /* Always 0, deprecated, see commit 860f085b74e9 */
619*f7c14bbaSAndroid Build Coastguard Worker 				cap_bit0_is_deprecated	: 1, /* Always 1, signals that bit 0 is zero */
620*f7c14bbaSAndroid Build Coastguard Worker 
621*f7c14bbaSAndroid Build Coastguard Worker 				cap_user_rdpmc		: 1, /* The RDPMC instruction can be used to read counts */
622*f7c14bbaSAndroid Build Coastguard Worker 				cap_user_time		: 1, /* The time_{shift,mult,offset} fields are used */
623*f7c14bbaSAndroid Build Coastguard Worker 				cap_user_time_zero	: 1, /* The time_zero field is used */
624*f7c14bbaSAndroid Build Coastguard Worker 				cap_user_time_short	: 1, /* the time_{cycle,mask} fields are used */
625*f7c14bbaSAndroid Build Coastguard Worker 				cap_____res		: 58;
626*f7c14bbaSAndroid Build Coastguard Worker 		};
627*f7c14bbaSAndroid Build Coastguard Worker 	};
628*f7c14bbaSAndroid Build Coastguard Worker 
629*f7c14bbaSAndroid Build Coastguard Worker 	/*
630*f7c14bbaSAndroid Build Coastguard Worker 	 * If cap_user_rdpmc this field provides the bit-width of the value
631*f7c14bbaSAndroid Build Coastguard Worker 	 * read using the rdpmc() or equivalent instruction. This can be used
632*f7c14bbaSAndroid Build Coastguard Worker 	 * to sign extend the result like:
633*f7c14bbaSAndroid Build Coastguard Worker 	 *
634*f7c14bbaSAndroid Build Coastguard Worker 	 *   pmc <<= 64 - width;
635*f7c14bbaSAndroid Build Coastguard Worker 	 *   pmc >>= 64 - width; // signed shift right
636*f7c14bbaSAndroid Build Coastguard Worker 	 *   count += pmc;
637*f7c14bbaSAndroid Build Coastguard Worker 	 */
638*f7c14bbaSAndroid Build Coastguard Worker 	__u16	pmc_width;
639*f7c14bbaSAndroid Build Coastguard Worker 
640*f7c14bbaSAndroid Build Coastguard Worker 	/*
641*f7c14bbaSAndroid Build Coastguard Worker 	 * If cap_usr_time the below fields can be used to compute the time
642*f7c14bbaSAndroid Build Coastguard Worker 	 * delta since time_enabled (in ns) using rdtsc or similar.
643*f7c14bbaSAndroid Build Coastguard Worker 	 *
644*f7c14bbaSAndroid Build Coastguard Worker 	 *   u64 quot, rem;
645*f7c14bbaSAndroid Build Coastguard Worker 	 *   u64 delta;
646*f7c14bbaSAndroid Build Coastguard Worker 	 *
647*f7c14bbaSAndroid Build Coastguard Worker 	 *   quot = (cyc >> time_shift);
648*f7c14bbaSAndroid Build Coastguard Worker 	 *   rem = cyc & (((u64)1 << time_shift) - 1);
649*f7c14bbaSAndroid Build Coastguard Worker 	 *   delta = time_offset + quot * time_mult +
650*f7c14bbaSAndroid Build Coastguard Worker 	 *              ((rem * time_mult) >> time_shift);
651*f7c14bbaSAndroid Build Coastguard Worker 	 *
652*f7c14bbaSAndroid Build Coastguard Worker 	 * Where time_offset,time_mult,time_shift and cyc are read in the
653*f7c14bbaSAndroid Build Coastguard Worker 	 * seqcount loop described above. This delta can then be added to
654*f7c14bbaSAndroid Build Coastguard Worker 	 * enabled and possible running (if index), improving the scaling:
655*f7c14bbaSAndroid Build Coastguard Worker 	 *
656*f7c14bbaSAndroid Build Coastguard Worker 	 *   enabled += delta;
657*f7c14bbaSAndroid Build Coastguard Worker 	 *   if (index)
658*f7c14bbaSAndroid Build Coastguard Worker 	 *     running += delta;
659*f7c14bbaSAndroid Build Coastguard Worker 	 *
660*f7c14bbaSAndroid Build Coastguard Worker 	 *   quot = count / running;
661*f7c14bbaSAndroid Build Coastguard Worker 	 *   rem  = count % running;
662*f7c14bbaSAndroid Build Coastguard Worker 	 *   count = quot * enabled + (rem * enabled) / running;
663*f7c14bbaSAndroid Build Coastguard Worker 	 */
664*f7c14bbaSAndroid Build Coastguard Worker 	__u16	time_shift;
665*f7c14bbaSAndroid Build Coastguard Worker 	__u32	time_mult;
666*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_offset;
667*f7c14bbaSAndroid Build Coastguard Worker 	/*
668*f7c14bbaSAndroid Build Coastguard Worker 	 * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated
669*f7c14bbaSAndroid Build Coastguard Worker 	 * from sample timestamps.
670*f7c14bbaSAndroid Build Coastguard Worker 	 *
671*f7c14bbaSAndroid Build Coastguard Worker 	 *   time = timestamp - time_zero;
672*f7c14bbaSAndroid Build Coastguard Worker 	 *   quot = time / time_mult;
673*f7c14bbaSAndroid Build Coastguard Worker 	 *   rem  = time % time_mult;
674*f7c14bbaSAndroid Build Coastguard Worker 	 *   cyc = (quot << time_shift) + (rem << time_shift) / time_mult;
675*f7c14bbaSAndroid Build Coastguard Worker 	 *
676*f7c14bbaSAndroid Build Coastguard Worker 	 * And vice versa:
677*f7c14bbaSAndroid Build Coastguard Worker 	 *
678*f7c14bbaSAndroid Build Coastguard Worker 	 *   quot = cyc >> time_shift;
679*f7c14bbaSAndroid Build Coastguard Worker 	 *   rem  = cyc & (((u64)1 << time_shift) - 1);
680*f7c14bbaSAndroid Build Coastguard Worker 	 *   timestamp = time_zero + quot * time_mult +
681*f7c14bbaSAndroid Build Coastguard Worker 	 *               ((rem * time_mult) >> time_shift);
682*f7c14bbaSAndroid Build Coastguard Worker 	 */
683*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_zero;
684*f7c14bbaSAndroid Build Coastguard Worker 
685*f7c14bbaSAndroid Build Coastguard Worker 	__u32	size;			/* Header size up to __reserved[] fields. */
686*f7c14bbaSAndroid Build Coastguard Worker 	__u32	__reserved_1;
687*f7c14bbaSAndroid Build Coastguard Worker 
688*f7c14bbaSAndroid Build Coastguard Worker 	/*
689*f7c14bbaSAndroid Build Coastguard Worker 	 * If cap_usr_time_short, the hardware clock is less than 64bit wide
690*f7c14bbaSAndroid Build Coastguard Worker 	 * and we must compute the 'cyc' value, as used by cap_usr_time, as:
691*f7c14bbaSAndroid Build Coastguard Worker 	 *
692*f7c14bbaSAndroid Build Coastguard Worker 	 *   cyc = time_cycles + ((cyc - time_cycles) & time_mask)
693*f7c14bbaSAndroid Build Coastguard Worker 	 *
694*f7c14bbaSAndroid Build Coastguard Worker 	 * NOTE: this form is explicitly chosen such that cap_usr_time_short
695*f7c14bbaSAndroid Build Coastguard Worker 	 *       is a correction on top of cap_usr_time, and code that doesn't
696*f7c14bbaSAndroid Build Coastguard Worker 	 *       know about cap_usr_time_short still works under the assumption
697*f7c14bbaSAndroid Build Coastguard Worker 	 *       the counter doesn't wrap.
698*f7c14bbaSAndroid Build Coastguard Worker 	 */
699*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_cycles;
700*f7c14bbaSAndroid Build Coastguard Worker 	__u64	time_mask;
701*f7c14bbaSAndroid Build Coastguard Worker 
702*f7c14bbaSAndroid Build Coastguard Worker 		/*
703*f7c14bbaSAndroid Build Coastguard Worker 		 * Hole for extension of the self monitor capabilities
704*f7c14bbaSAndroid Build Coastguard Worker 		 */
705*f7c14bbaSAndroid Build Coastguard Worker 
706*f7c14bbaSAndroid Build Coastguard Worker 	__u8	__reserved[116*8];	/* align to 1k. */
707*f7c14bbaSAndroid Build Coastguard Worker 
708*f7c14bbaSAndroid Build Coastguard Worker 	/*
709*f7c14bbaSAndroid Build Coastguard Worker 	 * Control data for the mmap() data buffer.
710*f7c14bbaSAndroid Build Coastguard Worker 	 *
711*f7c14bbaSAndroid Build Coastguard Worker 	 * User-space reading the @data_head value should issue an smp_rmb(),
712*f7c14bbaSAndroid Build Coastguard Worker 	 * after reading this value.
713*f7c14bbaSAndroid Build Coastguard Worker 	 *
714*f7c14bbaSAndroid Build Coastguard Worker 	 * When the mapping is PROT_WRITE the @data_tail value should be
715*f7c14bbaSAndroid Build Coastguard Worker 	 * written by userspace to reflect the last read data, after issueing
716*f7c14bbaSAndroid Build Coastguard Worker 	 * an smp_mb() to separate the data read from the ->data_tail store.
717*f7c14bbaSAndroid Build Coastguard Worker 	 * In this case the kernel will not over-write unread data.
718*f7c14bbaSAndroid Build Coastguard Worker 	 *
719*f7c14bbaSAndroid Build Coastguard Worker 	 * See perf_output_put_handle() for the data ordering.
720*f7c14bbaSAndroid Build Coastguard Worker 	 *
721*f7c14bbaSAndroid Build Coastguard Worker 	 * data_{offset,size} indicate the location and size of the perf record
722*f7c14bbaSAndroid Build Coastguard Worker 	 * buffer within the mmapped area.
723*f7c14bbaSAndroid Build Coastguard Worker 	 */
724*f7c14bbaSAndroid Build Coastguard Worker 	__u64   data_head;		/* head in the data section */
725*f7c14bbaSAndroid Build Coastguard Worker 	__u64	data_tail;		/* user-space written tail */
726*f7c14bbaSAndroid Build Coastguard Worker 	__u64	data_offset;		/* where the buffer starts */
727*f7c14bbaSAndroid Build Coastguard Worker 	__u64	data_size;		/* data buffer size */
728*f7c14bbaSAndroid Build Coastguard Worker 
729*f7c14bbaSAndroid Build Coastguard Worker 	/*
730*f7c14bbaSAndroid Build Coastguard Worker 	 * AUX area is defined by aux_{offset,size} fields that should be set
731*f7c14bbaSAndroid Build Coastguard Worker 	 * by the userspace, so that
732*f7c14bbaSAndroid Build Coastguard Worker 	 *
733*f7c14bbaSAndroid Build Coastguard Worker 	 *   aux_offset >= data_offset + data_size
734*f7c14bbaSAndroid Build Coastguard Worker 	 *
735*f7c14bbaSAndroid Build Coastguard Worker 	 * prior to mmap()ing it. Size of the mmap()ed area should be aux_size.
736*f7c14bbaSAndroid Build Coastguard Worker 	 *
737*f7c14bbaSAndroid Build Coastguard Worker 	 * Ring buffer pointers aux_{head,tail} have the same semantics as
738*f7c14bbaSAndroid Build Coastguard Worker 	 * data_{head,tail} and same ordering rules apply.
739*f7c14bbaSAndroid Build Coastguard Worker 	 */
740*f7c14bbaSAndroid Build Coastguard Worker 	__u64	aux_head;
741*f7c14bbaSAndroid Build Coastguard Worker 	__u64	aux_tail;
742*f7c14bbaSAndroid Build Coastguard Worker 	__u64	aux_offset;
743*f7c14bbaSAndroid Build Coastguard Worker 	__u64	aux_size;
744*f7c14bbaSAndroid Build Coastguard Worker };
745*f7c14bbaSAndroid Build Coastguard Worker 
746*f7c14bbaSAndroid Build Coastguard Worker /*
747*f7c14bbaSAndroid Build Coastguard Worker  * The current state of perf_event_header::misc bits usage:
748*f7c14bbaSAndroid Build Coastguard Worker  * ('|' used bit, '-' unused bit)
749*f7c14bbaSAndroid Build Coastguard Worker  *
750*f7c14bbaSAndroid Build Coastguard Worker  *  012         CDEF
751*f7c14bbaSAndroid Build Coastguard Worker  *  |||---------||||
752*f7c14bbaSAndroid Build Coastguard Worker  *
753*f7c14bbaSAndroid Build Coastguard Worker  *  Where:
754*f7c14bbaSAndroid Build Coastguard Worker  *    0-2     CPUMODE_MASK
755*f7c14bbaSAndroid Build Coastguard Worker  *
756*f7c14bbaSAndroid Build Coastguard Worker  *    C       PROC_MAP_PARSE_TIMEOUT
757*f7c14bbaSAndroid Build Coastguard Worker  *    D       MMAP_DATA / COMM_EXEC / FORK_EXEC / SWITCH_OUT
758*f7c14bbaSAndroid Build Coastguard Worker  *    E       MMAP_BUILD_ID / EXACT_IP / SCHED_OUT_PREEMPT
759*f7c14bbaSAndroid Build Coastguard Worker  *    F       (reserved)
760*f7c14bbaSAndroid Build Coastguard Worker  */
761*f7c14bbaSAndroid Build Coastguard Worker 
762*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_CPUMODE_MASK		(7 << 0)
763*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_CPUMODE_UNKNOWN	(0 << 0)
764*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_KERNEL			(1 << 0)
765*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_USER			(2 << 0)
766*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_HYPERVISOR		(3 << 0)
767*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_GUEST_KERNEL		(4 << 0)
768*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_GUEST_USER		(5 << 0)
769*f7c14bbaSAndroid Build Coastguard Worker 
770*f7c14bbaSAndroid Build Coastguard Worker /*
771*f7c14bbaSAndroid Build Coastguard Worker  * Indicates that /proc/PID/maps parsing are truncated by time out.
772*f7c14bbaSAndroid Build Coastguard Worker  */
773*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT	(1 << 12)
774*f7c14bbaSAndroid Build Coastguard Worker /*
775*f7c14bbaSAndroid Build Coastguard Worker  * Following PERF_RECORD_MISC_* are used on different
776*f7c14bbaSAndroid Build Coastguard Worker  * events, so can reuse the same bit position:
777*f7c14bbaSAndroid Build Coastguard Worker  *
778*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_MMAP_DATA  - PERF_RECORD_MMAP* events
779*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_COMM_EXEC  - PERF_RECORD_COMM event
780*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_FORK_EXEC  - PERF_RECORD_FORK event (perf internal)
781*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_SWITCH_OUT - PERF_RECORD_SWITCH* events
782*f7c14bbaSAndroid Build Coastguard Worker  */
783*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_MMAP_DATA		(1 << 13)
784*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_COMM_EXEC		(1 << 13)
785*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_FORK_EXEC		(1 << 13)
786*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_SWITCH_OUT		(1 << 13)
787*f7c14bbaSAndroid Build Coastguard Worker /*
788*f7c14bbaSAndroid Build Coastguard Worker  * These PERF_RECORD_MISC_* flags below are safely reused
789*f7c14bbaSAndroid Build Coastguard Worker  * for the following events:
790*f7c14bbaSAndroid Build Coastguard Worker  *
791*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_EXACT_IP           - PERF_RECORD_SAMPLE of precise events
792*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_SWITCH_OUT_PREEMPT - PERF_RECORD_SWITCH* events
793*f7c14bbaSAndroid Build Coastguard Worker  *   PERF_RECORD_MISC_MMAP_BUILD_ID      - PERF_RECORD_MMAP2 event
794*f7c14bbaSAndroid Build Coastguard Worker  *
795*f7c14bbaSAndroid Build Coastguard Worker  *
796*f7c14bbaSAndroid Build Coastguard Worker  * PERF_RECORD_MISC_EXACT_IP:
797*f7c14bbaSAndroid Build Coastguard Worker  *   Indicates that the content of PERF_SAMPLE_IP points to
798*f7c14bbaSAndroid Build Coastguard Worker  *   the actual instruction that triggered the event. See also
799*f7c14bbaSAndroid Build Coastguard Worker  *   perf_event_attr::precise_ip.
800*f7c14bbaSAndroid Build Coastguard Worker  *
801*f7c14bbaSAndroid Build Coastguard Worker  * PERF_RECORD_MISC_SWITCH_OUT_PREEMPT:
802*f7c14bbaSAndroid Build Coastguard Worker  *   Indicates that thread was preempted in TASK_RUNNING state.
803*f7c14bbaSAndroid Build Coastguard Worker  *
804*f7c14bbaSAndroid Build Coastguard Worker  * PERF_RECORD_MISC_MMAP_BUILD_ID:
805*f7c14bbaSAndroid Build Coastguard Worker  *   Indicates that mmap2 event carries build id data.
806*f7c14bbaSAndroid Build Coastguard Worker  */
807*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_EXACT_IP		(1 << 14)
808*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_SWITCH_OUT_PREEMPT	(1 << 14)
809*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_MMAP_BUILD_ID		(1 << 14)
810*f7c14bbaSAndroid Build Coastguard Worker /*
811*f7c14bbaSAndroid Build Coastguard Worker  * Reserve the last bit to indicate some extended misc field
812*f7c14bbaSAndroid Build Coastguard Worker  */
813*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_MISC_EXT_RESERVED		(1 << 15)
814*f7c14bbaSAndroid Build Coastguard Worker 
815*f7c14bbaSAndroid Build Coastguard Worker struct perf_event_header {
816*f7c14bbaSAndroid Build Coastguard Worker 	__u32	type;
817*f7c14bbaSAndroid Build Coastguard Worker 	__u16	misc;
818*f7c14bbaSAndroid Build Coastguard Worker 	__u16	size;
819*f7c14bbaSAndroid Build Coastguard Worker };
820*f7c14bbaSAndroid Build Coastguard Worker 
821*f7c14bbaSAndroid Build Coastguard Worker struct perf_ns_link_info {
822*f7c14bbaSAndroid Build Coastguard Worker 	__u64	dev;
823*f7c14bbaSAndroid Build Coastguard Worker 	__u64	ino;
824*f7c14bbaSAndroid Build Coastguard Worker };
825*f7c14bbaSAndroid Build Coastguard Worker 
826*f7c14bbaSAndroid Build Coastguard Worker enum {
827*f7c14bbaSAndroid Build Coastguard Worker 	NET_NS_INDEX		= 0,
828*f7c14bbaSAndroid Build Coastguard Worker 	UTS_NS_INDEX		= 1,
829*f7c14bbaSAndroid Build Coastguard Worker 	IPC_NS_INDEX		= 2,
830*f7c14bbaSAndroid Build Coastguard Worker 	PID_NS_INDEX		= 3,
831*f7c14bbaSAndroid Build Coastguard Worker 	USER_NS_INDEX		= 4,
832*f7c14bbaSAndroid Build Coastguard Worker 	MNT_NS_INDEX		= 5,
833*f7c14bbaSAndroid Build Coastguard Worker 	CGROUP_NS_INDEX		= 6,
834*f7c14bbaSAndroid Build Coastguard Worker 
835*f7c14bbaSAndroid Build Coastguard Worker 	NR_NAMESPACES,		/* number of available namespaces */
836*f7c14bbaSAndroid Build Coastguard Worker };
837*f7c14bbaSAndroid Build Coastguard Worker 
838*f7c14bbaSAndroid Build Coastguard Worker enum perf_event_type {
839*f7c14bbaSAndroid Build Coastguard Worker 
840*f7c14bbaSAndroid Build Coastguard Worker 	/*
841*f7c14bbaSAndroid Build Coastguard Worker 	 * If perf_event_attr.sample_id_all is set then all event types will
842*f7c14bbaSAndroid Build Coastguard Worker 	 * have the sample_type selected fields related to where/when
843*f7c14bbaSAndroid Build Coastguard Worker 	 * (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU,
844*f7c14bbaSAndroid Build Coastguard Worker 	 * IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed
845*f7c14bbaSAndroid Build Coastguard Worker 	 * just after the perf_event_header and the fields already present for
846*f7c14bbaSAndroid Build Coastguard Worker 	 * the existing fields, i.e. at the end of the payload. That way a newer
847*f7c14bbaSAndroid Build Coastguard Worker 	 * perf.data file will be supported by older perf tools, with these new
848*f7c14bbaSAndroid Build Coastguard Worker 	 * optional fields being ignored.
849*f7c14bbaSAndroid Build Coastguard Worker 	 *
850*f7c14bbaSAndroid Build Coastguard Worker 	 * struct sample_id {
851*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u32			pid, tid; } && PERF_SAMPLE_TID
852*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u64			time;     } && PERF_SAMPLE_TIME
853*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u64			id;       } && PERF_SAMPLE_ID
854*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
855*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u32			cpu, res; } && PERF_SAMPLE_CPU
856*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			id;	  } && PERF_SAMPLE_IDENTIFIER
857*f7c14bbaSAndroid Build Coastguard Worker 	 * } && perf_event_attr::sample_id_all
858*f7c14bbaSAndroid Build Coastguard Worker 	 *
859*f7c14bbaSAndroid Build Coastguard Worker 	 * Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.  The
860*f7c14bbaSAndroid Build Coastguard Worker 	 * advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed
861*f7c14bbaSAndroid Build Coastguard Worker 	 * relative to header.size.
862*f7c14bbaSAndroid Build Coastguard Worker 	 */
863*f7c14bbaSAndroid Build Coastguard Worker 
864*f7c14bbaSAndroid Build Coastguard Worker 	/*
865*f7c14bbaSAndroid Build Coastguard Worker 	 * The MMAP events record the PROT_EXEC mappings so that we can
866*f7c14bbaSAndroid Build Coastguard Worker 	 * correlate userspace IPs to code. They have the following structure:
867*f7c14bbaSAndroid Build Coastguard Worker 	 *
868*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
869*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
870*f7c14bbaSAndroid Build Coastguard Worker 	 *
871*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, tid;
872*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				addr;
873*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				len;
874*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				pgoff;
875*f7c14bbaSAndroid Build Coastguard Worker 	 *	char				filename[];
876*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
877*f7c14bbaSAndroid Build Coastguard Worker 	 * };
878*f7c14bbaSAndroid Build Coastguard Worker 	 */
879*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_MMAP			= 1,
880*f7c14bbaSAndroid Build Coastguard Worker 
881*f7c14bbaSAndroid Build Coastguard Worker 	/*
882*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
883*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
884*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				id;
885*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				lost;
886*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
887*f7c14bbaSAndroid Build Coastguard Worker 	 * };
888*f7c14bbaSAndroid Build Coastguard Worker 	 */
889*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_LOST			= 2,
890*f7c14bbaSAndroid Build Coastguard Worker 
891*f7c14bbaSAndroid Build Coastguard Worker 	/*
892*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
893*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
894*f7c14bbaSAndroid Build Coastguard Worker 	 *
895*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, tid;
896*f7c14bbaSAndroid Build Coastguard Worker 	 *	char				comm[];
897*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
898*f7c14bbaSAndroid Build Coastguard Worker 	 * };
899*f7c14bbaSAndroid Build Coastguard Worker 	 */
900*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_COMM			= 3,
901*f7c14bbaSAndroid Build Coastguard Worker 
902*f7c14bbaSAndroid Build Coastguard Worker 	/*
903*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
904*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
905*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, ppid;
906*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				tid, ptid;
907*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				time;
908*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
909*f7c14bbaSAndroid Build Coastguard Worker 	 * };
910*f7c14bbaSAndroid Build Coastguard Worker 	 */
911*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_EXIT			= 4,
912*f7c14bbaSAndroid Build Coastguard Worker 
913*f7c14bbaSAndroid Build Coastguard Worker 	/*
914*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
915*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
916*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				time;
917*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				id;
918*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				stream_id;
919*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
920*f7c14bbaSAndroid Build Coastguard Worker 	 * };
921*f7c14bbaSAndroid Build Coastguard Worker 	 */
922*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_THROTTLE			= 5,
923*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_UNTHROTTLE			= 6,
924*f7c14bbaSAndroid Build Coastguard Worker 
925*f7c14bbaSAndroid Build Coastguard Worker 	/*
926*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
927*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
928*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, ppid;
929*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				tid, ptid;
930*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				time;
931*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
932*f7c14bbaSAndroid Build Coastguard Worker 	 * };
933*f7c14bbaSAndroid Build Coastguard Worker 	 */
934*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_FORK			= 7,
935*f7c14bbaSAndroid Build Coastguard Worker 
936*f7c14bbaSAndroid Build Coastguard Worker 	/*
937*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
938*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
939*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, tid;
940*f7c14bbaSAndroid Build Coastguard Worker 	 *
941*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct read_format		values;
942*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
943*f7c14bbaSAndroid Build Coastguard Worker 	 * };
944*f7c14bbaSAndroid Build Coastguard Worker 	 */
945*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_READ			= 8,
946*f7c14bbaSAndroid Build Coastguard Worker 
947*f7c14bbaSAndroid Build Coastguard Worker 	/*
948*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
949*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
950*f7c14bbaSAndroid Build Coastguard Worker 	 *
951*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
952*f7c14bbaSAndroid Build Coastguard Worker 	 *	# Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID.
953*f7c14bbaSAndroid Build Coastguard Worker 	 *	# The advantage of PERF_SAMPLE_IDENTIFIER is that its position
954*f7c14bbaSAndroid Build Coastguard Worker 	 *	# is fixed relative to header.
955*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
956*f7c14bbaSAndroid Build Coastguard Worker 	 *
957*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			id;	  } && PERF_SAMPLE_IDENTIFIER
958*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			ip;	  } && PERF_SAMPLE_IP
959*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u32			pid, tid; } && PERF_SAMPLE_TID
960*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			time;     } && PERF_SAMPLE_TIME
961*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			addr;     } && PERF_SAMPLE_ADDR
962*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			id;	  } && PERF_SAMPLE_ID
963*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			stream_id;} && PERF_SAMPLE_STREAM_ID
964*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u32			cpu, res; } && PERF_SAMPLE_CPU
965*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			period;   } && PERF_SAMPLE_PERIOD
966*f7c14bbaSAndroid Build Coastguard Worker 	 *
967*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ struct read_format	values;	  } && PERF_SAMPLE_READ
968*f7c14bbaSAndroid Build Coastguard Worker 	 *
969*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			nr,
970*f7c14bbaSAndroid Build Coastguard Worker 	 *	  u64			ips[nr];  } && PERF_SAMPLE_CALLCHAIN
971*f7c14bbaSAndroid Build Coastguard Worker 	 *
972*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
973*f7c14bbaSAndroid Build Coastguard Worker 	 *	# The RAW record below is opaque data wrt the ABI
974*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
975*f7c14bbaSAndroid Build Coastguard Worker 	 *	# That is, the ABI doesn't make any promises wrt to
976*f7c14bbaSAndroid Build Coastguard Worker 	 *	# the stability of its content, it may vary depending
977*f7c14bbaSAndroid Build Coastguard Worker 	 *	# on event, hardware, kernel version and phase of
978*f7c14bbaSAndroid Build Coastguard Worker 	 *	# the moon.
979*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
980*f7c14bbaSAndroid Build Coastguard Worker 	 *	# In other words, PERF_SAMPLE_RAW contents are not an ABI.
981*f7c14bbaSAndroid Build Coastguard Worker 	 *	#
982*f7c14bbaSAndroid Build Coastguard Worker 	 *
983*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u32			size;
984*f7c14bbaSAndroid Build Coastguard Worker 	 *	  char                  data[size];}&& PERF_SAMPLE_RAW
985*f7c14bbaSAndroid Build Coastguard Worker 	 *
986*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64                   nr;
987*f7c14bbaSAndroid Build Coastguard Worker 	 *	  { u64	hw_idx; } && PERF_SAMPLE_BRANCH_HW_INDEX
988*f7c14bbaSAndroid Build Coastguard Worker 	 *        { u64 from, to, flags } lbr[nr];
989*f7c14bbaSAndroid Build Coastguard Worker 	 *        #
990*f7c14bbaSAndroid Build Coastguard Worker 	 *        # The format of the counters is decided by the
991*f7c14bbaSAndroid Build Coastguard Worker 	 *        # "branch_counter_nr" and "branch_counter_width",
992*f7c14bbaSAndroid Build Coastguard Worker 	 *        # which are defined in the ABI.
993*f7c14bbaSAndroid Build Coastguard Worker 	 *        #
994*f7c14bbaSAndroid Build Coastguard Worker 	 *        { u64 counters; } cntr[nr] && PERF_SAMPLE_BRANCH_COUNTERS
995*f7c14bbaSAndroid Build Coastguard Worker 	 *      } && PERF_SAMPLE_BRANCH_STACK
996*f7c14bbaSAndroid Build Coastguard Worker 	 *
997*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u64			abi; # enum perf_sample_regs_abi
998*f7c14bbaSAndroid Build Coastguard Worker 	 * 	  u64			regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
999*f7c14bbaSAndroid Build Coastguard Worker 	 *
1000*f7c14bbaSAndroid Build Coastguard Worker 	 * 	{ u64			size;
1001*f7c14bbaSAndroid Build Coastguard Worker 	 * 	  char			data[size];
1002*f7c14bbaSAndroid Build Coastguard Worker 	 * 	  u64			dyn_size; } && PERF_SAMPLE_STACK_USER
1003*f7c14bbaSAndroid Build Coastguard Worker 	 *
1004*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ union perf_sample_weight
1005*f7c14bbaSAndroid Build Coastguard Worker 	 *	 {
1006*f7c14bbaSAndroid Build Coastguard Worker 	 *		u64		full; && PERF_SAMPLE_WEIGHT
1007*f7c14bbaSAndroid Build Coastguard Worker 	 *	#if defined(__LITTLE_ENDIAN_BITFIELD)
1008*f7c14bbaSAndroid Build Coastguard Worker 	 *		struct {
1009*f7c14bbaSAndroid Build Coastguard Worker 	 *			u32	var1_dw;
1010*f7c14bbaSAndroid Build Coastguard Worker 	 *			u16	var2_w;
1011*f7c14bbaSAndroid Build Coastguard Worker 	 *			u16	var3_w;
1012*f7c14bbaSAndroid Build Coastguard Worker 	 *		} && PERF_SAMPLE_WEIGHT_STRUCT
1013*f7c14bbaSAndroid Build Coastguard Worker 	 *	#elif defined(__BIG_ENDIAN_BITFIELD)
1014*f7c14bbaSAndroid Build Coastguard Worker 	 *		struct {
1015*f7c14bbaSAndroid Build Coastguard Worker 	 *			u16	var3_w;
1016*f7c14bbaSAndroid Build Coastguard Worker 	 *			u16	var2_w;
1017*f7c14bbaSAndroid Build Coastguard Worker 	 *			u32	var1_dw;
1018*f7c14bbaSAndroid Build Coastguard Worker 	 *		} && PERF_SAMPLE_WEIGHT_STRUCT
1019*f7c14bbaSAndroid Build Coastguard Worker 	 *	#endif
1020*f7c14bbaSAndroid Build Coastguard Worker 	 *	 }
1021*f7c14bbaSAndroid Build Coastguard Worker 	 *	}
1022*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			data_src; } && PERF_SAMPLE_DATA_SRC
1023*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			transaction; } && PERF_SAMPLE_TRANSACTION
1024*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			abi; # enum perf_sample_regs_abi
1025*f7c14bbaSAndroid Build Coastguard Worker 	 *	  u64			regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR
1026*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			phys_addr;} && PERF_SAMPLE_PHYS_ADDR
1027*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			size;
1028*f7c14bbaSAndroid Build Coastguard Worker 	 *	  char			data[size]; } && PERF_SAMPLE_AUX
1029*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			data_page_size;} && PERF_SAMPLE_DATA_PAGE_SIZE
1030*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64			code_page_size;} && PERF_SAMPLE_CODE_PAGE_SIZE
1031*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1032*f7c14bbaSAndroid Build Coastguard Worker 	 */
1033*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_SAMPLE			= 9,
1034*f7c14bbaSAndroid Build Coastguard Worker 
1035*f7c14bbaSAndroid Build Coastguard Worker 	/*
1036*f7c14bbaSAndroid Build Coastguard Worker 	 * The MMAP2 records are an augmented version of MMAP, they add
1037*f7c14bbaSAndroid Build Coastguard Worker 	 * maj, min, ino numbers to be used to uniquely identify each mapping
1038*f7c14bbaSAndroid Build Coastguard Worker 	 *
1039*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1040*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1041*f7c14bbaSAndroid Build Coastguard Worker 	 *
1042*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid, tid;
1043*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				addr;
1044*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				len;
1045*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				pgoff;
1046*f7c14bbaSAndroid Build Coastguard Worker 	 *	union {
1047*f7c14bbaSAndroid Build Coastguard Worker 	 *		struct {
1048*f7c14bbaSAndroid Build Coastguard Worker 	 *			u32		maj;
1049*f7c14bbaSAndroid Build Coastguard Worker 	 *			u32		min;
1050*f7c14bbaSAndroid Build Coastguard Worker 	 *			u64		ino;
1051*f7c14bbaSAndroid Build Coastguard Worker 	 *			u64		ino_generation;
1052*f7c14bbaSAndroid Build Coastguard Worker 	 *		};
1053*f7c14bbaSAndroid Build Coastguard Worker 	 *		struct {
1054*f7c14bbaSAndroid Build Coastguard Worker 	 *			u8		build_id_size;
1055*f7c14bbaSAndroid Build Coastguard Worker 	 *			u8		__reserved_1;
1056*f7c14bbaSAndroid Build Coastguard Worker 	 *			u16		__reserved_2;
1057*f7c14bbaSAndroid Build Coastguard Worker 	 *			u8		build_id[20];
1058*f7c14bbaSAndroid Build Coastguard Worker 	 *		};
1059*f7c14bbaSAndroid Build Coastguard Worker 	 *	};
1060*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				prot, flags;
1061*f7c14bbaSAndroid Build Coastguard Worker 	 *	char				filename[];
1062*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
1063*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1064*f7c14bbaSAndroid Build Coastguard Worker 	 */
1065*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_MMAP2			= 10,
1066*f7c14bbaSAndroid Build Coastguard Worker 
1067*f7c14bbaSAndroid Build Coastguard Worker 	/*
1068*f7c14bbaSAndroid Build Coastguard Worker 	 * Records that new data landed in the AUX buffer part.
1069*f7c14bbaSAndroid Build Coastguard Worker 	 *
1070*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1071*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct perf_event_header	header;
1072*f7c14bbaSAndroid Build Coastguard Worker 	 *
1073*f7c14bbaSAndroid Build Coastguard Worker 	 * 	u64				aux_offset;
1074*f7c14bbaSAndroid Build Coastguard Worker 	 * 	u64				aux_size;
1075*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				flags;
1076*f7c14bbaSAndroid Build Coastguard Worker 	 * 	struct sample_id		sample_id;
1077*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1078*f7c14bbaSAndroid Build Coastguard Worker 	 */
1079*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_AUX				= 11,
1080*f7c14bbaSAndroid Build Coastguard Worker 
1081*f7c14bbaSAndroid Build Coastguard Worker 	/*
1082*f7c14bbaSAndroid Build Coastguard Worker 	 * Indicates that instruction trace has started
1083*f7c14bbaSAndroid Build Coastguard Worker 	 *
1084*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1085*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1086*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid;
1087*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				tid;
1088*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1089*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1090*f7c14bbaSAndroid Build Coastguard Worker 	 */
1091*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_ITRACE_START		= 12,
1092*f7c14bbaSAndroid Build Coastguard Worker 
1093*f7c14bbaSAndroid Build Coastguard Worker 	/*
1094*f7c14bbaSAndroid Build Coastguard Worker 	 * Records the dropped/lost sample number.
1095*f7c14bbaSAndroid Build Coastguard Worker 	 *
1096*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1097*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1098*f7c14bbaSAndroid Build Coastguard Worker 	 *
1099*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				lost;
1100*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1101*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1102*f7c14bbaSAndroid Build Coastguard Worker 	 */
1103*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_LOST_SAMPLES		= 13,
1104*f7c14bbaSAndroid Build Coastguard Worker 
1105*f7c14bbaSAndroid Build Coastguard Worker 	/*
1106*f7c14bbaSAndroid Build Coastguard Worker 	 * Records a context switch in or out (flagged by
1107*f7c14bbaSAndroid Build Coastguard Worker 	 * PERF_RECORD_MISC_SWITCH_OUT). See also
1108*f7c14bbaSAndroid Build Coastguard Worker 	 * PERF_RECORD_SWITCH_CPU_WIDE.
1109*f7c14bbaSAndroid Build Coastguard Worker 	 *
1110*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1111*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1112*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1113*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1114*f7c14bbaSAndroid Build Coastguard Worker 	 */
1115*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_SWITCH			= 14,
1116*f7c14bbaSAndroid Build Coastguard Worker 
1117*f7c14bbaSAndroid Build Coastguard Worker 	/*
1118*f7c14bbaSAndroid Build Coastguard Worker 	 * CPU-wide version of PERF_RECORD_SWITCH with next_prev_pid and
1119*f7c14bbaSAndroid Build Coastguard Worker 	 * next_prev_tid that are the next (switching out) or previous
1120*f7c14bbaSAndroid Build Coastguard Worker 	 * (switching in) pid/tid.
1121*f7c14bbaSAndroid Build Coastguard Worker 	 *
1122*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1123*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1124*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				next_prev_pid;
1125*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				next_prev_tid;
1126*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1127*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1128*f7c14bbaSAndroid Build Coastguard Worker 	 */
1129*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_SWITCH_CPU_WIDE		= 15,
1130*f7c14bbaSAndroid Build Coastguard Worker 
1131*f7c14bbaSAndroid Build Coastguard Worker 	/*
1132*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1133*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1134*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				pid;
1135*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				tid;
1136*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				nr_namespaces;
1137*f7c14bbaSAndroid Build Coastguard Worker 	 *	{ u64				dev, inode; } [nr_namespaces];
1138*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1139*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1140*f7c14bbaSAndroid Build Coastguard Worker 	 */
1141*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_NAMESPACES			= 16,
1142*f7c14bbaSAndroid Build Coastguard Worker 
1143*f7c14bbaSAndroid Build Coastguard Worker 	/*
1144*f7c14bbaSAndroid Build Coastguard Worker 	 * Record ksymbol register/unregister events:
1145*f7c14bbaSAndroid Build Coastguard Worker 	 *
1146*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1147*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1148*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				addr;
1149*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				len;
1150*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				ksym_type;
1151*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				flags;
1152*f7c14bbaSAndroid Build Coastguard Worker 	 *	char				name[];
1153*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1154*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1155*f7c14bbaSAndroid Build Coastguard Worker 	 */
1156*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_KSYMBOL			= 17,
1157*f7c14bbaSAndroid Build Coastguard Worker 
1158*f7c14bbaSAndroid Build Coastguard Worker 	/*
1159*f7c14bbaSAndroid Build Coastguard Worker 	 * Record bpf events:
1160*f7c14bbaSAndroid Build Coastguard Worker 	 *  enum perf_bpf_event_type {
1161*f7c14bbaSAndroid Build Coastguard Worker 	 *	PERF_BPF_EVENT_UNKNOWN		= 0,
1162*f7c14bbaSAndroid Build Coastguard Worker 	 *	PERF_BPF_EVENT_PROG_LOAD	= 1,
1163*f7c14bbaSAndroid Build Coastguard Worker 	 *	PERF_BPF_EVENT_PROG_UNLOAD	= 2,
1164*f7c14bbaSAndroid Build Coastguard Worker 	 *  };
1165*f7c14bbaSAndroid Build Coastguard Worker 	 *
1166*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1167*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1168*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				type;
1169*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				flags;
1170*f7c14bbaSAndroid Build Coastguard Worker 	 *	u32				id;
1171*f7c14bbaSAndroid Build Coastguard Worker 	 *	u8				tag[BPF_TAG_SIZE];
1172*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1173*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1174*f7c14bbaSAndroid Build Coastguard Worker 	 */
1175*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_BPF_EVENT			= 18,
1176*f7c14bbaSAndroid Build Coastguard Worker 
1177*f7c14bbaSAndroid Build Coastguard Worker 	/*
1178*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1179*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1180*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				id;
1181*f7c14bbaSAndroid Build Coastguard Worker 	 *	char				path[];
1182*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1183*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1184*f7c14bbaSAndroid Build Coastguard Worker 	 */
1185*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_CGROUP			= 19,
1186*f7c14bbaSAndroid Build Coastguard Worker 
1187*f7c14bbaSAndroid Build Coastguard Worker 	/*
1188*f7c14bbaSAndroid Build Coastguard Worker 	 * Records changes to kernel text i.e. self-modified code. 'old_len' is
1189*f7c14bbaSAndroid Build Coastguard Worker 	 * the number of old bytes, 'new_len' is the number of new bytes. Either
1190*f7c14bbaSAndroid Build Coastguard Worker 	 * 'old_len' or 'new_len' may be zero to indicate, for example, the
1191*f7c14bbaSAndroid Build Coastguard Worker 	 * addition or removal of a trampoline. 'bytes' contains the old bytes
1192*f7c14bbaSAndroid Build Coastguard Worker 	 * followed immediately by the new bytes.
1193*f7c14bbaSAndroid Build Coastguard Worker 	 *
1194*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1195*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1196*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				addr;
1197*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				old_len;
1198*f7c14bbaSAndroid Build Coastguard Worker 	 *	u16				new_len;
1199*f7c14bbaSAndroid Build Coastguard Worker 	 *	u8				bytes[];
1200*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1201*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1202*f7c14bbaSAndroid Build Coastguard Worker 	 */
1203*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_TEXT_POKE			= 20,
1204*f7c14bbaSAndroid Build Coastguard Worker 
1205*f7c14bbaSAndroid Build Coastguard Worker 	/*
1206*f7c14bbaSAndroid Build Coastguard Worker 	 * Data written to the AUX area by hardware due to aux_output, may need
1207*f7c14bbaSAndroid Build Coastguard Worker 	 * to be matched to the event by an architecture-specific hardware ID.
1208*f7c14bbaSAndroid Build Coastguard Worker 	 * This records the hardware ID, but requires sample_id to provide the
1209*f7c14bbaSAndroid Build Coastguard Worker 	 * event ID. e.g. Intel PT uses this record to disambiguate PEBS-via-PT
1210*f7c14bbaSAndroid Build Coastguard Worker 	 * records from multiple events.
1211*f7c14bbaSAndroid Build Coastguard Worker 	 *
1212*f7c14bbaSAndroid Build Coastguard Worker 	 * struct {
1213*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct perf_event_header	header;
1214*f7c14bbaSAndroid Build Coastguard Worker 	 *	u64				hw_id;
1215*f7c14bbaSAndroid Build Coastguard Worker 	 *	struct sample_id		sample_id;
1216*f7c14bbaSAndroid Build Coastguard Worker 	 * };
1217*f7c14bbaSAndroid Build Coastguard Worker 	 */
1218*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_AUX_OUTPUT_HW_ID		= 21,
1219*f7c14bbaSAndroid Build Coastguard Worker 
1220*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_MAX,			/* non-ABI */
1221*f7c14bbaSAndroid Build Coastguard Worker };
1222*f7c14bbaSAndroid Build Coastguard Worker 
1223*f7c14bbaSAndroid Build Coastguard Worker enum perf_record_ksymbol_type {
1224*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_KSYMBOL_TYPE_UNKNOWN	= 0,
1225*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_KSYMBOL_TYPE_BPF		= 1,
1226*f7c14bbaSAndroid Build Coastguard Worker 	/*
1227*f7c14bbaSAndroid Build Coastguard Worker 	 * Out of line code such as kprobe-replaced instructions or optimized
1228*f7c14bbaSAndroid Build Coastguard Worker 	 * kprobes or ftrace trampolines.
1229*f7c14bbaSAndroid Build Coastguard Worker 	 */
1230*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_KSYMBOL_TYPE_OOL		= 2,
1231*f7c14bbaSAndroid Build Coastguard Worker 	PERF_RECORD_KSYMBOL_TYPE_MAX		/* non-ABI */
1232*f7c14bbaSAndroid Build Coastguard Worker };
1233*f7c14bbaSAndroid Build Coastguard Worker 
1234*f7c14bbaSAndroid Build Coastguard Worker #define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER	(1 << 0)
1235*f7c14bbaSAndroid Build Coastguard Worker 
1236*f7c14bbaSAndroid Build Coastguard Worker enum perf_bpf_event_type {
1237*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BPF_EVENT_UNKNOWN		= 0,
1238*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BPF_EVENT_PROG_LOAD	= 1,
1239*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BPF_EVENT_PROG_UNLOAD	= 2,
1240*f7c14bbaSAndroid Build Coastguard Worker 	PERF_BPF_EVENT_MAX,		/* non-ABI */
1241*f7c14bbaSAndroid Build Coastguard Worker };
1242*f7c14bbaSAndroid Build Coastguard Worker 
1243*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MAX_STACK_DEPTH		127
1244*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MAX_CONTEXTS_PER_STACK	  8
1245*f7c14bbaSAndroid Build Coastguard Worker 
1246*f7c14bbaSAndroid Build Coastguard Worker enum perf_callchain_context {
1247*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_HV			= (__u64)-32,
1248*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_KERNEL		= (__u64)-128,
1249*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_USER		= (__u64)-512,
1250*f7c14bbaSAndroid Build Coastguard Worker 
1251*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_GUEST		= (__u64)-2048,
1252*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_GUEST_KERNEL	= (__u64)-2176,
1253*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_GUEST_USER		= (__u64)-2560,
1254*f7c14bbaSAndroid Build Coastguard Worker 
1255*f7c14bbaSAndroid Build Coastguard Worker 	PERF_CONTEXT_MAX		= (__u64)-4095,
1256*f7c14bbaSAndroid Build Coastguard Worker };
1257*f7c14bbaSAndroid Build Coastguard Worker 
1258*f7c14bbaSAndroid Build Coastguard Worker /**
1259*f7c14bbaSAndroid Build Coastguard Worker  * PERF_RECORD_AUX::flags bits
1260*f7c14bbaSAndroid Build Coastguard Worker  */
1261*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_TRUNCATED			0x01	/* record was truncated to fit */
1262*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_OVERWRITE			0x02	/* snapshot from overwrite mode */
1263*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_PARTIAL			0x04	/* record contains gaps */
1264*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_COLLISION			0x08	/* sample collided with another */
1265*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK	0xff00	/* PMU specific trace format type */
1266*f7c14bbaSAndroid Build Coastguard Worker 
1267*f7c14bbaSAndroid Build Coastguard Worker /* CoreSight PMU AUX buffer formats */
1268*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT	0x0000 /* Default for backward compatibility */
1269*f7c14bbaSAndroid Build Coastguard Worker #define PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW		0x0100 /* Raw format of the source */
1270*f7c14bbaSAndroid Build Coastguard Worker 
1271*f7c14bbaSAndroid Build Coastguard Worker #define PERF_FLAG_FD_NO_GROUP		(1UL << 0)
1272*f7c14bbaSAndroid Build Coastguard Worker #define PERF_FLAG_FD_OUTPUT		(1UL << 1)
1273*f7c14bbaSAndroid Build Coastguard Worker #define PERF_FLAG_PID_CGROUP		(1UL << 2) /* pid=cgroup id, per-cpu mode only */
1274*f7c14bbaSAndroid Build Coastguard Worker #define PERF_FLAG_FD_CLOEXEC		(1UL << 3) /* O_CLOEXEC */
1275*f7c14bbaSAndroid Build Coastguard Worker 
1276*f7c14bbaSAndroid Build Coastguard Worker #if defined(__LITTLE_ENDIAN_BITFIELD)
1277*f7c14bbaSAndroid Build Coastguard Worker union perf_mem_data_src {
1278*f7c14bbaSAndroid Build Coastguard Worker 	__u64 val;
1279*f7c14bbaSAndroid Build Coastguard Worker 	struct {
1280*f7c14bbaSAndroid Build Coastguard Worker 		__u64   mem_op:5,	/* type of opcode */
1281*f7c14bbaSAndroid Build Coastguard Worker 			mem_lvl:14,	/* memory hierarchy level */
1282*f7c14bbaSAndroid Build Coastguard Worker 			mem_snoop:5,	/* snoop mode */
1283*f7c14bbaSAndroid Build Coastguard Worker 			mem_lock:2,	/* lock instr */
1284*f7c14bbaSAndroid Build Coastguard Worker 			mem_dtlb:7,	/* tlb access */
1285*f7c14bbaSAndroid Build Coastguard Worker 			mem_lvl_num:4,	/* memory hierarchy level number */
1286*f7c14bbaSAndroid Build Coastguard Worker 			mem_remote:1,   /* remote */
1287*f7c14bbaSAndroid Build Coastguard Worker 			mem_snoopx:2,	/* snoop mode, ext */
1288*f7c14bbaSAndroid Build Coastguard Worker 			mem_blk:3,	/* access blocked */
1289*f7c14bbaSAndroid Build Coastguard Worker 			mem_hops:3,	/* hop level */
1290*f7c14bbaSAndroid Build Coastguard Worker 			mem_rsvd:18;
1291*f7c14bbaSAndroid Build Coastguard Worker 	};
1292*f7c14bbaSAndroid Build Coastguard Worker };
1293*f7c14bbaSAndroid Build Coastguard Worker #elif defined(__BIG_ENDIAN_BITFIELD)
1294*f7c14bbaSAndroid Build Coastguard Worker union perf_mem_data_src {
1295*f7c14bbaSAndroid Build Coastguard Worker 	__u64 val;
1296*f7c14bbaSAndroid Build Coastguard Worker 	struct {
1297*f7c14bbaSAndroid Build Coastguard Worker 		__u64	mem_rsvd:18,
1298*f7c14bbaSAndroid Build Coastguard Worker 			mem_hops:3,	/* hop level */
1299*f7c14bbaSAndroid Build Coastguard Worker 			mem_blk:3,	/* access blocked */
1300*f7c14bbaSAndroid Build Coastguard Worker 			mem_snoopx:2,	/* snoop mode, ext */
1301*f7c14bbaSAndroid Build Coastguard Worker 			mem_remote:1,   /* remote */
1302*f7c14bbaSAndroid Build Coastguard Worker 			mem_lvl_num:4,	/* memory hierarchy level number */
1303*f7c14bbaSAndroid Build Coastguard Worker 			mem_dtlb:7,	/* tlb access */
1304*f7c14bbaSAndroid Build Coastguard Worker 			mem_lock:2,	/* lock instr */
1305*f7c14bbaSAndroid Build Coastguard Worker 			mem_snoop:5,	/* snoop mode */
1306*f7c14bbaSAndroid Build Coastguard Worker 			mem_lvl:14,	/* memory hierarchy level */
1307*f7c14bbaSAndroid Build Coastguard Worker 			mem_op:5;	/* type of opcode */
1308*f7c14bbaSAndroid Build Coastguard Worker 	};
1309*f7c14bbaSAndroid Build Coastguard Worker };
1310*f7c14bbaSAndroid Build Coastguard Worker #else
1311*f7c14bbaSAndroid Build Coastguard Worker #error "Unknown endianness"
1312*f7c14bbaSAndroid Build Coastguard Worker #endif
1313*f7c14bbaSAndroid Build Coastguard Worker 
1314*f7c14bbaSAndroid Build Coastguard Worker /* type of opcode (load/store/prefetch,code) */
1315*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_NA		0x01 /* not available */
1316*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_LOAD	0x02 /* load instruction */
1317*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_STORE	0x04 /* store instruction */
1318*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_PFETCH	0x08 /* prefetch */
1319*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_EXEC	0x10 /* code (execution) */
1320*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_OP_SHIFT	0
1321*f7c14bbaSAndroid Build Coastguard Worker 
1322*f7c14bbaSAndroid Build Coastguard Worker /*
1323*f7c14bbaSAndroid Build Coastguard Worker  * PERF_MEM_LVL_* namespace being depricated to some extent in the
1324*f7c14bbaSAndroid Build Coastguard Worker  * favour of newer composite PERF_MEM_{LVLNUM_,REMOTE_,SNOOPX_} fields.
1325*f7c14bbaSAndroid Build Coastguard Worker  * Supporting this namespace inorder to not break defined ABIs.
1326*f7c14bbaSAndroid Build Coastguard Worker  *
1327*f7c14bbaSAndroid Build Coastguard Worker  * memory hierarchy (memory level, hit or miss)
1328*f7c14bbaSAndroid Build Coastguard Worker  */
1329*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_NA		0x01  /* not available */
1330*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_HIT	0x02  /* hit level */
1331*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_MISS	0x04  /* miss level  */
1332*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_L1		0x08  /* L1 */
1333*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_LFB	0x10  /* Line Fill Buffer */
1334*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_L2		0x20  /* L2 */
1335*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_L3		0x40  /* L3 */
1336*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_LOC_RAM	0x80  /* Local DRAM */
1337*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_REM_RAM1	0x100 /* Remote DRAM (1 hop) */
1338*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_REM_RAM2	0x200 /* Remote DRAM (2 hops) */
1339*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_REM_CCE1	0x400 /* Remote Cache (1 hop) */
1340*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_REM_CCE2	0x800 /* Remote Cache (2 hops) */
1341*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_IO		0x1000 /* I/O memory */
1342*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_UNC	0x2000 /* Uncached memory */
1343*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVL_SHIFT	5
1344*f7c14bbaSAndroid Build Coastguard Worker 
1345*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_REMOTE_REMOTE	0x01  /* Remote */
1346*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_REMOTE_SHIFT	37
1347*f7c14bbaSAndroid Build Coastguard Worker 
1348*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_L1	0x01 /* L1 */
1349*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_L2	0x02 /* L2 */
1350*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_L3	0x03 /* L3 */
1351*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_L4	0x04 /* L4 */
1352*f7c14bbaSAndroid Build Coastguard Worker /* 5-0x7 available */
1353*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_UNC	0x08 /* Uncached */
1354*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_CXL	0x09 /* CXL */
1355*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_IO	0x0a /* I/O */
1356*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_ANY_CACHE 0x0b /* Any cache */
1357*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_LFB	0x0c /* LFB */
1358*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_RAM	0x0d /* RAM */
1359*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_PMEM	0x0e /* PMEM */
1360*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_NA	0x0f /* N/A */
1361*f7c14bbaSAndroid Build Coastguard Worker 
1362*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LVLNUM_SHIFT	33
1363*f7c14bbaSAndroid Build Coastguard Worker 
1364*f7c14bbaSAndroid Build Coastguard Worker /* snoop mode */
1365*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_NA	0x01 /* not available */
1366*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_NONE	0x02 /* no snoop */
1367*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_HIT	0x04 /* snoop hit */
1368*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_MISS	0x08 /* snoop miss */
1369*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_HITM	0x10 /* snoop hit modified */
1370*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOP_SHIFT	19
1371*f7c14bbaSAndroid Build Coastguard Worker 
1372*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOPX_FWD	0x01 /* forward */
1373*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOPX_PEER	0x02 /* xfer from peer */
1374*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_SNOOPX_SHIFT  38
1375*f7c14bbaSAndroid Build Coastguard Worker 
1376*f7c14bbaSAndroid Build Coastguard Worker /* locked instruction */
1377*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LOCK_NA	0x01 /* not available */
1378*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LOCK_LOCKED	0x02 /* locked transaction */
1379*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_LOCK_SHIFT	24
1380*f7c14bbaSAndroid Build Coastguard Worker 
1381*f7c14bbaSAndroid Build Coastguard Worker /* TLB access */
1382*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_NA		0x01 /* not available */
1383*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_HIT	0x02 /* hit level */
1384*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_MISS	0x04 /* miss level */
1385*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_L1		0x08 /* L1 */
1386*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_L2		0x10 /* L2 */
1387*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_WK		0x20 /* Hardware Walker*/
1388*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_OS		0x40 /* OS fault handler */
1389*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_TLB_SHIFT	26
1390*f7c14bbaSAndroid Build Coastguard Worker 
1391*f7c14bbaSAndroid Build Coastguard Worker /* Access blocked */
1392*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_BLK_NA		0x01 /* not available */
1393*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_BLK_DATA	0x02 /* data could not be forwarded */
1394*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_BLK_ADDR	0x04 /* address conflict */
1395*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_BLK_SHIFT	40
1396*f7c14bbaSAndroid Build Coastguard Worker 
1397*f7c14bbaSAndroid Build Coastguard Worker /* hop level */
1398*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_HOPS_0		0x01 /* remote core, same node */
1399*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_HOPS_1		0x02 /* remote node, same socket */
1400*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_HOPS_2		0x03 /* remote socket, same board */
1401*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_HOPS_3		0x04 /* remote board */
1402*f7c14bbaSAndroid Build Coastguard Worker /* 5-7 available */
1403*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_HOPS_SHIFT	43
1404*f7c14bbaSAndroid Build Coastguard Worker 
1405*f7c14bbaSAndroid Build Coastguard Worker #define PERF_MEM_S(a, s) \
1406*f7c14bbaSAndroid Build Coastguard Worker 	(((__u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT)
1407*f7c14bbaSAndroid Build Coastguard Worker 
1408*f7c14bbaSAndroid Build Coastguard Worker /*
1409*f7c14bbaSAndroid Build Coastguard Worker  * single taken branch record layout:
1410*f7c14bbaSAndroid Build Coastguard Worker  *
1411*f7c14bbaSAndroid Build Coastguard Worker  *      from: source instruction (may not always be a branch insn)
1412*f7c14bbaSAndroid Build Coastguard Worker  *        to: branch target
1413*f7c14bbaSAndroid Build Coastguard Worker  *   mispred: branch target was mispredicted
1414*f7c14bbaSAndroid Build Coastguard Worker  * predicted: branch target was predicted
1415*f7c14bbaSAndroid Build Coastguard Worker  *
1416*f7c14bbaSAndroid Build Coastguard Worker  * support for mispred, predicted is optional. In case it
1417*f7c14bbaSAndroid Build Coastguard Worker  * is not supported mispred = predicted = 0.
1418*f7c14bbaSAndroid Build Coastguard Worker  *
1419*f7c14bbaSAndroid Build Coastguard Worker  *     in_tx: running in a hardware transaction
1420*f7c14bbaSAndroid Build Coastguard Worker  *     abort: aborting a hardware transaction
1421*f7c14bbaSAndroid Build Coastguard Worker  *    cycles: cycles from last branch (or 0 if not supported)
1422*f7c14bbaSAndroid Build Coastguard Worker  *      type: branch type
1423*f7c14bbaSAndroid Build Coastguard Worker  *      spec: branch speculation info (or 0 if not supported)
1424*f7c14bbaSAndroid Build Coastguard Worker  */
1425*f7c14bbaSAndroid Build Coastguard Worker struct perf_branch_entry {
1426*f7c14bbaSAndroid Build Coastguard Worker 	__u64	from;
1427*f7c14bbaSAndroid Build Coastguard Worker 	__u64	to;
1428*f7c14bbaSAndroid Build Coastguard Worker 	__u64	mispred:1,  /* target mispredicted */
1429*f7c14bbaSAndroid Build Coastguard Worker 		predicted:1,/* target predicted */
1430*f7c14bbaSAndroid Build Coastguard Worker 		in_tx:1,    /* in transaction */
1431*f7c14bbaSAndroid Build Coastguard Worker 		abort:1,    /* transaction abort */
1432*f7c14bbaSAndroid Build Coastguard Worker 		cycles:16,  /* cycle count to last branch */
1433*f7c14bbaSAndroid Build Coastguard Worker 		type:4,     /* branch type */
1434*f7c14bbaSAndroid Build Coastguard Worker 		spec:2,     /* branch speculation info */
1435*f7c14bbaSAndroid Build Coastguard Worker 		new_type:4, /* additional branch type */
1436*f7c14bbaSAndroid Build Coastguard Worker 		priv:3,     /* privilege level */
1437*f7c14bbaSAndroid Build Coastguard Worker 		reserved:31;
1438*f7c14bbaSAndroid Build Coastguard Worker };
1439*f7c14bbaSAndroid Build Coastguard Worker 
1440*f7c14bbaSAndroid Build Coastguard Worker /* Size of used info bits in struct perf_branch_entry */
1441*f7c14bbaSAndroid Build Coastguard Worker #define PERF_BRANCH_ENTRY_INFO_BITS_MAX		33
1442*f7c14bbaSAndroid Build Coastguard Worker 
1443*f7c14bbaSAndroid Build Coastguard Worker union perf_sample_weight {
1444*f7c14bbaSAndroid Build Coastguard Worker 	__u64		full;
1445*f7c14bbaSAndroid Build Coastguard Worker #if defined(__LITTLE_ENDIAN_BITFIELD)
1446*f7c14bbaSAndroid Build Coastguard Worker 	struct {
1447*f7c14bbaSAndroid Build Coastguard Worker 		__u32	var1_dw;
1448*f7c14bbaSAndroid Build Coastguard Worker 		__u16	var2_w;
1449*f7c14bbaSAndroid Build Coastguard Worker 		__u16	var3_w;
1450*f7c14bbaSAndroid Build Coastguard Worker 	};
1451*f7c14bbaSAndroid Build Coastguard Worker #elif defined(__BIG_ENDIAN_BITFIELD)
1452*f7c14bbaSAndroid Build Coastguard Worker 	struct {
1453*f7c14bbaSAndroid Build Coastguard Worker 		__u16	var3_w;
1454*f7c14bbaSAndroid Build Coastguard Worker 		__u16	var2_w;
1455*f7c14bbaSAndroid Build Coastguard Worker 		__u32	var1_dw;
1456*f7c14bbaSAndroid Build Coastguard Worker 	};
1457*f7c14bbaSAndroid Build Coastguard Worker #else
1458*f7c14bbaSAndroid Build Coastguard Worker #error "Unknown endianness"
1459*f7c14bbaSAndroid Build Coastguard Worker #endif
1460*f7c14bbaSAndroid Build Coastguard Worker };
1461*f7c14bbaSAndroid Build Coastguard Worker 
1462*f7c14bbaSAndroid Build Coastguard Worker #endif /* _UAPI_LINUX_PERF_EVENT_H */
1463