diff options
Diffstat (limited to 'include/uapi/linux/perf_event.h')
| -rw-r--r-- | include/uapi/linux/perf_event.h | 123 |
1 files changed, 110 insertions, 13 deletions
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 0b1df41691e8..ca1d90bcb74d 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
| @@ -109,6 +109,7 @@ enum perf_sw_ids { | |||
| 109 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | 109 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
| 110 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | 110 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, |
| 111 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | 111 | PERF_COUNT_SW_EMULATION_FAULTS = 8, |
| 112 | PERF_COUNT_SW_DUMMY = 9, | ||
| 112 | 113 | ||
| 113 | PERF_COUNT_SW_MAX, /* non-ABI */ | 114 | PERF_COUNT_SW_MAX, /* non-ABI */ |
| 114 | }; | 115 | }; |
| @@ -134,8 +135,9 @@ enum perf_event_sample_format { | |||
| 134 | PERF_SAMPLE_STACK_USER = 1U << 13, | 135 | PERF_SAMPLE_STACK_USER = 1U << 13, |
| 135 | PERF_SAMPLE_WEIGHT = 1U << 14, | 136 | PERF_SAMPLE_WEIGHT = 1U << 14, |
| 136 | PERF_SAMPLE_DATA_SRC = 1U << 15, | 137 | PERF_SAMPLE_DATA_SRC = 1U << 15, |
| 138 | PERF_SAMPLE_IDENTIFIER = 1U << 16, | ||
| 137 | 139 | ||
| 138 | PERF_SAMPLE_MAX = 1U << 16, /* non-ABI */ | 140 | PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */ |
| 139 | }; | 141 | }; |
| 140 | 142 | ||
| 141 | /* | 143 | /* |
| @@ -275,8 +277,9 @@ struct perf_event_attr { | |||
| 275 | 277 | ||
| 276 | exclude_callchain_kernel : 1, /* exclude kernel callchains */ | 278 | exclude_callchain_kernel : 1, /* exclude kernel callchains */ |
| 277 | exclude_callchain_user : 1, /* exclude user callchains */ | 279 | exclude_callchain_user : 1, /* exclude user callchains */ |
| 280 | mmap2 : 1, /* include mmap with inode data */ | ||
| 278 | 281 | ||
| 279 | __reserved_1 : 41; | 282 | __reserved_1 : 40; |
| 280 | 283 | ||
| 281 | union { | 284 | union { |
| 282 | __u32 wakeup_events; /* wakeup every n events */ | 285 | __u32 wakeup_events; /* wakeup every n events */ |
| @@ -321,6 +324,7 @@ struct perf_event_attr { | |||
| 321 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) | 324 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) |
| 322 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) | 325 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) |
| 323 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) | 326 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) |
| 327 | #define PERF_EVENT_IOC_ID _IOR('$', 7, u64 *) | ||
| 324 | 328 | ||
| 325 | enum perf_event_ioc_flags { | 329 | enum perf_event_ioc_flags { |
| 326 | PERF_IOC_FLAG_GROUP = 1U << 0, | 330 | PERF_IOC_FLAG_GROUP = 1U << 0, |
| @@ -375,9 +379,12 @@ struct perf_event_mmap_page { | |||
| 375 | __u64 time_running; /* time event on cpu */ | 379 | __u64 time_running; /* time event on cpu */ |
| 376 | union { | 380 | union { |
| 377 | __u64 capabilities; | 381 | __u64 capabilities; |
| 378 | __u64 cap_usr_time : 1, | 382 | struct { |
| 379 | cap_usr_rdpmc : 1, | 383 | __u64 cap_usr_time : 1, |
| 380 | cap_____res : 62; | 384 | cap_usr_rdpmc : 1, |
| 385 | cap_usr_time_zero : 1, | ||
| 386 | cap_____res : 61; | ||
| 387 | }; | ||
| 381 | }; | 388 | }; |
| 382 | 389 | ||
| 383 | /* | 390 | /* |
| @@ -418,12 +425,29 @@ struct perf_event_mmap_page { | |||
| 418 | __u16 time_shift; | 425 | __u16 time_shift; |
| 419 | __u32 time_mult; | 426 | __u32 time_mult; |
| 420 | __u64 time_offset; | 427 | __u64 time_offset; |
| 428 | /* | ||
| 429 | * If cap_usr_time_zero, the hardware clock (e.g. TSC) can be calculated | ||
| 430 | * from sample timestamps. | ||
| 431 | * | ||
| 432 | * time = timestamp - time_zero; | ||
| 433 | * quot = time / time_mult; | ||
| 434 | * rem = time % time_mult; | ||
| 435 | * cyc = (quot << time_shift) + (rem << time_shift) / time_mult; | ||
| 436 | * | ||
| 437 | * And vice versa: | ||
| 438 | * | ||
| 439 | * quot = cyc >> time_shift; | ||
| 440 | * rem = cyc & ((1 << time_shift) - 1); | ||
| 441 | * timestamp = time_zero + quot * time_mult + | ||
| 442 | * ((rem * time_mult) >> time_shift); | ||
| 443 | */ | ||
| 444 | __u64 time_zero; | ||
| 421 | 445 | ||
| 422 | /* | 446 | /* |
| 423 | * Hole for extension of the self monitor capabilities | 447 | * Hole for extension of the self monitor capabilities |
| 424 | */ | 448 | */ |
| 425 | 449 | ||
| 426 | __u64 __reserved[120]; /* align to 1k */ | 450 | __u64 __reserved[119]; /* align to 1k */ |
| 427 | 451 | ||
| 428 | /* | 452 | /* |
| 429 | * Control data for the mmap() data buffer. | 453 | * Control data for the mmap() data buffer. |
| @@ -471,13 +495,28 @@ enum perf_event_type { | |||
| 471 | /* | 495 | /* |
| 472 | * If perf_event_attr.sample_id_all is set then all event types will | 496 | * If perf_event_attr.sample_id_all is set then all event types will |
| 473 | * have the sample_type selected fields related to where/when | 497 | * have the sample_type selected fields related to where/when |
| 474 | * (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID) | 498 | * (identity) an event took place (TID, TIME, ID, STREAM_ID, CPU, |
| 475 | * described in PERF_RECORD_SAMPLE below, it will be stashed just after | 499 | * IDENTIFIER) described in PERF_RECORD_SAMPLE below, it will be stashed |
| 476 | * the perf_event_header and the fields already present for the existing | 500 | * just after the perf_event_header and the fields already present for |
| 477 | * fields, i.e. at the end of the payload. That way a newer perf.data | 501 | * the existing fields, i.e. at the end of the payload. That way a newer |
| 478 | * file will be supported by older perf tools, with these new optional | 502 | * perf.data file will be supported by older perf tools, with these new |
| 479 | * fields being ignored. | 503 | * optional fields being ignored. |
| 504 | * | ||
| 505 | * struct sample_id { | ||
| 506 | * { u32 pid, tid; } && PERF_SAMPLE_TID | ||
| 507 | * { u64 time; } && PERF_SAMPLE_TIME | ||
| 508 | * { u64 id; } && PERF_SAMPLE_ID | ||
| 509 | * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID | ||
| 510 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | ||
| 511 | * { u64 id; } && PERF_SAMPLE_IDENTIFIER | ||
| 512 | * } && perf_event_attr::sample_id_all | ||
| 480 | * | 513 | * |
| 514 | * Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. The | ||
| 515 | * advantage of PERF_SAMPLE_IDENTIFIER is that its position is fixed | ||
| 516 | * relative to header.size. | ||
| 517 | */ | ||
| 518 | |||
| 519 | /* | ||
| 481 | * The MMAP events record the PROT_EXEC mappings so that we can | 520 | * The MMAP events record the PROT_EXEC mappings so that we can |
| 482 | * correlate userspace IPs to code. They have the following structure: | 521 | * correlate userspace IPs to code. They have the following structure: |
| 483 | * | 522 | * |
| @@ -498,6 +537,7 @@ enum perf_event_type { | |||
| 498 | * struct perf_event_header header; | 537 | * struct perf_event_header header; |
| 499 | * u64 id; | 538 | * u64 id; |
| 500 | * u64 lost; | 539 | * u64 lost; |
| 540 | * struct sample_id sample_id; | ||
| 501 | * }; | 541 | * }; |
| 502 | */ | 542 | */ |
| 503 | PERF_RECORD_LOST = 2, | 543 | PERF_RECORD_LOST = 2, |
| @@ -508,6 +548,7 @@ enum perf_event_type { | |||
| 508 | * | 548 | * |
| 509 | * u32 pid, tid; | 549 | * u32 pid, tid; |
| 510 | * char comm[]; | 550 | * char comm[]; |
| 551 | * struct sample_id sample_id; | ||
| 511 | * }; | 552 | * }; |
| 512 | */ | 553 | */ |
| 513 | PERF_RECORD_COMM = 3, | 554 | PERF_RECORD_COMM = 3, |
| @@ -518,6 +559,7 @@ enum perf_event_type { | |||
| 518 | * u32 pid, ppid; | 559 | * u32 pid, ppid; |
| 519 | * u32 tid, ptid; | 560 | * u32 tid, ptid; |
| 520 | * u64 time; | 561 | * u64 time; |
| 562 | * struct sample_id sample_id; | ||
| 521 | * }; | 563 | * }; |
| 522 | */ | 564 | */ |
| 523 | PERF_RECORD_EXIT = 4, | 565 | PERF_RECORD_EXIT = 4, |
| @@ -528,6 +570,7 @@ enum perf_event_type { | |||
| 528 | * u64 time; | 570 | * u64 time; |
| 529 | * u64 id; | 571 | * u64 id; |
| 530 | * u64 stream_id; | 572 | * u64 stream_id; |
| 573 | * struct sample_id sample_id; | ||
| 531 | * }; | 574 | * }; |
| 532 | */ | 575 | */ |
| 533 | PERF_RECORD_THROTTLE = 5, | 576 | PERF_RECORD_THROTTLE = 5, |
| @@ -539,6 +582,7 @@ enum perf_event_type { | |||
| 539 | * u32 pid, ppid; | 582 | * u32 pid, ppid; |
| 540 | * u32 tid, ptid; | 583 | * u32 tid, ptid; |
| 541 | * u64 time; | 584 | * u64 time; |
| 585 | * struct sample_id sample_id; | ||
| 542 | * }; | 586 | * }; |
| 543 | */ | 587 | */ |
| 544 | PERF_RECORD_FORK = 7, | 588 | PERF_RECORD_FORK = 7, |
| @@ -549,6 +593,7 @@ enum perf_event_type { | |||
| 549 | * u32 pid, tid; | 593 | * u32 pid, tid; |
| 550 | * | 594 | * |
| 551 | * struct read_format values; | 595 | * struct read_format values; |
| 596 | * struct sample_id sample_id; | ||
| 552 | * }; | 597 | * }; |
| 553 | */ | 598 | */ |
| 554 | PERF_RECORD_READ = 8, | 599 | PERF_RECORD_READ = 8, |
| @@ -557,6 +602,13 @@ enum perf_event_type { | |||
| 557 | * struct { | 602 | * struct { |
| 558 | * struct perf_event_header header; | 603 | * struct perf_event_header header; |
| 559 | * | 604 | * |
| 605 | * # | ||
| 606 | * # Note that PERF_SAMPLE_IDENTIFIER duplicates PERF_SAMPLE_ID. | ||
| 607 | * # The advantage of PERF_SAMPLE_IDENTIFIER is that its position | ||
| 608 | * # is fixed relative to header. | ||
| 609 | * # | ||
| 610 | * | ||
| 611 | * { u64 id; } && PERF_SAMPLE_IDENTIFIER | ||
| 560 | * { u64 ip; } && PERF_SAMPLE_IP | 612 | * { u64 ip; } && PERF_SAMPLE_IP |
| 561 | * { u32 pid, tid; } && PERF_SAMPLE_TID | 613 | * { u32 pid, tid; } && PERF_SAMPLE_TID |
| 562 | * { u64 time; } && PERF_SAMPLE_TIME | 614 | * { u64 time; } && PERF_SAMPLE_TIME |
| @@ -596,11 +648,32 @@ enum perf_event_type { | |||
| 596 | * u64 dyn_size; } && PERF_SAMPLE_STACK_USER | 648 | * u64 dyn_size; } && PERF_SAMPLE_STACK_USER |
| 597 | * | 649 | * |
| 598 | * { u64 weight; } && PERF_SAMPLE_WEIGHT | 650 | * { u64 weight; } && PERF_SAMPLE_WEIGHT |
| 599 | * { u64 data_src; } && PERF_SAMPLE_DATA_SRC | 651 | * { u64 data_src; } && PERF_SAMPLE_DATA_SRC |
| 600 | * }; | 652 | * }; |
| 601 | */ | 653 | */ |
| 602 | PERF_RECORD_SAMPLE = 9, | 654 | PERF_RECORD_SAMPLE = 9, |
| 603 | 655 | ||
| 656 | /* | ||
| 657 | * The MMAP2 records are an augmented version of MMAP, they add | ||
| 658 | * maj, min, ino numbers to be used to uniquely identify each mapping | ||
| 659 | * | ||
| 660 | * struct { | ||
| 661 | * struct perf_event_header header; | ||
| 662 | * | ||
| 663 | * u32 pid, tid; | ||
| 664 | * u64 addr; | ||
| 665 | * u64 len; | ||
| 666 | * u64 pgoff; | ||
| 667 | * u32 maj; | ||
| 668 | * u32 min; | ||
| 669 | * u64 ino; | ||
| 670 | * u64 ino_generation; | ||
| 671 | * char filename[]; | ||
| 672 | * struct sample_id sample_id; | ||
| 673 | * }; | ||
| 674 | */ | ||
| 675 | PERF_RECORD_MMAP2 = 10, | ||
| 676 | |||
| 604 | PERF_RECORD_MAX, /* non-ABI */ | 677 | PERF_RECORD_MAX, /* non-ABI */ |
| 605 | }; | 678 | }; |
| 606 | 679 | ||
| @@ -685,4 +758,28 @@ union perf_mem_data_src { | |||
| 685 | #define PERF_MEM_S(a, s) \ | 758 | #define PERF_MEM_S(a, s) \ |
| 686 | (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) | 759 | (((u64)PERF_MEM_##a##_##s) << PERF_MEM_##a##_SHIFT) |
| 687 | 760 | ||
| 761 | /* | ||
| 762 | * single taken branch record layout: | ||
| 763 | * | ||
| 764 | * from: source instruction (may not always be a branch insn) | ||
| 765 | * to: branch target | ||
| 766 | * mispred: branch target was mispredicted | ||
| 767 | * predicted: branch target was predicted | ||
| 768 | * | ||
| 769 | * support for mispred, predicted is optional. In case it | ||
| 770 | * is not supported mispred = predicted = 0. | ||
| 771 | * | ||
| 772 | * in_tx: running in a hardware transaction | ||
| 773 | * abort: aborting a hardware transaction | ||
| 774 | */ | ||
| 775 | struct perf_branch_entry { | ||
| 776 | __u64 from; | ||
| 777 | __u64 to; | ||
| 778 | __u64 mispred:1, /* target mispredicted */ | ||
| 779 | predicted:1,/* target predicted */ | ||
| 780 | in_tx:1, /* in transaction */ | ||
| 781 | abort:1, /* transaction abort */ | ||
| 782 | reserved:60; | ||
| 783 | }; | ||
| 784 | |||
| 688 | #endif /* _UAPI_LINUX_PERF_EVENT_H */ | 785 | #endif /* _UAPI_LINUX_PERF_EVENT_H */ |
