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