blob: 19ad64f2bd8302a9e33a2554703a3853ffae78d5 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Ingo Molnarcdd6c482009-09-21 12:02:48 +02002#ifndef __PERF_RECORD_H
3#define __PERF_RECORD_H
Arnaldo Carvalho de Melo4cb3c6d2019-08-29 17:19:02 -03004/*
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 */
Arnaldo Carvalho de Melo482ad892011-12-02 11:06:37 -020010#include <stdio.h>
Arnaldo Carvalho de Melo4cb3c6d2019-08-29 17:19:02 -030011#include <linux/stddef.h>
Jiri Olsa1345e2e2019-08-25 20:17:41 +020012#include <perf/event.h>
Arnaldo Carvalho de Melo4cb3c6d2019-08-29 17:19:02 -030013#include <linux/types.h>
Arnaldo Carvalho de Melo4a58e612009-12-27 21:37:00 -020014
Jiri Olsa0c4e7742014-04-17 19:39:10 +020015#include "perf_regs.h"
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020016
Arnaldo Carvalho de Melo4cb3c6d2019-08-29 17:19:02 -030017struct dso;
18struct machine;
19struct perf_event_attr;
20
Jiri Olsa1345e2e2019-08-25 20:17:41 +020021#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
Jiri Olsafecb4102019-08-28 15:57:01 +020030#define PRI_ld64 "l" PRId64
Jiri Olsa1345e2e2019-08-25 20:17:41 +020031#else
32#define PRI_lu64 PRIu64
33#define PRI_lx64 PRIx64
Jiri Olsafecb4102019-08-28 15:57:01 +020034#define PRI_ld64 PRId64
Jiri Olsa1345e2e2019-08-25 20:17:41 +020035#endif
Frederic Weisbecker1fe2c102009-08-12 10:19:53 +020036
Frederic Weisbeckera2854122011-05-21 19:33:04 +020037#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 | \
Adrian Hunter75562572013-08-27 11:23:09 +030041 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
42 PERF_SAMPLE_IDENTIFIER)
Frederic Weisbeckera2854122011-05-21 19:33:04 +020043
Jiri Olsaa65cb4b2013-10-02 15:46:39 +020044/* perf sample has 16 bits size limit */
45#define PERF_SAMPLE_MAX_SIZE (1 << 16)
46
Jiri Olsa0f6a3012012-08-07 15:20:45 +020047struct regs_dump {
Adrian Hunter5b95a4a32013-08-27 11:23:10 +030048 u64 abi;
Jiri Olsa352ea452014-01-07 13:47:25 +010049 u64 mask;
Jiri Olsa0f6a3012012-08-07 15:20:45 +020050 u64 *regs;
Jiri Olsa0c4e7742014-04-17 19:39:10 +020051
52 /* Cached values/mask filled by first register access. */
53 u64 cache_regs[PERF_REGS_MAX];
54 u64 cache_mask;
Jiri Olsa0f6a3012012-08-07 15:20:45 +020055};
56
57struct stack_dump {
58 u16 offset;
59 u64 size;
60 char *data;
61};
62
Jiri Olsa9ede4732012-10-10 17:38:13 +020063struct 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
Jiri Olsa0776eb52014-05-05 12:41:45 +020080struct ip_callchain {
81 u64 nr;
Gustavo A. R. Silva6549a8c2020-05-15 12:29:26 -050082 u64 ips[];
Jiri Olsa0776eb52014-05-05 12:41:45 +020083};
84
Arnaldo Carvalho de Melof1a397f2019-01-22 10:58:22 -020085struct branch_stack;
Jiri Olsa0776eb52014-05-05 12:41:45 +020086
Adrian Hunter00447cc2014-10-30 16:09:42 +020087enum {
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,
Adrian Hunterc025d462021-02-18 11:57:51 +020099 PERF_IP_FLAG_VMENTRY = 1ULL << 11,
100 PERF_IP_FLAG_VMEXIT = 1ULL << 12,
Adrian Hunter00447cc2014-10-30 16:09:42 +0200101};
102
Adrian Hunterf42907e2021-05-21 20:51:27 +0300103#define PERF_IP_FLAG_CHARS "bcrosyiABExgh"
Adrian Hunter400ea6d2015-04-09 18:54:05 +0300104
Adrian Hunter00447cc2014-10-30 16:09:42 +0200105#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 |\
Adrian Hunterc025d462021-02-18 11:57:51 +0200115 PERF_IP_FLAG_TRACE_END |\
116 PERF_IP_FLAG_VMENTRY |\
117 PERF_IP_FLAG_VMEXIT)
Adrian Hunter00447cc2014-10-30 16:09:42 +0200118
Andi Kleenfaaa8762016-10-07 16:42:26 +0300119#define MAX_INSN 16
120
Adrian Hunter98dcf142019-11-15 14:42:11 +0200121struct aux_sample {
122 u64 size;
123 void *data;
124};
125
Arnaldo Carvalho de Melo8d50e5b2011-01-29 13:02:00 -0200126struct perf_sample {
OGAWA Hirofumi180f95e2009-12-06 20:08:24 +0900127 u64 ip;
128 u32 pid, tid;
129 u64 time;
130 u64 addr;
131 u64 id;
132 u64 stream_id;
OGAWA Hirofumi180f95e2009-12-06 20:08:24 +0900133 u64 period;
Andi Kleen05484292013-01-24 16:10:29 +0100134 u64 weight;
Andi Kleen475eeab2013-09-20 07:40:43 -0700135 u64 transaction;
Adrian Hunter61d276f2019-05-20 14:37:12 +0300136 u64 insn_cnt;
137 u64 cyc_cnt;
Arnaldo Carvalho de Meloeed05fe2010-04-05 12:53:45 -0300138 u32 cpu;
OGAWA Hirofumi180f95e2009-12-06 20:08:24 +0900139 u32 raw_size;
Stephane Eranian98a3b322013-01-24 16:10:35 +0100140 u64 data_src;
Kan Liang3b0a5da2017-08-29 13:11:08 -0400141 u64 phys_addr;
Kan Liang542b88f2020-11-30 09:27:53 -0800142 u64 data_page_size;
Kan Liangc1de7f32021-01-05 11:57:49 -0800143 u64 code_page_size;
Namhyung Kimba78c1c2020-03-25 21:45:30 +0900144 u64 cgroup;
Adrian Hunterbf493902014-07-31 09:01:04 +0300145 u32 flags;
146 u16 insn_len;
Arnaldo Carvalho de Melo473398a2016-03-22 18:23:43 -0300147 u8 cpumode;
Jiri Olsa28a0b392018-01-07 17:03:52 +0100148 u16 misc;
Kan Liang590db422021-02-02 12:09:10 -0800149 u16 ins_lat;
Athira Rajeev06e5ca72021-03-22 10:57:26 -0400150 u16 p_stage_cyc;
Kan Liang42bbabe2020-02-28 08:30:00 -0800151 bool no_hw_idx; /* No hw_idx collected in branch_stack */
Andi Kleenfaaa8762016-10-07 16:42:26 +0300152 char insn[MAX_INSN];
OGAWA Hirofumi180f95e2009-12-06 20:08:24 +0900153 void *raw_data;
Arnaldo Carvalho de Meloeed05fe2010-04-05 12:53:45 -0300154 struct ip_callchain *callchain;
Roberto Agostino Vitillob5387522012-02-09 23:21:01 +0100155 struct branch_stack *branch_stack;
Jiri Olsa0f6a3012012-08-07 15:20:45 +0200156 struct regs_dump user_regs;
Stephane Eranian6a21c0b2014-09-24 13:48:39 +0200157 struct regs_dump intr_regs;
Jiri Olsa0f6a3012012-08-07 15:20:45 +0200158 struct stack_dump user_stack;
Jiri Olsa9ede4732012-10-10 17:38:13 +0200159 struct sample_read read;
Adrian Hunter98dcf142019-11-15 14:42:11 +0200160 struct aux_sample aux_sample;
OGAWA Hirofumi180f95e2009-12-06 20:08:24 +0900161};
162
Stephane Eranian98a3b322013-01-24 16:10:35 +0100163#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
Adrian Hunter14057202017-06-21 13:17:19 +0300170/* Attribute type for custom synthesized events */
171#define PERF_TYPE_SYNTH (INT_MAX + 1U)
172
Adrian Hunter65c5e182017-06-30 11:36:42 +0300173/* 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,
Adrian Hunterc840cbf2021-02-05 19:53:50 +0200181 PERF_SYNTH_INTEL_PSB,
Adrian Hunter65c5e182017-06-30 11:36:42 +0300182};
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
Adrian Hunterc840cbf2021-02-05 19:53:50 +0200274struct perf_synth_intel_psb {
275 u32 padding;
276 u32 reserved;
277 u64 offset;
278};
279
Adrian Hunter65c5e182017-06-30 11:36:42 +0300280/*
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
Jiri Olsa2d8f0f12015-10-25 15:51:33 +0100298enum {
299 PERF_STAT_ROUND_TYPE__INTERVAL = 0,
300 PERF_STAT_ROUND_TYPE__FINAL = 1,
301};
302
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -0200303void perf_event__print_totals(void);
Arnaldo Carvalho de Melo62daacb2009-11-27 16:29:22 -0200304
Jiri Olsaf8548392019-07-21 13:23:49 +0200305struct perf_cpu_map;
Arnaldo Carvalho de Meloea49e012019-09-18 11:36:13 -0300306struct perf_record_stat_config;
Jiri Olsa67424342015-10-25 15:51:28 +0100307struct perf_stat_config;
Arnaldo Carvalho de Meloea49e012019-09-18 11:36:13 -0300308struct perf_tool;
Arnaldo Carvalho de Melo4aa65632009-12-13 19:50:29 -0200309
Jiri Olsa8e381592015-10-25 15:51:29 +0100310void perf_event__read_stat_config(struct perf_stat_config *config,
Jiri Olsa72932372019-08-28 15:57:16 +0200311 struct perf_record_stat_config *event);
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -0200312
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -0200313int perf_event__process_comm(struct perf_tool *tool,
Arnaldo Carvalho de Melod20deb62011-11-25 08:19:45 -0200314 union perf_event *event,
315 struct perf_sample *sample,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -0200316 struct machine *machine);
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -0200317int perf_event__process_lost(struct perf_tool *tool,
Arnaldo Carvalho de Melod20deb62011-11-25 08:19:45 -0200318 union perf_event *event,
319 struct perf_sample *sample,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -0200320 struct machine *machine);
Kan Liangc4937a92015-05-10 15:13:15 -0400321int perf_event__process_lost_samples(struct perf_tool *tool,
322 union perf_event *event,
323 struct perf_sample *sample,
324 struct machine *machine);
Adrian Hunter4a96f7a2015-04-30 17:37:29 +0300325int perf_event__process_aux(struct perf_tool *tool,
326 union perf_event *event,
327 struct perf_sample *sample,
328 struct machine *machine);
Adrian Hunter0ad21f62015-04-30 17:37:30 +0300329int perf_event__process_itrace_start(struct perf_tool *tool,
330 union perf_event *event,
331 struct perf_sample *sample,
332 struct machine *machine);
Adrian Hunter02860392015-07-21 12:44:03 +0300333int perf_event__process_switch(struct perf_tool *tool,
334 union perf_event *event,
335 struct perf_sample *sample,
336 struct machine *machine);
Hari Bathinif3b36142017-03-08 02:11:43 +0530337int perf_event__process_namespaces(struct perf_tool *tool,
338 union perf_event *event,
339 struct perf_sample *sample,
340 struct machine *machine);
Namhyung Kimba78c1c2020-03-25 21:45:30 +0900341int perf_event__process_cgroup(struct perf_tool *tool,
342 union perf_event *event,
343 struct perf_sample *sample,
344 struct machine *machine);
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -0200345int perf_event__process_mmap(struct perf_tool *tool,
Arnaldo Carvalho de Melod20deb62011-11-25 08:19:45 -0200346 union perf_event *event,
347 struct perf_sample *sample,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -0200348 struct machine *machine);
Stephane Eranian5c5e8542013-08-21 12:10:25 +0200349int perf_event__process_mmap2(struct perf_tool *tool,
350 union perf_event *event,
351 struct perf_sample *sample,
352 struct machine *machine);
Arnaldo Carvalho de Melof62d3f02012-10-06 15:44:59 -0300353int 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,
Arnaldo Carvalho de Melod20deb62011-11-25 08:19:45 -0200358 union perf_event *event,
359 struct perf_sample *sample,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -0200360 struct machine *machine);
Song Liu9aa0bfa2019-01-17 08:15:17 -0800361int perf_event__process_ksymbol(struct perf_tool *tool,
362 union perf_event *event,
363 struct perf_sample *sample,
364 struct machine *machine);
Arnaldo Carvalho de Melo3f604b52019-08-26 19:28:13 -0300365int perf_event__process_bpf(struct perf_tool *tool,
366 union perf_event *event,
367 struct perf_sample *sample,
368 struct machine *machine);
Adrian Hunter246eba82020-05-12 15:19:18 +0300369int perf_event__process_text_poke(struct perf_tool *tool,
370 union perf_event *event,
371 struct perf_sample *sample,
372 struct machine *machine);
Arnaldo Carvalho de Melo45694aa2011-11-28 08:30:20 -0200373int perf_event__process(struct perf_tool *tool,
Arnaldo Carvalho de Melod20deb62011-11-25 08:19:45 -0200374 union perf_event *event,
375 struct perf_sample *sample,
Arnaldo Carvalho de Melo743eb862011-11-28 07:56:39 -0200376 struct machine *machine);
Arnaldo Carvalho de Melo62daacb2009-11-27 16:29:22 -0200377
Arnaldo Carvalho de Melo1ed091c2009-11-27 16:29:23 -0200378struct addr_location;
Arnaldo Carvalho de Melo316c7132013-11-05 15:32:36 -0300379
Arnaldo Carvalho de Melobb3eb562016-03-22 18:39:09 -0300380int machine__resolve(struct machine *machine, struct addr_location *al,
381 struct perf_sample *sample);
Arnaldo Carvalho de Melo1ed091c2009-11-27 16:29:23 -0200382
Arnaldo Carvalho de Melob91fc392015-04-06 20:43:22 -0300383void addr_location__put(struct addr_location *al);
384
Adrian Hunter9b0d2d82014-07-22 16:17:39 +0300385struct thread;
386
387bool is_bts_event(struct perf_event_attr *attr);
388bool sample_addr_correlates_sym(struct perf_event_attr *attr);
Arnaldo Carvalho de Meloc2740a82016-03-22 18:44:46 -0300389void thread__resolve(struct thread *thread, struct addr_location *al,
390 struct perf_sample *sample);
Adrian Hunter9b0d2d82014-07-22 16:17:39 +0300391
Arnaldo Carvalho de Melo8115d602011-01-29 14:01:45 -0200392const char *perf_event__name(unsigned int id);
Arnaldo Carvalho de Meloc8446b92010-05-14 10:36:42 -0300393
Arnaldo Carvalho de Melo482ad892011-12-02 11:06:37 -0200394size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp);
395size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp);
Stephane Eranian5c5e8542013-08-21 12:10:25 +0200396size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp);
Arnaldo Carvalho de Melo482ad892011-12-02 11:06:37 -0200397size_t perf_event__fprintf_task(union perf_event *event, FILE *fp);
Adrian Hunter4a96f7a2015-04-30 17:37:29 +0300398size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp);
Adrian Hunter0ad21f62015-04-30 17:37:30 +0300399size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp);
Adrian Hunter02860392015-07-21 12:44:03 +0300400size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp);
Jiri Olsaec7fa5962015-10-25 15:51:22 +0100401size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp);
Jiri Olsaeb12a1a2015-10-25 15:51:26 +0100402size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp);
Hari Bathinif3b36142017-03-08 02:11:43 +0530403size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
Namhyung Kimba78c1c2020-03-25 21:45:30 +0900404size_t perf_event__fprintf_cgroup(union perf_event *event, FILE *fp);
Song Liu9aa0bfa2019-01-17 08:15:17 -0800405size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
Arnaldo Carvalho de Melo3f604b52019-08-26 19:28:13 -0300406size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp);
Adrian Hunter7eeb9852020-05-12 15:19:22 +0300407size_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);
Arnaldo Carvalho de Melo482ad892011-12-02 11:06:37 -0200409
Arnaldo Carvalho de Melob843f622017-04-27 21:21:09 -0300410int kallsyms__get_function_start(const char *kallsyms_filename,
411 const char *symbol_name, u64 *addr);
Adrian Hunter29b596b2014-01-29 16:14:37 +0200412
Jiri Olsaf8548392019-07-21 13:23:49 +0200413void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max);
Jiri Olsa72932372019-08-28 15:57:16 +0200414void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map,
Jiri Olsa6c872902015-10-25 15:51:24 +0100415 u16 type, int max);
Arnaldo Carvalho de Melo5ab8c682017-04-25 15:30:47 -0300416
417void event_attr_init(struct perf_event_attr *attr);
418
419int perf_event_paranoid(void);
Igor Lubashevc22e1502019-08-07 10:44:14 -0400420bool perf_event_paranoid_check(int max_level);
Arnaldo Carvalho de Melo5ab8c682017-04-25 15:30:47 -0300421
422extern int sysctl_perf_event_max_stack;
423extern int sysctl_perf_event_max_contexts_per_stack;
Mark Drayton3fcb10e2018-12-04 12:34:20 -0800424extern unsigned int proc_map_timeout;
Arnaldo Carvalho de Melo5ab8c682017-04-25 15:30:47 -0300425
Kan Liang6b9bae62020-12-16 10:57:57 -0800426#define PAGE_SIZE_NAME_LEN 32
427char *get_page_size_name(u64 size, char *str);
428
Kan Liangfbefe9c2021-02-05 08:01:52 -0800429void 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);
Athira Rajeev0a606822021-03-22 10:57:24 -0400431const char *arch_perf_header_entry(const char *se_header);
Athira Rajeev50fa3a52021-03-22 10:57:27 -0400432int arch_support_sort_key(const char *sort_key);
Kan Liangfbefe9c2021-02-05 08:01:52 -0800433
John Kacur8b40f522009-09-24 18:02:18 +0200434#endif /* __PERF_RECORD_H */