Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Ingo Molnar | cdd6c48 | 2009-09-21 12:02:48 +0200 | [diff] [blame] | 2 | #ifndef __PERF_RECORD_H |
| 3 | #define __PERF_RECORD_H |
Arnaldo Carvalho de Melo | 4cb3c6d | 2019-08-29 17:19:02 -0300 | [diff] [blame] | 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 | */ |
Arnaldo Carvalho de Melo | 482ad89 | 2011-12-02 11:06:37 -0200 | [diff] [blame] | 10 | #include <stdio.h> |
Arnaldo Carvalho de Melo | 4cb3c6d | 2019-08-29 17:19:02 -0300 | [diff] [blame] | 11 | #include <linux/stddef.h> |
Jiri Olsa | 1345e2e | 2019-08-25 20:17:41 +0200 | [diff] [blame] | 12 | #include <perf/event.h> |
Arnaldo Carvalho de Melo | 4cb3c6d | 2019-08-29 17:19:02 -0300 | [diff] [blame] | 13 | #include <linux/types.h> |
Arnaldo Carvalho de Melo | 4a58e61 | 2009-12-27 21:37:00 -0200 | [diff] [blame] | 14 | |
Jiri Olsa | 0c4e774 | 2014-04-17 19:39:10 +0200 | [diff] [blame] | 15 | #include "perf_regs.h" |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 16 | |
Arnaldo Carvalho de Melo | 4cb3c6d | 2019-08-29 17:19:02 -0300 | [diff] [blame] | 17 | struct dso; |
| 18 | struct machine; |
| 19 | struct perf_event_attr; |
| 20 | |
Jiri Olsa | 1345e2e | 2019-08-25 20:17:41 +0200 | [diff] [blame] | 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 |
Jiri Olsa | fecb410 | 2019-08-28 15:57:01 +0200 | [diff] [blame] | 30 | #define PRI_ld64 "l" PRId64 |
Jiri Olsa | 1345e2e | 2019-08-25 20:17:41 +0200 | [diff] [blame] | 31 | #else |
| 32 | #define PRI_lu64 PRIu64 |
| 33 | #define PRI_lx64 PRIx64 |
Jiri Olsa | fecb410 | 2019-08-28 15:57:01 +0200 | [diff] [blame] | 34 | #define PRI_ld64 PRId64 |
Jiri Olsa | 1345e2e | 2019-08-25 20:17:41 +0200 | [diff] [blame] | 35 | #endif |
Frederic Weisbecker | 1fe2c10 | 2009-08-12 10:19:53 +0200 | [diff] [blame] | 36 | |
Frederic Weisbecker | a285412 | 2011-05-21 19:33:04 +0200 | [diff] [blame] | 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 | \ |
Adrian Hunter | 7556257 | 2013-08-27 11:23:09 +0300 | [diff] [blame] | 41 | PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \ |
| 42 | PERF_SAMPLE_IDENTIFIER) |
Frederic Weisbecker | a285412 | 2011-05-21 19:33:04 +0200 | [diff] [blame] | 43 | |
Jiri Olsa | a65cb4b | 2013-10-02 15:46:39 +0200 | [diff] [blame] | 44 | /* perf sample has 16 bits size limit */ |
| 45 | #define PERF_SAMPLE_MAX_SIZE (1 << 16) |
| 46 | |
Jiri Olsa | 0f6a301 | 2012-08-07 15:20:45 +0200 | [diff] [blame] | 47 | struct regs_dump { |
Adrian Hunter | 5b95a4a3 | 2013-08-27 11:23:10 +0300 | [diff] [blame] | 48 | u64 abi; |
Jiri Olsa | 352ea45 | 2014-01-07 13:47:25 +0100 | [diff] [blame] | 49 | u64 mask; |
Jiri Olsa | 0f6a301 | 2012-08-07 15:20:45 +0200 | [diff] [blame] | 50 | u64 *regs; |
Jiri Olsa | 0c4e774 | 2014-04-17 19:39:10 +0200 | [diff] [blame] | 51 | |
| 52 | /* Cached values/mask filled by first register access. */ |
| 53 | u64 cache_regs[PERF_REGS_MAX]; |
| 54 | u64 cache_mask; |
Jiri Olsa | 0f6a301 | 2012-08-07 15:20:45 +0200 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | struct stack_dump { |
| 58 | u16 offset; |
| 59 | u64 size; |
| 60 | char *data; |
| 61 | }; |
| 62 | |
Jiri Olsa | 9ede473 | 2012-10-10 17:38:13 +0200 | [diff] [blame] | 63 | struct sample_read_value { |
| 64 | u64 value; |
| 65 | u64 id; |
| 66 | }; |
| 67 | |
| 68 | struct 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 Olsa | 0776eb5 | 2014-05-05 12:41:45 +0200 | [diff] [blame] | 80 | struct ip_callchain { |
| 81 | u64 nr; |
Gustavo A. R. Silva | 6549a8c | 2020-05-15 12:29:26 -0500 | [diff] [blame] | 82 | u64 ips[]; |
Jiri Olsa | 0776eb5 | 2014-05-05 12:41:45 +0200 | [diff] [blame] | 83 | }; |
| 84 | |
Arnaldo Carvalho de Melo | f1a397f | 2019-01-22 10:58:22 -0200 | [diff] [blame] | 85 | struct branch_stack; |
Jiri Olsa | 0776eb5 | 2014-05-05 12:41:45 +0200 | [diff] [blame] | 86 | |
Adrian Hunter | 00447cc | 2014-10-30 16:09:42 +0200 | [diff] [blame] | 87 | enum { |
| 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 Hunter | c025d46 | 2021-02-18 11:57:51 +0200 | [diff] [blame] | 99 | PERF_IP_FLAG_VMENTRY = 1ULL << 11, |
| 100 | PERF_IP_FLAG_VMEXIT = 1ULL << 12, |
Adrian Hunter | 00447cc | 2014-10-30 16:09:42 +0200 | [diff] [blame] | 101 | }; |
| 102 | |
Adrian Hunter | f42907e | 2021-05-21 20:51:27 +0300 | [diff] [blame] | 103 | #define PERF_IP_FLAG_CHARS "bcrosyiABExgh" |
Adrian Hunter | 400ea6d | 2015-04-09 18:54:05 +0300 | [diff] [blame] | 104 | |
Adrian Hunter | 00447cc | 2014-10-30 16:09:42 +0200 | [diff] [blame] | 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 |\ |
Adrian Hunter | c025d46 | 2021-02-18 11:57:51 +0200 | [diff] [blame] | 115 | PERF_IP_FLAG_TRACE_END |\ |
| 116 | PERF_IP_FLAG_VMENTRY |\ |
| 117 | PERF_IP_FLAG_VMEXIT) |
Adrian Hunter | 00447cc | 2014-10-30 16:09:42 +0200 | [diff] [blame] | 118 | |
Andi Kleen | faaa876 | 2016-10-07 16:42:26 +0300 | [diff] [blame] | 119 | #define MAX_INSN 16 |
| 120 | |
Adrian Hunter | 98dcf14 | 2019-11-15 14:42:11 +0200 | [diff] [blame] | 121 | struct aux_sample { |
| 122 | u64 size; |
| 123 | void *data; |
| 124 | }; |
| 125 | |
Arnaldo Carvalho de Melo | 8d50e5b | 2011-01-29 13:02:00 -0200 | [diff] [blame] | 126 | struct perf_sample { |
OGAWA Hirofumi | 180f95e | 2009-12-06 20:08:24 +0900 | [diff] [blame] | 127 | u64 ip; |
| 128 | u32 pid, tid; |
| 129 | u64 time; |
| 130 | u64 addr; |
| 131 | u64 id; |
| 132 | u64 stream_id; |
OGAWA Hirofumi | 180f95e | 2009-12-06 20:08:24 +0900 | [diff] [blame] | 133 | u64 period; |
Andi Kleen | 0548429 | 2013-01-24 16:10:29 +0100 | [diff] [blame] | 134 | u64 weight; |
Andi Kleen | 475eeab | 2013-09-20 07:40:43 -0700 | [diff] [blame] | 135 | u64 transaction; |
Adrian Hunter | 61d276f | 2019-05-20 14:37:12 +0300 | [diff] [blame] | 136 | u64 insn_cnt; |
| 137 | u64 cyc_cnt; |
Arnaldo Carvalho de Melo | eed05fe | 2010-04-05 12:53:45 -0300 | [diff] [blame] | 138 | u32 cpu; |
OGAWA Hirofumi | 180f95e | 2009-12-06 20:08:24 +0900 | [diff] [blame] | 139 | u32 raw_size; |
Stephane Eranian | 98a3b32 | 2013-01-24 16:10:35 +0100 | [diff] [blame] | 140 | u64 data_src; |
Kan Liang | 3b0a5da | 2017-08-29 13:11:08 -0400 | [diff] [blame] | 141 | u64 phys_addr; |
Kan Liang | 542b88f | 2020-11-30 09:27:53 -0800 | [diff] [blame] | 142 | u64 data_page_size; |
Kan Liang | c1de7f3 | 2021-01-05 11:57:49 -0800 | [diff] [blame] | 143 | u64 code_page_size; |
Namhyung Kim | ba78c1c | 2020-03-25 21:45:30 +0900 | [diff] [blame] | 144 | u64 cgroup; |
Adrian Hunter | bf49390 | 2014-07-31 09:01:04 +0300 | [diff] [blame] | 145 | u32 flags; |
| 146 | u16 insn_len; |
Arnaldo Carvalho de Melo | 473398a | 2016-03-22 18:23:43 -0300 | [diff] [blame] | 147 | u8 cpumode; |
Jiri Olsa | 28a0b39 | 2018-01-07 17:03:52 +0100 | [diff] [blame] | 148 | u16 misc; |
Kan Liang | 590db42 | 2021-02-02 12:09:10 -0800 | [diff] [blame] | 149 | u16 ins_lat; |
Athira Rajeev | 06e5ca7 | 2021-03-22 10:57:26 -0400 | [diff] [blame] | 150 | u16 p_stage_cyc; |
Kan Liang | 42bbabe | 2020-02-28 08:30:00 -0800 | [diff] [blame] | 151 | bool no_hw_idx; /* No hw_idx collected in branch_stack */ |
Andi Kleen | faaa876 | 2016-10-07 16:42:26 +0300 | [diff] [blame] | 152 | char insn[MAX_INSN]; |
OGAWA Hirofumi | 180f95e | 2009-12-06 20:08:24 +0900 | [diff] [blame] | 153 | void *raw_data; |
Arnaldo Carvalho de Melo | eed05fe | 2010-04-05 12:53:45 -0300 | [diff] [blame] | 154 | struct ip_callchain *callchain; |
Roberto Agostino Vitillo | b538752 | 2012-02-09 23:21:01 +0100 | [diff] [blame] | 155 | struct branch_stack *branch_stack; |
Jiri Olsa | 0f6a301 | 2012-08-07 15:20:45 +0200 | [diff] [blame] | 156 | struct regs_dump user_regs; |
Stephane Eranian | 6a21c0b | 2014-09-24 13:48:39 +0200 | [diff] [blame] | 157 | struct regs_dump intr_regs; |
Jiri Olsa | 0f6a301 | 2012-08-07 15:20:45 +0200 | [diff] [blame] | 158 | struct stack_dump user_stack; |
Jiri Olsa | 9ede473 | 2012-10-10 17:38:13 +0200 | [diff] [blame] | 159 | struct sample_read read; |
Adrian Hunter | 98dcf14 | 2019-11-15 14:42:11 +0200 | [diff] [blame] | 160 | struct aux_sample aux_sample; |
OGAWA Hirofumi | 180f95e | 2009-12-06 20:08:24 +0900 | [diff] [blame] | 161 | }; |
| 162 | |
Stephane Eranian | 98a3b32 | 2013-01-24 16:10:35 +0100 | [diff] [blame] | 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 | |
Adrian Hunter | 1405720 | 2017-06-21 13:17:19 +0300 | [diff] [blame] | 170 | /* Attribute type for custom synthesized events */ |
| 171 | #define PERF_TYPE_SYNTH (INT_MAX + 1U) |
| 172 | |
Adrian Hunter | 65c5e18 | 2017-06-30 11:36:42 +0300 | [diff] [blame] | 173 | /* Attribute config for custom synthesized events */ |
| 174 | enum 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 Hunter | c840cbf | 2021-02-05 19:53:50 +0200 | [diff] [blame] | 181 | PERF_SYNTH_INTEL_PSB, |
Adrian Hunter | 65c5e18 | 2017-06-30 11:36:42 +0300 | [diff] [blame] | 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 | |
| 193 | struct 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 | |
| 205 | struct 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 | |
| 219 | struct 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 | |
| 234 | struct 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 | |
| 245 | struct 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 | |
| 259 | struct 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 Hunter | c840cbf | 2021-02-05 19:53:50 +0200 | [diff] [blame] | 274 | struct perf_synth_intel_psb { |
| 275 | u32 padding; |
| 276 | u32 reserved; |
| 277 | u64 offset; |
| 278 | }; |
| 279 | |
Adrian Hunter | 65c5e18 | 2017-06-30 11:36:42 +0300 | [diff] [blame] | 280 | /* |
| 281 | * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get |
| 282 | * 8-byte alignment. |
| 283 | */ |
| 284 | static inline void *perf_sample__synth_ptr(struct perf_sample *sample) |
| 285 | { |
| 286 | return sample->raw_data - 4; |
| 287 | } |
| 288 | |
| 289 | static 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 Olsa | 2d8f0f1 | 2015-10-25 15:51:33 +0100 | [diff] [blame] | 298 | enum { |
| 299 | PERF_STAT_ROUND_TYPE__INTERVAL = 0, |
| 300 | PERF_STAT_ROUND_TYPE__FINAL = 1, |
| 301 | }; |
| 302 | |
Arnaldo Carvalho de Melo | 8115d60 | 2011-01-29 14:01:45 -0200 | [diff] [blame] | 303 | void perf_event__print_totals(void); |
Arnaldo Carvalho de Melo | 62daacb | 2009-11-27 16:29:22 -0200 | [diff] [blame] | 304 | |
Jiri Olsa | f854839 | 2019-07-21 13:23:49 +0200 | [diff] [blame] | 305 | struct perf_cpu_map; |
Arnaldo Carvalho de Melo | ea49e01 | 2019-09-18 11:36:13 -0300 | [diff] [blame] | 306 | struct perf_record_stat_config; |
Jiri Olsa | 6742434 | 2015-10-25 15:51:28 +0100 | [diff] [blame] | 307 | struct perf_stat_config; |
Arnaldo Carvalho de Melo | ea49e01 | 2019-09-18 11:36:13 -0300 | [diff] [blame] | 308 | struct perf_tool; |
Arnaldo Carvalho de Melo | 4aa6563 | 2009-12-13 19:50:29 -0200 | [diff] [blame] | 309 | |
Jiri Olsa | 8e38159 | 2015-10-25 15:51:29 +0100 | [diff] [blame] | 310 | void perf_event__read_stat_config(struct perf_stat_config *config, |
Jiri Olsa | 7293237 | 2019-08-28 15:57:16 +0200 | [diff] [blame] | 311 | struct perf_record_stat_config *event); |
Arnaldo Carvalho de Melo | 8115d60 | 2011-01-29 14:01:45 -0200 | [diff] [blame] | 312 | |
Arnaldo Carvalho de Melo | 45694aa | 2011-11-28 08:30:20 -0200 | [diff] [blame] | 313 | int perf_event__process_comm(struct perf_tool *tool, |
Arnaldo Carvalho de Melo | d20deb6 | 2011-11-25 08:19:45 -0200 | [diff] [blame] | 314 | union perf_event *event, |
| 315 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 316 | struct machine *machine); |
Arnaldo Carvalho de Melo | 45694aa | 2011-11-28 08:30:20 -0200 | [diff] [blame] | 317 | int perf_event__process_lost(struct perf_tool *tool, |
Arnaldo Carvalho de Melo | d20deb6 | 2011-11-25 08:19:45 -0200 | [diff] [blame] | 318 | union perf_event *event, |
| 319 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 320 | struct machine *machine); |
Kan Liang | c4937a9 | 2015-05-10 15:13:15 -0400 | [diff] [blame] | 321 | int perf_event__process_lost_samples(struct perf_tool *tool, |
| 322 | union perf_event *event, |
| 323 | struct perf_sample *sample, |
| 324 | struct machine *machine); |
Adrian Hunter | 4a96f7a | 2015-04-30 17:37:29 +0300 | [diff] [blame] | 325 | int perf_event__process_aux(struct perf_tool *tool, |
| 326 | union perf_event *event, |
| 327 | struct perf_sample *sample, |
| 328 | struct machine *machine); |
Adrian Hunter | 0ad21f6 | 2015-04-30 17:37:30 +0300 | [diff] [blame] | 329 | int perf_event__process_itrace_start(struct perf_tool *tool, |
| 330 | union perf_event *event, |
| 331 | struct perf_sample *sample, |
| 332 | struct machine *machine); |
Adrian Hunter | 0286039 | 2015-07-21 12:44:03 +0300 | [diff] [blame] | 333 | int perf_event__process_switch(struct perf_tool *tool, |
| 334 | union perf_event *event, |
| 335 | struct perf_sample *sample, |
| 336 | struct machine *machine); |
Hari Bathini | f3b3614 | 2017-03-08 02:11:43 +0530 | [diff] [blame] | 337 | int perf_event__process_namespaces(struct perf_tool *tool, |
| 338 | union perf_event *event, |
| 339 | struct perf_sample *sample, |
| 340 | struct machine *machine); |
Namhyung Kim | ba78c1c | 2020-03-25 21:45:30 +0900 | [diff] [blame] | 341 | int 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 Melo | 45694aa | 2011-11-28 08:30:20 -0200 | [diff] [blame] | 345 | int perf_event__process_mmap(struct perf_tool *tool, |
Arnaldo Carvalho de Melo | d20deb6 | 2011-11-25 08:19:45 -0200 | [diff] [blame] | 346 | union perf_event *event, |
| 347 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 348 | struct machine *machine); |
Stephane Eranian | 5c5e854 | 2013-08-21 12:10:25 +0200 | [diff] [blame] | 349 | int 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 Melo | f62d3f0 | 2012-10-06 15:44:59 -0300 | [diff] [blame] | 353 | int perf_event__process_fork(struct perf_tool *tool, |
| 354 | union perf_event *event, |
| 355 | struct perf_sample *sample, |
| 356 | struct machine *machine); |
| 357 | int perf_event__process_exit(struct perf_tool *tool, |
Arnaldo Carvalho de Melo | d20deb6 | 2011-11-25 08:19:45 -0200 | [diff] [blame] | 358 | union perf_event *event, |
| 359 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 360 | struct machine *machine); |
Song Liu | 9aa0bfa | 2019-01-17 08:15:17 -0800 | [diff] [blame] | 361 | int 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 Melo | 3f604b5 | 2019-08-26 19:28:13 -0300 | [diff] [blame] | 365 | int perf_event__process_bpf(struct perf_tool *tool, |
| 366 | union perf_event *event, |
| 367 | struct perf_sample *sample, |
| 368 | struct machine *machine); |
Adrian Hunter | 246eba8 | 2020-05-12 15:19:18 +0300 | [diff] [blame] | 369 | int 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 Melo | 45694aa | 2011-11-28 08:30:20 -0200 | [diff] [blame] | 373 | int perf_event__process(struct perf_tool *tool, |
Arnaldo Carvalho de Melo | d20deb6 | 2011-11-25 08:19:45 -0200 | [diff] [blame] | 374 | union perf_event *event, |
| 375 | struct perf_sample *sample, |
Arnaldo Carvalho de Melo | 743eb86 | 2011-11-28 07:56:39 -0200 | [diff] [blame] | 376 | struct machine *machine); |
Arnaldo Carvalho de Melo | 62daacb | 2009-11-27 16:29:22 -0200 | [diff] [blame] | 377 | |
Arnaldo Carvalho de Melo | 1ed091c | 2009-11-27 16:29:23 -0200 | [diff] [blame] | 378 | struct addr_location; |
Arnaldo Carvalho de Melo | 316c713 | 2013-11-05 15:32:36 -0300 | [diff] [blame] | 379 | |
Arnaldo Carvalho de Melo | bb3eb56 | 2016-03-22 18:39:09 -0300 | [diff] [blame] | 380 | int machine__resolve(struct machine *machine, struct addr_location *al, |
| 381 | struct perf_sample *sample); |
Arnaldo Carvalho de Melo | 1ed091c | 2009-11-27 16:29:23 -0200 | [diff] [blame] | 382 | |
Arnaldo Carvalho de Melo | b91fc39 | 2015-04-06 20:43:22 -0300 | [diff] [blame] | 383 | void addr_location__put(struct addr_location *al); |
| 384 | |
Adrian Hunter | 9b0d2d8 | 2014-07-22 16:17:39 +0300 | [diff] [blame] | 385 | struct thread; |
| 386 | |
| 387 | bool is_bts_event(struct perf_event_attr *attr); |
| 388 | bool sample_addr_correlates_sym(struct perf_event_attr *attr); |
Arnaldo Carvalho de Melo | c2740a8 | 2016-03-22 18:44:46 -0300 | [diff] [blame] | 389 | void thread__resolve(struct thread *thread, struct addr_location *al, |
| 390 | struct perf_sample *sample); |
Adrian Hunter | 9b0d2d8 | 2014-07-22 16:17:39 +0300 | [diff] [blame] | 391 | |
Arnaldo Carvalho de Melo | 8115d60 | 2011-01-29 14:01:45 -0200 | [diff] [blame] | 392 | const char *perf_event__name(unsigned int id); |
Arnaldo Carvalho de Melo | c8446b9 | 2010-05-14 10:36:42 -0300 | [diff] [blame] | 393 | |
Arnaldo Carvalho de Melo | 482ad89 | 2011-12-02 11:06:37 -0200 | [diff] [blame] | 394 | size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); |
| 395 | size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); |
Stephane Eranian | 5c5e854 | 2013-08-21 12:10:25 +0200 | [diff] [blame] | 396 | size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp); |
Arnaldo Carvalho de Melo | 482ad89 | 2011-12-02 11:06:37 -0200 | [diff] [blame] | 397 | size_t perf_event__fprintf_task(union perf_event *event, FILE *fp); |
Adrian Hunter | 4a96f7a | 2015-04-30 17:37:29 +0300 | [diff] [blame] | 398 | size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp); |
Adrian Hunter | 0ad21f6 | 2015-04-30 17:37:30 +0300 | [diff] [blame] | 399 | size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp); |
Adrian Hunter | 0286039 | 2015-07-21 12:44:03 +0300 | [diff] [blame] | 400 | size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp); |
Jiri Olsa | ec7fa596 | 2015-10-25 15:51:22 +0100 | [diff] [blame] | 401 | size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp); |
Jiri Olsa | eb12a1a | 2015-10-25 15:51:26 +0100 | [diff] [blame] | 402 | size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); |
Hari Bathini | f3b3614 | 2017-03-08 02:11:43 +0530 | [diff] [blame] | 403 | size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); |
Namhyung Kim | ba78c1c | 2020-03-25 21:45:30 +0900 | [diff] [blame] | 404 | size_t perf_event__fprintf_cgroup(union perf_event *event, FILE *fp); |
Song Liu | 9aa0bfa | 2019-01-17 08:15:17 -0800 | [diff] [blame] | 405 | size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); |
Arnaldo Carvalho de Melo | 3f604b5 | 2019-08-26 19:28:13 -0300 | [diff] [blame] | 406 | size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp); |
Adrian Hunter | 7eeb985 | 2020-05-12 15:19:22 +0300 | [diff] [blame] | 407 | size_t perf_event__fprintf_text_poke(union perf_event *event, struct machine *machine,FILE *fp); |
| 408 | size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FILE *fp); |
Arnaldo Carvalho de Melo | 482ad89 | 2011-12-02 11:06:37 -0200 | [diff] [blame] | 409 | |
Arnaldo Carvalho de Melo | b843f62 | 2017-04-27 21:21:09 -0300 | [diff] [blame] | 410 | int kallsyms__get_function_start(const char *kallsyms_filename, |
| 411 | const char *symbol_name, u64 *addr); |
Adrian Hunter | 29b596b | 2014-01-29 16:14:37 +0200 | [diff] [blame] | 412 | |
Jiri Olsa | f854839 | 2019-07-21 13:23:49 +0200 | [diff] [blame] | 413 | void *cpu_map_data__alloc(struct perf_cpu_map *map, size_t *size, u16 *type, int *max); |
Jiri Olsa | 7293237 | 2019-08-28 15:57:16 +0200 | [diff] [blame] | 414 | void cpu_map_data__synthesize(struct perf_record_cpu_map_data *data, struct perf_cpu_map *map, |
Jiri Olsa | 6c87290 | 2015-10-25 15:51:24 +0100 | [diff] [blame] | 415 | u16 type, int max); |
Arnaldo Carvalho de Melo | 5ab8c68 | 2017-04-25 15:30:47 -0300 | [diff] [blame] | 416 | |
| 417 | void event_attr_init(struct perf_event_attr *attr); |
| 418 | |
| 419 | int perf_event_paranoid(void); |
Igor Lubashev | c22e150 | 2019-08-07 10:44:14 -0400 | [diff] [blame] | 420 | bool perf_event_paranoid_check(int max_level); |
Arnaldo Carvalho de Melo | 5ab8c68 | 2017-04-25 15:30:47 -0300 | [diff] [blame] | 421 | |
| 422 | extern int sysctl_perf_event_max_stack; |
| 423 | extern int sysctl_perf_event_max_contexts_per_stack; |
Mark Drayton | 3fcb10e | 2018-12-04 12:34:20 -0800 | [diff] [blame] | 424 | extern unsigned int proc_map_timeout; |
Arnaldo Carvalho de Melo | 5ab8c68 | 2017-04-25 15:30:47 -0300 | [diff] [blame] | 425 | |
Kan Liang | 6b9bae6 | 2020-12-16 10:57:57 -0800 | [diff] [blame] | 426 | #define PAGE_SIZE_NAME_LEN 32 |
| 427 | char *get_page_size_name(u64 size, char *str); |
| 428 | |
Kan Liang | fbefe9c | 2021-02-05 08:01:52 -0800 | [diff] [blame] | 429 | void arch_perf_parse_sample_weight(struct perf_sample *data, const __u64 *array, u64 type); |
| 430 | void arch_perf_synthesize_sample_weight(const struct perf_sample *data, __u64 *array, u64 type); |
Athira Rajeev | 0a60682 | 2021-03-22 10:57:24 -0400 | [diff] [blame] | 431 | const char *arch_perf_header_entry(const char *se_header); |
Athira Rajeev | 50fa3a5 | 2021-03-22 10:57:27 -0400 | [diff] [blame] | 432 | int arch_support_sort_key(const char *sort_key); |
Kan Liang | fbefe9c | 2021-02-05 08:01:52 -0800 | [diff] [blame] | 433 | |
John Kacur | 8b40f52 | 2009-09-24 18:02:18 +0200 | [diff] [blame] | 434 | #endif /* __PERF_RECORD_H */ |