.. | .. |
---|
141 | 141 | PERF_SAMPLE_TRANSACTION = 1U << 17, |
---|
142 | 142 | PERF_SAMPLE_REGS_INTR = 1U << 18, |
---|
143 | 143 | PERF_SAMPLE_PHYS_ADDR = 1U << 19, |
---|
| 144 | + PERF_SAMPLE_AUX = 1U << 20, |
---|
| 145 | + PERF_SAMPLE_CGROUP = 1U << 21, |
---|
144 | 146 | |
---|
145 | | - PERF_SAMPLE_MAX = 1U << 20, /* non-ABI */ |
---|
| 147 | + PERF_SAMPLE_MAX = 1U << 22, /* non-ABI */ |
---|
146 | 148 | |
---|
147 | 149 | __PERF_SAMPLE_CALLCHAIN_EARLY = 1ULL << 63, /* non-ABI; internal use */ |
---|
148 | 150 | }; |
---|
.. | .. |
---|
180 | 182 | |
---|
181 | 183 | PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, /* save branch type */ |
---|
182 | 184 | |
---|
| 185 | + PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17, /* save low level index of raw branch records */ |
---|
| 186 | + |
---|
183 | 187 | PERF_SAMPLE_BRANCH_MAX_SHIFT /* non-ABI */ |
---|
184 | 188 | }; |
---|
185 | 189 | |
---|
.. | .. |
---|
206 | 210 | |
---|
207 | 211 | PERF_SAMPLE_BRANCH_TYPE_SAVE = |
---|
208 | 212 | 1U << PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT, |
---|
| 213 | + |
---|
| 214 | + PERF_SAMPLE_BRANCH_HW_INDEX = 1U << PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT, |
---|
209 | 215 | |
---|
210 | 216 | PERF_SAMPLE_BRANCH_MAX = 1U << PERF_SAMPLE_BRANCH_MAX_SHIFT, |
---|
211 | 217 | }; |
---|
.. | .. |
---|
300 | 306 | /* add: sample_stack_user */ |
---|
301 | 307 | #define PERF_ATTR_SIZE_VER4 104 /* add: sample_regs_intr */ |
---|
302 | 308 | #define PERF_ATTR_SIZE_VER5 112 /* add: aux_watermark */ |
---|
| 309 | +#define PERF_ATTR_SIZE_VER6 120 /* add: aux_sample_size */ |
---|
303 | 310 | |
---|
304 | 311 | /* |
---|
305 | 312 | * Hardware event_id to monitor via a performance monitoring event: |
---|
.. | .. |
---|
372 | 379 | context_switch : 1, /* context switch data */ |
---|
373 | 380 | write_backward : 1, /* Write ring buffer from end to beginning */ |
---|
374 | 381 | namespaces : 1, /* include namespaces data */ |
---|
375 | | - __reserved_1 : 35; |
---|
| 382 | + ksymbol : 1, /* include ksymbol events */ |
---|
| 383 | + bpf_event : 1, /* include bpf events */ |
---|
| 384 | + aux_output : 1, /* generate AUX records instead of events */ |
---|
| 385 | + cgroup : 1, /* include cgroup events */ |
---|
| 386 | + text_poke : 1, /* include text poke events */ |
---|
| 387 | + __reserved_1 : 30; |
---|
376 | 388 | |
---|
377 | 389 | union { |
---|
378 | 390 | __u32 wakeup_events; /* wakeup every n events */ |
---|
.. | .. |
---|
421 | 433 | */ |
---|
422 | 434 | __u32 aux_watermark; |
---|
423 | 435 | __u16 sample_max_stack; |
---|
424 | | - __u16 __reserved_2; /* align to __u64 */ |
---|
| 436 | + __u16 __reserved_2; |
---|
| 437 | + __u32 aux_sample_size; |
---|
| 438 | + __u32 __reserved_3; |
---|
425 | 439 | }; |
---|
426 | 440 | |
---|
427 | 441 | /* |
---|
.. | .. |
---|
444 | 458 | */ |
---|
445 | 459 | __u32 ids[0]; |
---|
446 | 460 | }; |
---|
447 | | - |
---|
448 | | -#define perf_flags(attr) (*(&(attr)->read_format + 1)) |
---|
449 | 461 | |
---|
450 | 462 | /* |
---|
451 | 463 | * Ioctls that can be done on a perf event fd: |
---|
.. | .. |
---|
521 | 533 | cap_bit0_is_deprecated : 1, /* Always 1, signals that bit 0 is zero */ |
---|
522 | 534 | |
---|
523 | 535 | cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */ |
---|
524 | | - cap_user_time : 1, /* The time_* fields are used */ |
---|
| 536 | + cap_user_time : 1, /* The time_{shift,mult,offset} fields are used */ |
---|
525 | 537 | cap_user_time_zero : 1, /* The time_zero field is used */ |
---|
526 | | - cap_____res : 59; |
---|
| 538 | + cap_user_time_short : 1, /* the time_{cycle,mask} fields are used */ |
---|
| 539 | + cap_____res : 58; |
---|
527 | 540 | }; |
---|
528 | 541 | }; |
---|
529 | 542 | |
---|
.. | .. |
---|
582 | 595 | * ((rem * time_mult) >> time_shift); |
---|
583 | 596 | */ |
---|
584 | 597 | __u64 time_zero; |
---|
| 598 | + |
---|
585 | 599 | __u32 size; /* Header size up to __reserved[] fields. */ |
---|
| 600 | + __u32 __reserved_1; |
---|
| 601 | + |
---|
| 602 | + /* |
---|
| 603 | + * If cap_usr_time_short, the hardware clock is less than 64bit wide |
---|
| 604 | + * and we must compute the 'cyc' value, as used by cap_usr_time, as: |
---|
| 605 | + * |
---|
| 606 | + * cyc = time_cycles + ((cyc - time_cycles) & time_mask) |
---|
| 607 | + * |
---|
| 608 | + * NOTE: this form is explicitly chosen such that cap_usr_time_short |
---|
| 609 | + * is a correction on top of cap_usr_time, and code that doesn't |
---|
| 610 | + * know about cap_usr_time_short still works under the assumption |
---|
| 611 | + * the counter doesn't wrap. |
---|
| 612 | + */ |
---|
| 613 | + __u64 time_cycles; |
---|
| 614 | + __u64 time_mask; |
---|
586 | 615 | |
---|
587 | 616 | /* |
---|
588 | 617 | * Hole for extension of the self monitor capabilities |
---|
589 | 618 | */ |
---|
590 | 619 | |
---|
591 | | - __u8 __reserved[118*8+4]; /* align to 1k. */ |
---|
| 620 | + __u8 __reserved[116*8]; /* align to 1k. */ |
---|
592 | 621 | |
---|
593 | 622 | /* |
---|
594 | 623 | * Control data for the mmap() data buffer. |
---|
.. | .. |
---|
646 | 675 | * |
---|
647 | 676 | * PERF_RECORD_MISC_MMAP_DATA - PERF_RECORD_MMAP* events |
---|
648 | 677 | * PERF_RECORD_MISC_COMM_EXEC - PERF_RECORD_COMM event |
---|
| 678 | + * PERF_RECORD_MISC_FORK_EXEC - PERF_RECORD_FORK event (perf internal) |
---|
649 | 679 | * PERF_RECORD_MISC_SWITCH_OUT - PERF_RECORD_SWITCH* events |
---|
650 | 680 | */ |
---|
651 | 681 | #define PERF_RECORD_MISC_MMAP_DATA (1 << 13) |
---|
652 | 682 | #define PERF_RECORD_MISC_COMM_EXEC (1 << 13) |
---|
| 683 | +#define PERF_RECORD_MISC_FORK_EXEC (1 << 13) |
---|
653 | 684 | #define PERF_RECORD_MISC_SWITCH_OUT (1 << 13) |
---|
654 | 685 | /* |
---|
655 | 686 | * These PERF_RECORD_MISC_* flags below are safely reused |
---|
.. | .. |
---|
846 | 877 | * char data[size];}&& PERF_SAMPLE_RAW |
---|
847 | 878 | * |
---|
848 | 879 | * { u64 nr; |
---|
849 | | - * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK |
---|
| 880 | + * { u64 hw_idx; } && PERF_SAMPLE_BRANCH_HW_INDEX |
---|
| 881 | + * { u64 from, to, flags } lbr[nr]; |
---|
| 882 | + * } && PERF_SAMPLE_BRANCH_STACK |
---|
850 | 883 | * |
---|
851 | 884 | * { u64 abi; # enum perf_sample_regs_abi |
---|
852 | 885 | * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER |
---|
.. | .. |
---|
861 | 894 | * { u64 abi; # enum perf_sample_regs_abi |
---|
862 | 895 | * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_INTR |
---|
863 | 896 | * { u64 phys_addr;} && PERF_SAMPLE_PHYS_ADDR |
---|
| 897 | + * { u64 size; |
---|
| 898 | + * char data[size]; } && PERF_SAMPLE_AUX |
---|
864 | 899 | * }; |
---|
865 | 900 | */ |
---|
866 | 901 | PERF_RECORD_SAMPLE = 9, |
---|
.. | .. |
---|
963 | 998 | */ |
---|
964 | 999 | PERF_RECORD_NAMESPACES = 16, |
---|
965 | 1000 | |
---|
| 1001 | + /* |
---|
| 1002 | + * Record ksymbol register/unregister events: |
---|
| 1003 | + * |
---|
| 1004 | + * struct { |
---|
| 1005 | + * struct perf_event_header header; |
---|
| 1006 | + * u64 addr; |
---|
| 1007 | + * u32 len; |
---|
| 1008 | + * u16 ksym_type; |
---|
| 1009 | + * u16 flags; |
---|
| 1010 | + * char name[]; |
---|
| 1011 | + * struct sample_id sample_id; |
---|
| 1012 | + * }; |
---|
| 1013 | + */ |
---|
| 1014 | + PERF_RECORD_KSYMBOL = 17, |
---|
| 1015 | + |
---|
| 1016 | + /* |
---|
| 1017 | + * Record bpf events: |
---|
| 1018 | + * enum perf_bpf_event_type { |
---|
| 1019 | + * PERF_BPF_EVENT_UNKNOWN = 0, |
---|
| 1020 | + * PERF_BPF_EVENT_PROG_LOAD = 1, |
---|
| 1021 | + * PERF_BPF_EVENT_PROG_UNLOAD = 2, |
---|
| 1022 | + * }; |
---|
| 1023 | + * |
---|
| 1024 | + * struct { |
---|
| 1025 | + * struct perf_event_header header; |
---|
| 1026 | + * u16 type; |
---|
| 1027 | + * u16 flags; |
---|
| 1028 | + * u32 id; |
---|
| 1029 | + * u8 tag[BPF_TAG_SIZE]; |
---|
| 1030 | + * struct sample_id sample_id; |
---|
| 1031 | + * }; |
---|
| 1032 | + */ |
---|
| 1033 | + PERF_RECORD_BPF_EVENT = 18, |
---|
| 1034 | + |
---|
| 1035 | + /* |
---|
| 1036 | + * struct { |
---|
| 1037 | + * struct perf_event_header header; |
---|
| 1038 | + * u64 id; |
---|
| 1039 | + * char path[]; |
---|
| 1040 | + * struct sample_id sample_id; |
---|
| 1041 | + * }; |
---|
| 1042 | + */ |
---|
| 1043 | + PERF_RECORD_CGROUP = 19, |
---|
| 1044 | + |
---|
| 1045 | + /* |
---|
| 1046 | + * Records changes to kernel text i.e. self-modified code. 'old_len' is |
---|
| 1047 | + * the number of old bytes, 'new_len' is the number of new bytes. Either |
---|
| 1048 | + * 'old_len' or 'new_len' may be zero to indicate, for example, the |
---|
| 1049 | + * addition or removal of a trampoline. 'bytes' contains the old bytes |
---|
| 1050 | + * followed immediately by the new bytes. |
---|
| 1051 | + * |
---|
| 1052 | + * struct { |
---|
| 1053 | + * struct perf_event_header header; |
---|
| 1054 | + * u64 addr; |
---|
| 1055 | + * u16 old_len; |
---|
| 1056 | + * u16 new_len; |
---|
| 1057 | + * u8 bytes[]; |
---|
| 1058 | + * struct sample_id sample_id; |
---|
| 1059 | + * }; |
---|
| 1060 | + */ |
---|
| 1061 | + PERF_RECORD_TEXT_POKE = 20, |
---|
| 1062 | + |
---|
966 | 1063 | PERF_RECORD_MAX, /* non-ABI */ |
---|
| 1064 | +}; |
---|
| 1065 | + |
---|
| 1066 | +enum perf_record_ksymbol_type { |
---|
| 1067 | + PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0, |
---|
| 1068 | + PERF_RECORD_KSYMBOL_TYPE_BPF = 1, |
---|
| 1069 | + /* |
---|
| 1070 | + * Out of line code such as kprobe-replaced instructions or optimized |
---|
| 1071 | + * kprobes or ftrace trampolines. |
---|
| 1072 | + */ |
---|
| 1073 | + PERF_RECORD_KSYMBOL_TYPE_OOL = 2, |
---|
| 1074 | + PERF_RECORD_KSYMBOL_TYPE_MAX /* non-ABI */ |
---|
| 1075 | +}; |
---|
| 1076 | + |
---|
| 1077 | +#define PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER (1 << 0) |
---|
| 1078 | + |
---|
| 1079 | +enum perf_bpf_event_type { |
---|
| 1080 | + PERF_BPF_EVENT_UNKNOWN = 0, |
---|
| 1081 | + PERF_BPF_EVENT_PROG_LOAD = 1, |
---|
| 1082 | + PERF_BPF_EVENT_PROG_UNLOAD = 2, |
---|
| 1083 | + PERF_BPF_EVENT_MAX, /* non-ABI */ |
---|
967 | 1084 | }; |
---|
968 | 1085 | |
---|
969 | 1086 | #define PERF_MAX_STACK_DEPTH 127 |
---|
.. | .. |
---|
984 | 1101 | /** |
---|
985 | 1102 | * PERF_RECORD_AUX::flags bits |
---|
986 | 1103 | */ |
---|
987 | | -#define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */ |
---|
988 | | -#define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ |
---|
989 | | -#define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ |
---|
990 | | -#define PERF_AUX_FLAG_COLLISION 0x08 /* sample collided with another */ |
---|
| 1104 | +#define PERF_AUX_FLAG_TRUNCATED 0x01 /* record was truncated to fit */ |
---|
| 1105 | +#define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ |
---|
| 1106 | +#define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ |
---|
| 1107 | +#define PERF_AUX_FLAG_COLLISION 0x08 /* sample collided with another */ |
---|
| 1108 | +#define PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK 0xff00 /* PMU specific trace format type */ |
---|
| 1109 | + |
---|
| 1110 | +/* CoreSight PMU AUX buffer formats */ |
---|
| 1111 | +#define PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT 0x0000 /* Default for backward compatibility */ |
---|
| 1112 | +#define PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW 0x0100 /* Raw format of the source */ |
---|
991 | 1113 | |
---|
992 | 1114 | #define PERF_FLAG_FD_NO_GROUP (1UL << 0) |
---|
993 | 1115 | #define PERF_FLAG_FD_OUTPUT (1UL << 1) |
---|