Linux Audio

Check our new training course

Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef __PERF_RECORD_H
  3#define __PERF_RECORD_H
  4/*
  5 * The linux/stddef.h isn't need here, but is needed for __always_inline used
  6 * in files included from uapi/linux/perf_event.h such as
  7 * /usr/include/linux/swab.h and /usr/include/linux/byteorder/little_endian.h,
  8 * detected in at least musl libc, used in Alpine Linux. -acme
  9 */
 10#include <stdio.h>
 11#include <linux/stddef.h>
 12#include <perf/event.h>
 13#include <linux/types.h>
 14
 15#include "perf_regs.h"
 16
 17struct dso;
 18struct machine;
 19struct perf_event_attr;
 20
 21#ifdef __LP64__
 22/*
 23 * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
 24 * __u64 as long long unsigned int, and then -Werror=format= kicks in and
 25 * complains of the mismatched types, so use these two special extra PRI
 26 * macros to overcome that.
 27 */
 28#define PRI_lu64 "l" PRIu64
 29#define PRI_lx64 "l" PRIx64
 30#define PRI_ld64 "l" PRId64
 31#else
 32#define PRI_lu64 PRIu64
 33#define PRI_lx64 PRIx64
 34#define PRI_ld64 PRId64
 35#endif
 36
 37#define PERF_SAMPLE_MASK				\
 38	(PERF_SAMPLE_IP | PERF_SAMPLE_TID |		\
 39	 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |		\
 40	PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |	\
 41	 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |		\
 42	 PERF_SAMPLE_IDENTIFIER)
 43
 44/* perf sample has 16 bits size limit */
 45#define PERF_SAMPLE_MAX_SIZE (1 << 16)
 46
 47struct regs_dump {
 48	u64 abi;
 49	u64 mask;
 50	u64 *regs;
 51
 52	/* Cached values/mask filled by first register access. */
 53	u64 cache_regs[PERF_REGS_MAX];
 54	u64 cache_mask;
 55};
 56
 57struct stack_dump {
 58	u16 offset;
 59	u64 size;
 60	char *data;
 61};
 62
 63struct sample_read_value {
 64	u64 value;
 65	u64 id;
 66};
 67
 68struct sample_read {
 69	u64 time_enabled;
 70	u64 time_running;
 71	union {
 72		struct {
 73			u64 nr;
 74			struct sample_read_value *values;
 75		} group;
 76		struct sample_read_value one;
 77	};
 78};
 79
 80struct ip_callchain {
 81	u64 nr;
 82	u64 ips[0];
 83};
 84
 85struct branch_stack;
 86
 87enum {
 88	PERF_IP_FLAG_BRANCH		= 1ULL << 0,
 89	PERF_IP_FLAG_CALL		= 1ULL << 1,
 90	PERF_IP_FLAG_RETURN		= 1ULL << 2,
 91	PERF_IP_FLAG_CONDITIONAL	= 1ULL << 3,
 92	PERF_IP_FLAG_SYSCALLRET		= 1ULL << 4,
 93	PERF_IP_FLAG_ASYNC		= 1ULL << 5,
 94	PERF_IP_FLAG_INTERRUPT		= 1ULL << 6,
 95	PERF_IP_FLAG_TX_ABORT		= 1ULL << 7,
 96	PERF_IP_FLAG_TRACE_BEGIN	= 1ULL << 8,
 97	PERF_IP_FLAG_TRACE_END		= 1ULL << 9,
 98	PERF_IP_FLAG_IN_TX		= 1ULL << 10,
 
 
 99};
100
101#define PERF_IP_FLAG_CHARS "bcrosyiABEx"
102
103#define PERF_BRANCH_MASK		(\
104	PERF_IP_FLAG_BRANCH		|\
105	PERF_IP_FLAG_CALL		|\
106	PERF_IP_FLAG_RETURN		|\
107	PERF_IP_FLAG_CONDITIONAL	|\
108	PERF_IP_FLAG_SYSCALLRET		|\
109	PERF_IP_FLAG_ASYNC		|\
110	PERF_IP_FLAG_INTERRUPT		|\
111	PERF_IP_FLAG_TX_ABORT		|\
112	PERF_IP_FLAG_TRACE_BEGIN	|\
113	PERF_IP_FLAG_TRACE_END)
 
 
114
115#define MAX_INSN 16
116
 
 
 
 
 
117struct perf_sample {
118	u64 ip;
119	u32 pid, tid;
120	u64 time;
121	u64 addr;
122	u64 id;
123	u64 stream_id;
124	u64 period;
125	u64 weight;
126	u64 transaction;
127	u64 insn_cnt;
128	u64 cyc_cnt;
129	u32 cpu;
130	u32 raw_size;
131	u64 data_src;
132	u64 phys_addr;
 
 
 
133	u32 flags;
134	u16 insn_len;
135	u8  cpumode;
136	u16 misc;
 
 
 
137	char insn[MAX_INSN];
138	void *raw_data;
139	struct ip_callchain *callchain;
140	struct branch_stack *branch_stack;
141	struct regs_dump  user_regs;
142	struct regs_dump  intr_regs;
143	struct stack_dump user_stack;
144	struct sample_read read;
 
145};
146
147#define PERF_MEM_DATA_SRC_NONE \
148	(PERF_MEM_S(OP, NA) |\
149	 PERF_MEM_S(LVL, NA) |\
150	 PERF_MEM_S(SNOOP, NA) |\
151	 PERF_MEM_S(LOCK, NA) |\
152	 PERF_MEM_S(TLB, NA))
153
154/* Attribute type for custom synthesized events */
155#define PERF_TYPE_SYNTH		(INT_MAX + 1U)
156
157/* Attribute config for custom synthesized events */
158enum perf_synth_id {
159	PERF_SYNTH_INTEL_PTWRITE,
160	PERF_SYNTH_INTEL_MWAIT,
161	PERF_SYNTH_INTEL_PWRE,
162	PERF_SYNTH_INTEL_EXSTOP,
163	PERF_SYNTH_INTEL_PWRX,
164	PERF_SYNTH_INTEL_CBR,
 
165};
166
167/*
168 * Raw data formats for synthesized events. Note that 4 bytes of padding are
169 * present to match the 'size' member of PERF_SAMPLE_RAW data which is always
170 * 8-byte aligned. That means we must dereference raw_data with an offset of 4.
171 * Refer perf_sample__synth_ptr() and perf_synth__raw_data().  It also means the
172 * structure sizes are 4 bytes bigger than the raw_size, refer
173 * perf_synth__raw_size().
174 */
175
176struct perf_synth_intel_ptwrite {
177	u32 padding;
178	union {
179		struct {
180			u32	ip		:  1,
181				reserved	: 31;
182		};
183		u32	flags;
184	};
185	u64	payload;
186};
187
188struct perf_synth_intel_mwait {
189	u32 padding;
190	u32 reserved;
191	union {
192		struct {
193			u64	hints		:  8,
194				reserved1	: 24,
195				extensions	:  2,
196				reserved2	: 30;
197		};
198		u64	payload;
199	};
200};
201
202struct perf_synth_intel_pwre {
203	u32 padding;
204	u32 reserved;
205	union {
206		struct {
207			u64	reserved1	:  7,
208				hw		:  1,
209				subcstate	:  4,
210				cstate		:  4,
211				reserved2	: 48;
212		};
213		u64	payload;
214	};
215};
216
217struct perf_synth_intel_exstop {
218	u32 padding;
219	union {
220		struct {
221			u32	ip		:  1,
222				reserved	: 31;
223		};
224		u32	flags;
225	};
226};
227
228struct perf_synth_intel_pwrx {
229	u32 padding;
230	u32 reserved;
231	union {
232		struct {
233			u64	deepest_cstate	:  4,
234				last_cstate	:  4,
235				wake_reason	:  4,
236				reserved1	: 52;
237		};
238		u64	payload;
239	};
240};
241
242struct perf_synth_intel_cbr {
243	u32 padding;
244	union {
245		struct {
246			u32	cbr		:  8,
247				reserved1	:  8,
248				max_nonturbo	:  8,
249				reserved2	:  8;
250		};
251		u32	flags;
252	};
253	u32 freq;
254	u32 reserved3;
255};
256
 
 
 
 
 
 
257/*
258 * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get
259 * 8-byte alignment.
260 */
261static inline void *perf_sample__synth_ptr(struct perf_sample *sample)
262{
263	return sample->raw_data - 4;
264}
265
266static inline void *perf_synth__raw_data(void *p)
267{
268	return p + 4;
269}
270
271#define perf_synth__raw_size(d) (sizeof(d) - 4)
272
273#define perf_sample__bad_synth_size(s, d) ((s)->raw_size < sizeof(d) - 4)
274
275enum {
276	PERF_STAT_ROUND_TYPE__INTERVAL	= 0,
277	PERF_STAT_ROUND_TYPE__FINAL	= 1,
278};
279
280void perf_event__print_totals(void);
281
282struct perf_cpu_map;
283struct perf_record_stat_config;
284struct perf_stat_config;
285struct perf_tool;
286
287void perf_event__read_stat_config(struct perf_stat_config *config,
288				  struct perf_record_stat_config *event);
289
290int perf_event__process_comm(struct perf_tool *tool,
291			     union perf_event *event,
292			     struct perf_sample *sample,
293			     struct machine *machine);
294int perf_event__process_lost(struct perf_tool *tool,
295			     union perf_event *event,
296			     struct perf_sample *sample,
297			     struct machine *machine);
298int perf_event__process_lost_samples(struct perf_tool *tool,
299				     union perf_event *event,
300				     struct perf_sample *sample,
301				     struct machine *machine);
302int perf_event__process_aux(struct perf_tool *tool,
303			    union perf_event *event,
304			    struct perf_sample *sample,
305			    struct machine *machine);
306int perf_event__process_itrace_start(struct perf_tool *tool,
307				     union perf_event *event,
308				     struct perf_sample *sample,
309				     struct machine *machine);
310int perf_event__process_switch(struct perf_tool *tool,
311			       union perf_event *event,
312			       struct perf_sample *sample,
313			       struct machine *machine);
314int perf_event__process_namespaces(struct perf_tool *tool,
315				   union perf_event *event,
316				   struct perf_sample *sample,
317				   struct machine *machine);
 
 
 
 
318int perf_event__process_mmap(struct perf_tool *tool,
319			     union perf_event *event,
320			     struct perf_sample *sample,
321			     struct machine *machine);
322int perf_event__process_mmap2(struct perf_tool *tool,
323			     union perf_event *event,
324			     struct perf_sample *sample,
325			     struct machine *machine);
326int perf_event__process_fork(struct perf_tool *tool,
327			     union perf_event *event,
328			     struct perf_sample *sample,
329			     struct machine *machine);
330int perf_event__process_exit(struct perf_tool *tool,
331			     union perf_event *event,
332			     struct perf_sample *sample,
333			     struct machine *machine);
334int perf_event__process_ksymbol(struct perf_tool *tool,
335				union perf_event *event,
336				struct perf_sample *sample,
337				struct machine *machine);
338int perf_event__process_bpf(struct perf_tool *tool,
339			    union perf_event *event,
340			    struct perf_sample *sample,
341			    struct machine *machine);
 
 
 
 
342int perf_event__process(struct perf_tool *tool,
343			union perf_event *event,
344			struct perf_sample *sample,
345			struct machine *machine);
346
347struct addr_location;
348
349int machine__resolve(struct machine *machine, struct addr_location *al,
350		     struct perf_sample *sample);
351
352void addr_location__put(struct addr_location *al);
353
354struct thread;
355
356bool is_bts_event(struct perf_event_attr *attr);
357bool sample_addr_correlates_sym(struct perf_event_attr *attr);
358void thread__resolve(struct thread *thread, struct addr_location *al,
359		     struct perf_sample *sample);
360
361const char *perf_event__name(unsigned int id);
362
363size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
364size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
365size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
366size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
367size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp);
368size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
369size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
370size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
371size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
372size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
 
373size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
374size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp);
375size_t perf_event__fprintf(union perf_event *event, FILE *fp);
 
376
377int kallsyms__get_function_start(const char *kallsyms_filename,
378				 const char *symbol_name, u64 *addr);
379
380void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max);
381void  cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map,
382			       u16 type, int max);
383
384void event_attr_init(struct perf_event_attr *attr);
385
386int perf_event_paranoid(void);
387bool perf_event_paranoid_check(int max_level);
388
389extern int sysctl_perf_event_max_stack;
390extern int sysctl_perf_event_max_contexts_per_stack;
391extern unsigned int proc_map_timeout;
 
 
 
 
 
 
 
 
392
393#endif /* __PERF_RECORD_H */
v5.14.15
  1/* SPDX-License-Identifier: GPL-2.0 */
  2#ifndef __PERF_RECORD_H
  3#define __PERF_RECORD_H
  4/*
  5 * The linux/stddef.h isn't need here, but is needed for __always_inline used
  6 * in files included from uapi/linux/perf_event.h such as
  7 * /usr/include/linux/swab.h and /usr/include/linux/byteorder/little_endian.h,
  8 * detected in at least musl libc, used in Alpine Linux. -acme
  9 */
 10#include <stdio.h>
 11#include <linux/stddef.h>
 12#include <perf/event.h>
 13#include <linux/types.h>
 14
 15#include "perf_regs.h"
 16
 17struct dso;
 18struct machine;
 19struct perf_event_attr;
 20
 21#ifdef __LP64__
 22/*
 23 * /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
 24 * __u64 as long long unsigned int, and then -Werror=format= kicks in and
 25 * complains of the mismatched types, so use these two special extra PRI
 26 * macros to overcome that.
 27 */
 28#define PRI_lu64 "l" PRIu64
 29#define PRI_lx64 "l" PRIx64
 30#define PRI_ld64 "l" PRId64
 31#else
 32#define PRI_lu64 PRIu64
 33#define PRI_lx64 PRIx64
 34#define PRI_ld64 PRId64
 35#endif
 36
 37#define PERF_SAMPLE_MASK				\
 38	(PERF_SAMPLE_IP | PERF_SAMPLE_TID |		\
 39	 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |		\
 40	PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |	\
 41	 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |		\
 42	 PERF_SAMPLE_IDENTIFIER)
 43
 44/* perf sample has 16 bits size limit */
 45#define PERF_SAMPLE_MAX_SIZE (1 << 16)
 46
 47struct regs_dump {
 48	u64 abi;
 49	u64 mask;
 50	u64 *regs;
 51
 52	/* Cached values/mask filled by first register access. */
 53	u64 cache_regs[PERF_REGS_MAX];
 54	u64 cache_mask;
 55};
 56
 57struct stack_dump {
 58	u16 offset;
 59	u64 size;
 60	char *data;
 61};
 62
 63struct sample_read_value {
 64	u64 value;
 65	u64 id;
 66};
 67
 68struct sample_read {
 69	u64 time_enabled;
 70	u64 time_running;
 71	union {
 72		struct {
 73			u64 nr;
 74			struct sample_read_value *values;
 75		} group;
 76		struct sample_read_value one;
 77	};
 78};
 79
 80struct ip_callchain {
 81	u64 nr;
 82	u64 ips[];
 83};
 84
 85struct branch_stack;
 86
 87enum {
 88	PERF_IP_FLAG_BRANCH		= 1ULL << 0,
 89	PERF_IP_FLAG_CALL		= 1ULL << 1,
 90	PERF_IP_FLAG_RETURN		= 1ULL << 2,
 91	PERF_IP_FLAG_CONDITIONAL	= 1ULL << 3,
 92	PERF_IP_FLAG_SYSCALLRET		= 1ULL << 4,
 93	PERF_IP_FLAG_ASYNC		= 1ULL << 5,
 94	PERF_IP_FLAG_INTERRUPT		= 1ULL << 6,
 95	PERF_IP_FLAG_TX_ABORT		= 1ULL << 7,
 96	PERF_IP_FLAG_TRACE_BEGIN	= 1ULL << 8,
 97	PERF_IP_FLAG_TRACE_END		= 1ULL << 9,
 98	PERF_IP_FLAG_IN_TX		= 1ULL << 10,
 99	PERF_IP_FLAG_VMENTRY		= 1ULL << 11,
100	PERF_IP_FLAG_VMEXIT		= 1ULL << 12,
101};
102
103#define PERF_IP_FLAG_CHARS "bcrosyiABExgh"
104
105#define PERF_BRANCH_MASK		(\
106	PERF_IP_FLAG_BRANCH		|\
107	PERF_IP_FLAG_CALL		|\
108	PERF_IP_FLAG_RETURN		|\
109	PERF_IP_FLAG_CONDITIONAL	|\
110	PERF_IP_FLAG_SYSCALLRET		|\
111	PERF_IP_FLAG_ASYNC		|\
112	PERF_IP_FLAG_INTERRUPT		|\
113	PERF_IP_FLAG_TX_ABORT		|\
114	PERF_IP_FLAG_TRACE_BEGIN	|\
115	PERF_IP_FLAG_TRACE_END		|\
116	PERF_IP_FLAG_VMENTRY		|\
117	PERF_IP_FLAG_VMEXIT)
118
119#define MAX_INSN 16
120
121struct aux_sample {
122	u64 size;
123	void *data;
124};
125
126struct perf_sample {
127	u64 ip;
128	u32 pid, tid;
129	u64 time;
130	u64 addr;
131	u64 id;
132	u64 stream_id;
133	u64 period;
134	u64 weight;
135	u64 transaction;
136	u64 insn_cnt;
137	u64 cyc_cnt;
138	u32 cpu;
139	u32 raw_size;
140	u64 data_src;
141	u64 phys_addr;
142	u64 data_page_size;
143	u64 code_page_size;
144	u64 cgroup;
145	u32 flags;
146	u16 insn_len;
147	u8  cpumode;
148	u16 misc;
149	u16 ins_lat;
150	u16 p_stage_cyc;
151	bool no_hw_idx;		/* No hw_idx collected in branch_stack */
152	char insn[MAX_INSN];
153	void *raw_data;
154	struct ip_callchain *callchain;
155	struct branch_stack *branch_stack;
156	struct regs_dump  user_regs;
157	struct regs_dump  intr_regs;
158	struct stack_dump user_stack;
159	struct sample_read read;
160	struct aux_sample aux_sample;
161};
162
163#define PERF_MEM_DATA_SRC_NONE \
164	(PERF_MEM_S(OP, NA) |\
165	 PERF_MEM_S(LVL, NA) |\
166	 PERF_MEM_S(SNOOP, NA) |\
167	 PERF_MEM_S(LOCK, NA) |\
168	 PERF_MEM_S(TLB, NA))
169
170/* Attribute type for custom synthesized events */
171#define PERF_TYPE_SYNTH		(INT_MAX + 1U)
172
173/* Attribute config for custom synthesized events */
174enum perf_synth_id {
175	PERF_SYNTH_INTEL_PTWRITE,
176	PERF_SYNTH_INTEL_MWAIT,
177	PERF_SYNTH_INTEL_PWRE,
178	PERF_SYNTH_INTEL_EXSTOP,
179	PERF_SYNTH_INTEL_PWRX,
180	PERF_SYNTH_INTEL_CBR,
181	PERF_SYNTH_INTEL_PSB,
182};
183
184/*
185 * Raw data formats for synthesized events. Note that 4 bytes of padding are
186 * present to match the 'size' member of PERF_SAMPLE_RAW data which is always
187 * 8-byte aligned. That means we must dereference raw_data with an offset of 4.
188 * Refer perf_sample__synth_ptr() and perf_synth__raw_data().  It also means the
189 * structure sizes are 4 bytes bigger than the raw_size, refer
190 * perf_synth__raw_size().
191 */
192
193struct perf_synth_intel_ptwrite {
194	u32 padding;
195	union {
196		struct {
197			u32	ip		:  1,
198				reserved	: 31;
199		};
200		u32	flags;
201	};
202	u64	payload;
203};
204
205struct perf_synth_intel_mwait {
206	u32 padding;
207	u32 reserved;
208	union {
209		struct {
210			u64	hints		:  8,
211				reserved1	: 24,
212				extensions	:  2,
213				reserved2	: 30;
214		};
215		u64	payload;
216	};
217};
218
219struct perf_synth_intel_pwre {
220	u32 padding;
221	u32 reserved;
222	union {
223		struct {
224			u64	reserved1	:  7,
225				hw		:  1,
226				subcstate	:  4,
227				cstate		:  4,
228				reserved2	: 48;
229		};
230		u64	payload;
231	};
232};
233
234struct perf_synth_intel_exstop {
235	u32 padding;
236	union {
237		struct {
238			u32	ip		:  1,
239				reserved	: 31;
240		};
241		u32	flags;
242	};
243};
244
245struct perf_synth_intel_pwrx {
246	u32 padding;
247	u32 reserved;
248	union {
249		struct {
250			u64	deepest_cstate	:  4,
251				last_cstate	:  4,
252				wake_reason	:  4,
253				reserved1	: 52;
254		};
255		u64	payload;
256	};
257};
258
259struct perf_synth_intel_cbr {
260	u32 padding;
261	union {
262		struct {
263			u32	cbr		:  8,
264				reserved1	:  8,
265				max_nonturbo	:  8,
266				reserved2	:  8;
267		};
268		u32	flags;
269	};
270	u32 freq;
271	u32 reserved3;
272};
273
274struct perf_synth_intel_psb {
275	u32 padding;
276	u32 reserved;
277	u64 offset;
278};
279
280/*
281 * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get
282 * 8-byte alignment.
283 */
284static inline void *perf_sample__synth_ptr(struct perf_sample *sample)
285{
286	return sample->raw_data - 4;
287}
288
289static inline void *perf_synth__raw_data(void *p)
290{
291	return p + 4;
292}
293
294#define perf_synth__raw_size(d) (sizeof(d) - 4)
295
296#define perf_sample__bad_synth_size(s, d) ((s)->raw_size < sizeof(d) - 4)
297
298enum {
299	PERF_STAT_ROUND_TYPE__INTERVAL	= 0,
300	PERF_STAT_ROUND_TYPE__FINAL	= 1,
301};
302
303void perf_event__print_totals(void);
304
305struct perf_cpu_map;
306struct perf_record_stat_config;
307struct perf_stat_config;
308struct perf_tool;
309
310void perf_event__read_stat_config(struct perf_stat_config *config,
311				  struct perf_record_stat_config *event);
312
313int perf_event__process_comm(struct perf_tool *tool,
314			     union perf_event *event,
315			     struct perf_sample *sample,
316			     struct machine *machine);
317int perf_event__process_lost(struct perf_tool *tool,
318			     union perf_event *event,
319			     struct perf_sample *sample,
320			     struct machine *machine);
321int perf_event__process_lost_samples(struct perf_tool *tool,
322				     union perf_event *event,
323				     struct perf_sample *sample,
324				     struct machine *machine);
325int perf_event__process_aux(struct perf_tool *tool,
326			    union perf_event *event,
327			    struct perf_sample *sample,
328			    struct machine *machine);
329int perf_event__process_itrace_start(struct perf_tool *tool,
330				     union perf_event *event,
331				     struct perf_sample *sample,
332				     struct machine *machine);
333int perf_event__process_switch(struct perf_tool *tool,
334			       union perf_event *event,
335			       struct perf_sample *sample,
336			       struct machine *machine);
337int perf_event__process_namespaces(struct perf_tool *tool,
338				   union perf_event *event,
339				   struct perf_sample *sample,
340				   struct machine *machine);
341int perf_event__process_cgroup(struct perf_tool *tool,
342			       union perf_event *event,
343			       struct perf_sample *sample,
344			       struct machine *machine);
345int perf_event__process_mmap(struct perf_tool *tool,
346			     union perf_event *event,
347			     struct perf_sample *sample,
348			     struct machine *machine);
349int perf_event__process_mmap2(struct perf_tool *tool,
350			     union perf_event *event,
351			     struct perf_sample *sample,
352			     struct machine *machine);
353int perf_event__process_fork(struct perf_tool *tool,
354			     union perf_event *event,
355			     struct perf_sample *sample,
356			     struct machine *machine);
357int perf_event__process_exit(struct perf_tool *tool,
358			     union perf_event *event,
359			     struct perf_sample *sample,
360			     struct machine *machine);
361int perf_event__process_ksymbol(struct perf_tool *tool,
362				union perf_event *event,
363				struct perf_sample *sample,
364				struct machine *machine);
365int perf_event__process_bpf(struct perf_tool *tool,
366			    union perf_event *event,
367			    struct perf_sample *sample,
368			    struct machine *machine);
369int perf_event__process_text_poke(struct perf_tool *tool,
370				  union perf_event *event,
371				  struct perf_sample *sample,
372				  struct machine *machine);
373int perf_event__process(struct perf_tool *tool,
374			union perf_event *event,
375			struct perf_sample *sample,
376			struct machine *machine);
377
378struct addr_location;
379
380int machine__resolve(struct machine *machine, struct addr_location *al,
381		     struct perf_sample *sample);
382
383void addr_location__put(struct addr_location *al);
384
385struct thread;
386
387bool is_bts_event(struct perf_event_attr *attr);
388bool sample_addr_correlates_sym(struct perf_event_attr *attr);
389void thread__resolve(struct thread *thread, struct addr_location *al,
390		     struct perf_sample *sample);
391
392const char *perf_event__name(unsigned int id);
393
394size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
395size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
396size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
397size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
398size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp);
399size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
400size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
401size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
402size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
403size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
404size_t perf_event__fprintf_cgroup(union perf_event *event, FILE *fp);
405size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
406size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp);
407size_t perf_event__fprintf_text_poke(union perf_event *event, struct machine *machine,FILE *fp);
408size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FILE *fp);
409
410int kallsyms__get_function_start(const char *kallsyms_filename,
411				 const char *symbol_name, u64 *addr);
412
413void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max);
414void  cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map,
415			       u16 type, int max);
416
417void event_attr_init(struct perf_event_attr *attr);
418
419int perf_event_paranoid(void);
420bool perf_event_paranoid_check(int max_level);
421
422extern int sysctl_perf_event_max_stack;
423extern int sysctl_perf_event_max_contexts_per_stack;
424extern unsigned int proc_map_timeout;
425
426#define PAGE_SIZE_NAME_LEN	32
427char *get_page_size_name(u64 size, char *str);
428
429void arch_perf_parse_sample_weight(struct perf_sample *data, const __u64 *array, u64 type);
430void arch_perf_synthesize_sample_weight(const struct perf_sample *data, __u64 *array, u64 type);
431const char *arch_perf_header_entry(const char *se_header);
432int arch_support_sort_key(const char *sort_key);
433
434#endif /* __PERF_RECORD_H */