1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __PERF_RECORD_H 3 #define __PERF_RECORD_H 4 5 #include <limits.h> 6 #include <stdio.h> 7 #include <linux/kernel.h> 8 #include <linux/bpf.h> 9 #include <linux/perf_event.h> 10 11 #include "../perf.h" 12 #include "build-id.h" 13 #include "perf_regs.h" 14 15 struct mmap_event { 16 struct perf_event_header header; 17 u32 pid, tid; 18 u64 start; 19 u64 len; 20 u64 pgoff; 21 char filename[PATH_MAX]; 22 }; 23 24 struct mmap2_event { 25 struct perf_event_header header; 26 u32 pid, tid; 27 u64 start; 28 u64 len; 29 u64 pgoff; 30 u32 maj; 31 u32 min; 32 u64 ino; 33 u64 ino_generation; 34 u32 prot; 35 u32 flags; 36 char filename[PATH_MAX]; 37 }; 38 39 struct comm_event { 40 struct perf_event_header header; 41 u32 pid, tid; 42 char comm[16]; 43 }; 44 45 struct namespaces_event { 46 struct perf_event_header header; 47 u32 pid, tid; 48 u64 nr_namespaces; 49 struct perf_ns_link_info link_info[]; 50 }; 51 52 struct fork_event { 53 struct perf_event_header header; 54 u32 pid, ppid; 55 u32 tid, ptid; 56 u64 time; 57 }; 58 59 struct lost_event { 60 struct perf_event_header header; 61 u64 id; 62 u64 lost; 63 }; 64 65 struct lost_samples_event { 66 struct perf_event_header header; 67 u64 lost; 68 }; 69 70 /* 71 * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID 72 */ 73 struct read_event { 74 struct perf_event_header header; 75 u32 pid, tid; 76 u64 value; 77 u64 time_enabled; 78 u64 time_running; 79 u64 id; 80 }; 81 82 struct throttle_event { 83 struct perf_event_header header; 84 u64 time; 85 u64 id; 86 u64 stream_id; 87 }; 88 89 #ifndef KSYM_NAME_LEN 90 #define KSYM_NAME_LEN 256 91 #endif 92 93 struct ksymbol_event { 94 struct perf_event_header header; 95 u64 addr; 96 u32 len; 97 u16 ksym_type; 98 u16 flags; 99 char name[KSYM_NAME_LEN]; 100 }; 101 102 struct bpf_event { 103 struct perf_event_header header; 104 u16 type; 105 u16 flags; 106 u32 id; 107 108 /* for bpf_prog types */ 109 u8 tag[BPF_TAG_SIZE]; // prog tag 110 }; 111 112 #define PERF_SAMPLE_MASK \ 113 (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ 114 PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \ 115 PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \ 116 PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \ 117 PERF_SAMPLE_IDENTIFIER) 118 119 /* perf sample has 16 bits size limit */ 120 #define PERF_SAMPLE_MAX_SIZE (1 << 16) 121 122 struct sample_event { 123 struct perf_event_header header; 124 u64 array[]; 125 }; 126 127 struct regs_dump { 128 u64 abi; 129 u64 mask; 130 u64 *regs; 131 132 /* Cached values/mask filled by first register access. */ 133 u64 cache_regs[PERF_REGS_MAX]; 134 u64 cache_mask; 135 }; 136 137 struct stack_dump { 138 u16 offset; 139 u64 size; 140 char *data; 141 }; 142 143 struct sample_read_value { 144 u64 value; 145 u64 id; 146 }; 147 148 struct sample_read { 149 u64 time_enabled; 150 u64 time_running; 151 union { 152 struct { 153 u64 nr; 154 struct sample_read_value *values; 155 } group; 156 struct sample_read_value one; 157 }; 158 }; 159 160 struct ip_callchain { 161 u64 nr; 162 u64 ips[0]; 163 }; 164 165 struct branch_stack; 166 167 enum { 168 PERF_IP_FLAG_BRANCH = 1ULL << 0, 169 PERF_IP_FLAG_CALL = 1ULL << 1, 170 PERF_IP_FLAG_RETURN = 1ULL << 2, 171 PERF_IP_FLAG_CONDITIONAL = 1ULL << 3, 172 PERF_IP_FLAG_SYSCALLRET = 1ULL << 4, 173 PERF_IP_FLAG_ASYNC = 1ULL << 5, 174 PERF_IP_FLAG_INTERRUPT = 1ULL << 6, 175 PERF_IP_FLAG_TX_ABORT = 1ULL << 7, 176 PERF_IP_FLAG_TRACE_BEGIN = 1ULL << 8, 177 PERF_IP_FLAG_TRACE_END = 1ULL << 9, 178 PERF_IP_FLAG_IN_TX = 1ULL << 10, 179 }; 180 181 #define PERF_IP_FLAG_CHARS "bcrosyiABEx" 182 183 #define PERF_BRANCH_MASK (\ 184 PERF_IP_FLAG_BRANCH |\ 185 PERF_IP_FLAG_CALL |\ 186 PERF_IP_FLAG_RETURN |\ 187 PERF_IP_FLAG_CONDITIONAL |\ 188 PERF_IP_FLAG_SYSCALLRET |\ 189 PERF_IP_FLAG_ASYNC |\ 190 PERF_IP_FLAG_INTERRUPT |\ 191 PERF_IP_FLAG_TX_ABORT |\ 192 PERF_IP_FLAG_TRACE_BEGIN |\ 193 PERF_IP_FLAG_TRACE_END) 194 195 #define MAX_INSN 16 196 197 struct perf_sample { 198 u64 ip; 199 u32 pid, tid; 200 u64 time; 201 u64 addr; 202 u64 id; 203 u64 stream_id; 204 u64 period; 205 u64 weight; 206 u64 transaction; 207 u32 cpu; 208 u32 raw_size; 209 u64 data_src; 210 u64 phys_addr; 211 u32 flags; 212 u16 insn_len; 213 u8 cpumode; 214 u16 misc; 215 char insn[MAX_INSN]; 216 void *raw_data; 217 struct ip_callchain *callchain; 218 struct branch_stack *branch_stack; 219 struct regs_dump user_regs; 220 struct regs_dump intr_regs; 221 struct stack_dump user_stack; 222 struct sample_read read; 223 }; 224 225 #define PERF_MEM_DATA_SRC_NONE \ 226 (PERF_MEM_S(OP, NA) |\ 227 PERF_MEM_S(LVL, NA) |\ 228 PERF_MEM_S(SNOOP, NA) |\ 229 PERF_MEM_S(LOCK, NA) |\ 230 PERF_MEM_S(TLB, NA)) 231 232 struct build_id_event { 233 struct perf_event_header header; 234 pid_t pid; 235 u8 build_id[PERF_ALIGN(BUILD_ID_SIZE, sizeof(u64))]; 236 char filename[]; 237 }; 238 239 enum perf_user_event_type { /* above any possible kernel type */ 240 PERF_RECORD_USER_TYPE_START = 64, 241 PERF_RECORD_HEADER_ATTR = 64, 242 PERF_RECORD_HEADER_EVENT_TYPE = 65, /* deprecated */ 243 PERF_RECORD_HEADER_TRACING_DATA = 66, 244 PERF_RECORD_HEADER_BUILD_ID = 67, 245 PERF_RECORD_FINISHED_ROUND = 68, 246 PERF_RECORD_ID_INDEX = 69, 247 PERF_RECORD_AUXTRACE_INFO = 70, 248 PERF_RECORD_AUXTRACE = 71, 249 PERF_RECORD_AUXTRACE_ERROR = 72, 250 PERF_RECORD_THREAD_MAP = 73, 251 PERF_RECORD_CPU_MAP = 74, 252 PERF_RECORD_STAT_CONFIG = 75, 253 PERF_RECORD_STAT = 76, 254 PERF_RECORD_STAT_ROUND = 77, 255 PERF_RECORD_EVENT_UPDATE = 78, 256 PERF_RECORD_TIME_CONV = 79, 257 PERF_RECORD_HEADER_FEATURE = 80, 258 PERF_RECORD_COMPRESSED = 81, 259 PERF_RECORD_HEADER_MAX 260 }; 261 262 enum auxtrace_error_type { 263 PERF_AUXTRACE_ERROR_ITRACE = 1, 264 PERF_AUXTRACE_ERROR_MAX 265 }; 266 267 /* Attribute type for custom synthesized events */ 268 #define PERF_TYPE_SYNTH (INT_MAX + 1U) 269 270 /* Attribute config for custom synthesized events */ 271 enum perf_synth_id { 272 PERF_SYNTH_INTEL_PTWRITE, 273 PERF_SYNTH_INTEL_MWAIT, 274 PERF_SYNTH_INTEL_PWRE, 275 PERF_SYNTH_INTEL_EXSTOP, 276 PERF_SYNTH_INTEL_PWRX, 277 PERF_SYNTH_INTEL_CBR, 278 }; 279 280 /* 281 * Raw data formats for synthesized events. Note that 4 bytes of padding are 282 * present to match the 'size' member of PERF_SAMPLE_RAW data which is always 283 * 8-byte aligned. That means we must dereference raw_data with an offset of 4. 284 * Refer perf_sample__synth_ptr() and perf_synth__raw_data(). It also means the 285 * structure sizes are 4 bytes bigger than the raw_size, refer 286 * perf_synth__raw_size(). 287 */ 288 289 struct perf_synth_intel_ptwrite { 290 u32 padding; 291 union { 292 struct { 293 u32 ip : 1, 294 reserved : 31; 295 }; 296 u32 flags; 297 }; 298 u64 payload; 299 }; 300 301 struct perf_synth_intel_mwait { 302 u32 padding; 303 u32 reserved; 304 union { 305 struct { 306 u64 hints : 8, 307 reserved1 : 24, 308 extensions : 2, 309 reserved2 : 30; 310 }; 311 u64 payload; 312 }; 313 }; 314 315 struct perf_synth_intel_pwre { 316 u32 padding; 317 u32 reserved; 318 union { 319 struct { 320 u64 reserved1 : 7, 321 hw : 1, 322 subcstate : 4, 323 cstate : 4, 324 reserved2 : 48; 325 }; 326 u64 payload; 327 }; 328 }; 329 330 struct perf_synth_intel_exstop { 331 u32 padding; 332 union { 333 struct { 334 u32 ip : 1, 335 reserved : 31; 336 }; 337 u32 flags; 338 }; 339 }; 340 341 struct perf_synth_intel_pwrx { 342 u32 padding; 343 u32 reserved; 344 union { 345 struct { 346 u64 deepest_cstate : 4, 347 last_cstate : 4, 348 wake_reason : 4, 349 reserved1 : 52; 350 }; 351 u64 payload; 352 }; 353 }; 354 355 struct perf_synth_intel_cbr { 356 u32 padding; 357 union { 358 struct { 359 u32 cbr : 8, 360 reserved1 : 8, 361 max_nonturbo : 8, 362 reserved2 : 8; 363 }; 364 u32 flags; 365 }; 366 u32 freq; 367 u32 reserved3; 368 }; 369 370 /* 371 * raw_data is always 4 bytes from an 8-byte boundary, so subtract 4 to get 372 * 8-byte alignment. 373 */ 374 static inline void *perf_sample__synth_ptr(struct perf_sample *sample) 375 { 376 return sample->raw_data - 4; 377 } 378 379 static inline void *perf_synth__raw_data(void *p) 380 { 381 return p + 4; 382 } 383 384 #define perf_synth__raw_size(d) (sizeof(d) - 4) 385 386 #define perf_sample__bad_synth_size(s, d) ((s)->raw_size < sizeof(d) - 4) 387 388 /* 389 * The kernel collects the number of events it couldn't send in a stretch and 390 * when possible sends this number in a PERF_RECORD_LOST event. The number of 391 * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while 392 * total_lost tells exactly how many events the kernel in fact lost, i.e. it is 393 * the sum of all struct lost_event.lost fields reported. 394 * 395 * The kernel discards mixed up samples and sends the number in a 396 * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored 397 * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells 398 * exactly how many samples the kernel in fact dropped, i.e. it is the sum of 399 * all struct lost_samples_event.lost fields reported. 400 * 401 * The total_period is needed because by default auto-freq is used, so 402 * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get 403 * the total number of low level events, it is necessary to to sum all struct 404 * sample_event.period and stash the result in total_period. 405 */ 406 struct events_stats { 407 u64 total_period; 408 u64 total_non_filtered_period; 409 u64 total_lost; 410 u64 total_lost_samples; 411 u64 total_aux_lost; 412 u64 total_aux_partial; 413 u64 total_invalid_chains; 414 u32 nr_events[PERF_RECORD_HEADER_MAX]; 415 u32 nr_non_filtered_samples; 416 u32 nr_lost_warned; 417 u32 nr_unknown_events; 418 u32 nr_invalid_chains; 419 u32 nr_unknown_id; 420 u32 nr_unprocessable_samples; 421 u32 nr_auxtrace_errors[PERF_AUXTRACE_ERROR_MAX]; 422 u32 nr_proc_map_timeout; 423 }; 424 425 enum { 426 PERF_CPU_MAP__CPUS = 0, 427 PERF_CPU_MAP__MASK = 1, 428 }; 429 430 struct cpu_map_entries { 431 u16 nr; 432 u16 cpu[]; 433 }; 434 435 struct cpu_map_mask { 436 u16 nr; 437 u16 long_size; 438 unsigned long mask[]; 439 }; 440 441 struct cpu_map_data { 442 u16 type; 443 char data[]; 444 }; 445 446 struct cpu_map_event { 447 struct perf_event_header header; 448 struct cpu_map_data data; 449 }; 450 451 struct attr_event { 452 struct perf_event_header header; 453 struct perf_event_attr attr; 454 u64 id[]; 455 }; 456 457 enum { 458 PERF_EVENT_UPDATE__UNIT = 0, 459 PERF_EVENT_UPDATE__SCALE = 1, 460 PERF_EVENT_UPDATE__NAME = 2, 461 PERF_EVENT_UPDATE__CPUS = 3, 462 }; 463 464 struct event_update_event_cpus { 465 struct cpu_map_data cpus; 466 }; 467 468 struct event_update_event_scale { 469 double scale; 470 }; 471 472 struct event_update_event { 473 struct perf_event_header header; 474 u64 type; 475 u64 id; 476 477 char data[]; 478 }; 479 480 #define MAX_EVENT_NAME 64 481 482 struct perf_trace_event_type { 483 u64 event_id; 484 char name[MAX_EVENT_NAME]; 485 }; 486 487 struct event_type_event { 488 struct perf_event_header header; 489 struct perf_trace_event_type event_type; 490 }; 491 492 struct tracing_data_event { 493 struct perf_event_header header; 494 u32 size; 495 }; 496 497 struct id_index_entry { 498 u64 id; 499 u64 idx; 500 u64 cpu; 501 u64 tid; 502 }; 503 504 struct id_index_event { 505 struct perf_event_header header; 506 u64 nr; 507 struct id_index_entry entries[0]; 508 }; 509 510 struct auxtrace_info_event { 511 struct perf_event_header header; 512 u32 type; 513 u32 reserved__; /* For alignment */ 514 u64 priv[]; 515 }; 516 517 struct auxtrace_event { 518 struct perf_event_header header; 519 u64 size; 520 u64 offset; 521 u64 reference; 522 u32 idx; 523 u32 tid; 524 u32 cpu; 525 u32 reserved__; /* For alignment */ 526 }; 527 528 #define MAX_AUXTRACE_ERROR_MSG 64 529 530 struct auxtrace_error_event { 531 struct perf_event_header header; 532 u32 type; 533 u32 code; 534 u32 cpu; 535 u32 pid; 536 u32 tid; 537 u32 fmt; 538 u64 ip; 539 u64 time; 540 char msg[MAX_AUXTRACE_ERROR_MSG]; 541 }; 542 543 struct aux_event { 544 struct perf_event_header header; 545 u64 aux_offset; 546 u64 aux_size; 547 u64 flags; 548 }; 549 550 struct itrace_start_event { 551 struct perf_event_header header; 552 u32 pid, tid; 553 }; 554 555 struct context_switch_event { 556 struct perf_event_header header; 557 u32 next_prev_pid; 558 u32 next_prev_tid; 559 }; 560 561 struct thread_map_event_entry { 562 u64 pid; 563 char comm[16]; 564 }; 565 566 struct thread_map_event { 567 struct perf_event_header header; 568 u64 nr; 569 struct thread_map_event_entry entries[]; 570 }; 571 572 enum { 573 PERF_STAT_CONFIG_TERM__AGGR_MODE = 0, 574 PERF_STAT_CONFIG_TERM__INTERVAL = 1, 575 PERF_STAT_CONFIG_TERM__SCALE = 2, 576 PERF_STAT_CONFIG_TERM__MAX = 3, 577 }; 578 579 struct stat_config_event_entry { 580 u64 tag; 581 u64 val; 582 }; 583 584 struct stat_config_event { 585 struct perf_event_header header; 586 u64 nr; 587 struct stat_config_event_entry data[]; 588 }; 589 590 struct stat_event { 591 struct perf_event_header header; 592 593 u64 id; 594 u32 cpu; 595 u32 thread; 596 597 union { 598 struct { 599 u64 val; 600 u64 ena; 601 u64 run; 602 }; 603 u64 values[3]; 604 }; 605 }; 606 607 enum { 608 PERF_STAT_ROUND_TYPE__INTERVAL = 0, 609 PERF_STAT_ROUND_TYPE__FINAL = 1, 610 }; 611 612 struct stat_round_event { 613 struct perf_event_header header; 614 u64 type; 615 u64 time; 616 }; 617 618 struct time_conv_event { 619 struct perf_event_header header; 620 u64 time_shift; 621 u64 time_mult; 622 u64 time_zero; 623 }; 624 625 struct feature_event { 626 struct perf_event_header header; 627 u64 feat_id; 628 char data[]; 629 }; 630 631 struct compressed_event { 632 struct perf_event_header header; 633 char data[]; 634 }; 635 636 union perf_event { 637 struct perf_event_header header; 638 struct mmap_event mmap; 639 struct mmap2_event mmap2; 640 struct comm_event comm; 641 struct namespaces_event namespaces; 642 struct fork_event fork; 643 struct lost_event lost; 644 struct lost_samples_event lost_samples; 645 struct read_event read; 646 struct throttle_event throttle; 647 struct sample_event sample; 648 struct attr_event attr; 649 struct event_update_event event_update; 650 struct event_type_event event_type; 651 struct tracing_data_event tracing_data; 652 struct build_id_event build_id; 653 struct id_index_event id_index; 654 struct auxtrace_info_event auxtrace_info; 655 struct auxtrace_event auxtrace; 656 struct auxtrace_error_event auxtrace_error; 657 struct aux_event aux; 658 struct itrace_start_event itrace_start; 659 struct context_switch_event context_switch; 660 struct thread_map_event thread_map; 661 struct cpu_map_event cpu_map; 662 struct stat_config_event stat_config; 663 struct stat_event stat; 664 struct stat_round_event stat_round; 665 struct time_conv_event time_conv; 666 struct feature_event feat; 667 struct ksymbol_event ksymbol_event; 668 struct bpf_event bpf_event; 669 struct compressed_event pack; 670 }; 671 672 void perf_event__print_totals(void); 673 674 struct perf_tool; 675 struct thread_map; 676 struct cpu_map; 677 struct perf_stat_config; 678 struct perf_counts_values; 679 680 typedef int (*perf_event__handler_t)(struct perf_tool *tool, 681 union perf_event *event, 682 struct perf_sample *sample, 683 struct machine *machine); 684 685 int perf_event__synthesize_thread_map(struct perf_tool *tool, 686 struct thread_map *threads, 687 perf_event__handler_t process, 688 struct machine *machine, bool mmap_data); 689 int perf_event__synthesize_thread_map2(struct perf_tool *tool, 690 struct thread_map *threads, 691 perf_event__handler_t process, 692 struct machine *machine); 693 int perf_event__synthesize_cpu_map(struct perf_tool *tool, 694 struct cpu_map *cpus, 695 perf_event__handler_t process, 696 struct machine *machine); 697 int perf_event__synthesize_threads(struct perf_tool *tool, 698 perf_event__handler_t process, 699 struct machine *machine, bool mmap_data, 700 unsigned int nr_threads_synthesize); 701 int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, 702 perf_event__handler_t process, 703 struct machine *machine); 704 int perf_event__synthesize_stat_config(struct perf_tool *tool, 705 struct perf_stat_config *config, 706 perf_event__handler_t process, 707 struct machine *machine); 708 void perf_event__read_stat_config(struct perf_stat_config *config, 709 struct stat_config_event *event); 710 int perf_event__synthesize_stat(struct perf_tool *tool, 711 u32 cpu, u32 thread, u64 id, 712 struct perf_counts_values *count, 713 perf_event__handler_t process, 714 struct machine *machine); 715 int perf_event__synthesize_stat_round(struct perf_tool *tool, 716 u64 time, u64 type, 717 perf_event__handler_t process, 718 struct machine *machine); 719 int perf_event__synthesize_modules(struct perf_tool *tool, 720 perf_event__handler_t process, 721 struct machine *machine); 722 723 int perf_event__process_comm(struct perf_tool *tool, 724 union perf_event *event, 725 struct perf_sample *sample, 726 struct machine *machine); 727 int perf_event__process_lost(struct perf_tool *tool, 728 union perf_event *event, 729 struct perf_sample *sample, 730 struct machine *machine); 731 int perf_event__process_lost_samples(struct perf_tool *tool, 732 union perf_event *event, 733 struct perf_sample *sample, 734 struct machine *machine); 735 int perf_event__process_aux(struct perf_tool *tool, 736 union perf_event *event, 737 struct perf_sample *sample, 738 struct machine *machine); 739 int perf_event__process_itrace_start(struct perf_tool *tool, 740 union perf_event *event, 741 struct perf_sample *sample, 742 struct machine *machine); 743 int perf_event__process_switch(struct perf_tool *tool, 744 union perf_event *event, 745 struct perf_sample *sample, 746 struct machine *machine); 747 int perf_event__process_namespaces(struct perf_tool *tool, 748 union perf_event *event, 749 struct perf_sample *sample, 750 struct machine *machine); 751 int perf_event__process_mmap(struct perf_tool *tool, 752 union perf_event *event, 753 struct perf_sample *sample, 754 struct machine *machine); 755 int perf_event__process_mmap2(struct perf_tool *tool, 756 union perf_event *event, 757 struct perf_sample *sample, 758 struct machine *machine); 759 int perf_event__process_fork(struct perf_tool *tool, 760 union perf_event *event, 761 struct perf_sample *sample, 762 struct machine *machine); 763 int perf_event__process_exit(struct perf_tool *tool, 764 union perf_event *event, 765 struct perf_sample *sample, 766 struct machine *machine); 767 int perf_event__process_ksymbol(struct perf_tool *tool, 768 union perf_event *event, 769 struct perf_sample *sample, 770 struct machine *machine); 771 int perf_event__process_bpf_event(struct perf_tool *tool, 772 union perf_event *event, 773 struct perf_sample *sample, 774 struct machine *machine); 775 int perf_tool__process_synth_event(struct perf_tool *tool, 776 union perf_event *event, 777 struct machine *machine, 778 perf_event__handler_t process); 779 int perf_event__process(struct perf_tool *tool, 780 union perf_event *event, 781 struct perf_sample *sample, 782 struct machine *machine); 783 784 struct addr_location; 785 786 int machine__resolve(struct machine *machine, struct addr_location *al, 787 struct perf_sample *sample); 788 789 void addr_location__put(struct addr_location *al); 790 791 struct thread; 792 793 bool is_bts_event(struct perf_event_attr *attr); 794 bool sample_addr_correlates_sym(struct perf_event_attr *attr); 795 void thread__resolve(struct thread *thread, struct addr_location *al, 796 struct perf_sample *sample); 797 798 const char *perf_event__name(unsigned int id); 799 800 size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, 801 u64 read_format); 802 int perf_event__synthesize_sample(union perf_event *event, u64 type, 803 u64 read_format, 804 const struct perf_sample *sample); 805 806 pid_t perf_event__synthesize_comm(struct perf_tool *tool, 807 union perf_event *event, pid_t pid, 808 perf_event__handler_t process, 809 struct machine *machine); 810 811 int perf_event__synthesize_namespaces(struct perf_tool *tool, 812 union perf_event *event, 813 pid_t pid, pid_t tgid, 814 perf_event__handler_t process, 815 struct machine *machine); 816 817 int perf_event__synthesize_mmap_events(struct perf_tool *tool, 818 union perf_event *event, 819 pid_t pid, pid_t tgid, 820 perf_event__handler_t process, 821 struct machine *machine, 822 bool mmap_data); 823 824 int perf_event__synthesize_extra_kmaps(struct perf_tool *tool, 825 perf_event__handler_t process, 826 struct machine *machine); 827 828 size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); 829 size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); 830 size_t perf_event__fprintf_mmap2(union perf_event *event, FILE *fp); 831 size_t perf_event__fprintf_task(union perf_event *event, FILE *fp); 832 size_t perf_event__fprintf_aux(union perf_event *event, FILE *fp); 833 size_t perf_event__fprintf_itrace_start(union perf_event *event, FILE *fp); 834 size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp); 835 size_t perf_event__fprintf_thread_map(union perf_event *event, FILE *fp); 836 size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp); 837 size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp); 838 size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp); 839 size_t perf_event__fprintf_bpf_event(union perf_event *event, FILE *fp); 840 size_t perf_event__fprintf(union perf_event *event, FILE *fp); 841 842 int kallsyms__get_function_start(const char *kallsyms_filename, 843 const char *symbol_name, u64 *addr); 844 845 void *cpu_map_data__alloc(struct cpu_map *map, size_t *size, u16 *type, int *max); 846 void cpu_map_data__synthesize(struct cpu_map_data *data, struct cpu_map *map, 847 u16 type, int max); 848 849 void event_attr_init(struct perf_event_attr *attr); 850 851 int perf_event_paranoid(void); 852 853 extern int sysctl_perf_event_max_stack; 854 extern int sysctl_perf_event_max_contexts_per_stack; 855 extern unsigned int proc_map_timeout; 856 857 #endif /* __PERF_RECORD_H */ 858