diff options
Diffstat (limited to 'include/linux/perf_event.h')
| -rw-r--r-- | include/linux/perf_event.h | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 9e7012689a84..64a53f74c9a9 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
| @@ -31,6 +31,7 @@ enum perf_type_id { | |||
| 31 | PERF_TYPE_TRACEPOINT = 2, | 31 | PERF_TYPE_TRACEPOINT = 2, |
| 32 | PERF_TYPE_HW_CACHE = 3, | 32 | PERF_TYPE_HW_CACHE = 3, |
| 33 | PERF_TYPE_RAW = 4, | 33 | PERF_TYPE_RAW = 4, |
| 34 | PERF_TYPE_BREAKPOINT = 5, | ||
| 34 | 35 | ||
| 35 | PERF_TYPE_MAX, /* non-ABI */ | 36 | PERF_TYPE_MAX, /* non-ABI */ |
| 36 | }; | 37 | }; |
| @@ -102,6 +103,8 @@ enum perf_sw_ids { | |||
| 102 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | 103 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, |
| 103 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | 104 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, |
| 104 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | 105 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, |
| 106 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
| 107 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
| 105 | 108 | ||
| 106 | PERF_COUNT_SW_MAX, /* non-ABI */ | 109 | PERF_COUNT_SW_MAX, /* non-ABI */ |
| 107 | }; | 110 | }; |
| @@ -207,6 +210,15 @@ struct perf_event_attr { | |||
| 207 | __u32 wakeup_events; /* wakeup every n events */ | 210 | __u32 wakeup_events; /* wakeup every n events */ |
| 208 | __u32 wakeup_watermark; /* bytes before wakeup */ | 211 | __u32 wakeup_watermark; /* bytes before wakeup */ |
| 209 | }; | 212 | }; |
| 213 | |||
| 214 | struct { /* Hardware breakpoint info */ | ||
| 215 | __u64 bp_addr; | ||
| 216 | __u32 bp_type; | ||
| 217 | __u32 bp_len; | ||
| 218 | __u64 __bp_reserved_1; | ||
| 219 | __u64 __bp_reserved_2; | ||
| 220 | }; | ||
| 221 | |||
| 210 | __u32 __reserved_2; | 222 | __u32 __reserved_2; |
| 211 | 223 | ||
| 212 | __u64 __reserved_3; | 224 | __u64 __reserved_3; |
| @@ -219,8 +231,9 @@ struct perf_event_attr { | |||
| 219 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) | 231 | #define PERF_EVENT_IOC_DISABLE _IO ('$', 1) |
| 220 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) | 232 | #define PERF_EVENT_IOC_REFRESH _IO ('$', 2) |
| 221 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) | 233 | #define PERF_EVENT_IOC_RESET _IO ('$', 3) |
| 222 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64) | 234 | #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64) |
| 223 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) | 235 | #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5) |
| 236 | #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *) | ||
| 224 | 237 | ||
| 225 | enum perf_event_ioc_flags { | 238 | enum perf_event_ioc_flags { |
| 226 | PERF_IOC_FLAG_GROUP = 1U << 0, | 239 | PERF_IOC_FLAG_GROUP = 1U << 0, |
| @@ -434,6 +447,10 @@ enum perf_callchain_context { | |||
| 434 | # include <asm/perf_event.h> | 447 | # include <asm/perf_event.h> |
| 435 | #endif | 448 | #endif |
| 436 | 449 | ||
| 450 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 451 | #include <asm/hw_breakpoint.h> | ||
| 452 | #endif | ||
| 453 | |||
| 437 | #include <linux/list.h> | 454 | #include <linux/list.h> |
| 438 | #include <linux/mutex.h> | 455 | #include <linux/mutex.h> |
| 439 | #include <linux/rculist.h> | 456 | #include <linux/rculist.h> |
| @@ -475,6 +492,11 @@ struct hw_perf_event { | |||
| 475 | s64 remaining; | 492 | s64 remaining; |
| 476 | struct hrtimer hrtimer; | 493 | struct hrtimer hrtimer; |
| 477 | }; | 494 | }; |
| 495 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 496 | union { /* breakpoint */ | ||
| 497 | struct arch_hw_breakpoint info; | ||
| 498 | }; | ||
| 499 | #endif | ||
| 478 | }; | 500 | }; |
| 479 | atomic64_t prev_count; | 501 | atomic64_t prev_count; |
| 480 | u64 sample_period; | 502 | u64 sample_period; |
| @@ -543,6 +565,12 @@ struct perf_pending_entry { | |||
| 543 | void (*func)(struct perf_pending_entry *); | 565 | void (*func)(struct perf_pending_entry *); |
| 544 | }; | 566 | }; |
| 545 | 567 | ||
| 568 | struct perf_sample_data; | ||
| 569 | |||
| 570 | typedef void (*perf_overflow_handler_t)(struct perf_event *, int, | ||
| 571 | struct perf_sample_data *, | ||
| 572 | struct pt_regs *regs); | ||
| 573 | |||
| 546 | /** | 574 | /** |
| 547 | * struct perf_event - performance event kernel representation: | 575 | * struct perf_event - performance event kernel representation: |
| 548 | */ | 576 | */ |
| @@ -585,7 +613,7 @@ struct perf_event { | |||
| 585 | u64 tstamp_running; | 613 | u64 tstamp_running; |
| 586 | u64 tstamp_stopped; | 614 | u64 tstamp_stopped; |
| 587 | 615 | ||
| 588 | struct perf_event_attr attr; | 616 | struct perf_event_attr attr; |
| 589 | struct hw_perf_event hw; | 617 | struct hw_perf_event hw; |
| 590 | 618 | ||
| 591 | struct perf_event_context *ctx; | 619 | struct perf_event_context *ctx; |
| @@ -633,7 +661,14 @@ struct perf_event { | |||
| 633 | 661 | ||
| 634 | struct pid_namespace *ns; | 662 | struct pid_namespace *ns; |
| 635 | u64 id; | 663 | u64 id; |
| 664 | |||
| 665 | perf_overflow_handler_t overflow_handler; | ||
| 666 | |||
| 667 | #ifdef CONFIG_EVENT_PROFILE | ||
| 668 | struct event_filter *filter; | ||
| 636 | #endif | 669 | #endif |
| 670 | |||
| 671 | #endif /* CONFIG_PERF_EVENTS */ | ||
| 637 | }; | 672 | }; |
| 638 | 673 | ||
| 639 | /** | 674 | /** |
| @@ -706,7 +741,6 @@ struct perf_output_handle { | |||
| 706 | int nmi; | 741 | int nmi; |
| 707 | int sample; | 742 | int sample; |
| 708 | int locked; | 743 | int locked; |
| 709 | unsigned long flags; | ||
| 710 | }; | 744 | }; |
| 711 | 745 | ||
| 712 | #ifdef CONFIG_PERF_EVENTS | 746 | #ifdef CONFIG_PERF_EVENTS |
| @@ -738,6 +772,14 @@ extern int hw_perf_group_sched_in(struct perf_event *group_leader, | |||
| 738 | struct perf_cpu_context *cpuctx, | 772 | struct perf_cpu_context *cpuctx, |
| 739 | struct perf_event_context *ctx, int cpu); | 773 | struct perf_event_context *ctx, int cpu); |
| 740 | extern void perf_event_update_userpage(struct perf_event *event); | 774 | extern void perf_event_update_userpage(struct perf_event *event); |
| 775 | extern int perf_event_release_kernel(struct perf_event *event); | ||
| 776 | extern struct perf_event * | ||
| 777 | perf_event_create_kernel_counter(struct perf_event_attr *attr, | ||
| 778 | int cpu, | ||
| 779 | pid_t pid, | ||
| 780 | perf_overflow_handler_t callback); | ||
| 781 | extern u64 perf_event_read_value(struct perf_event *event, | ||
| 782 | u64 *enabled, u64 *running); | ||
| 741 | 783 | ||
| 742 | struct perf_sample_data { | 784 | struct perf_sample_data { |
| 743 | u64 type; | 785 | u64 type; |
| @@ -814,6 +856,7 @@ extern int sysctl_perf_event_sample_rate; | |||
| 814 | extern void perf_event_init(void); | 856 | extern void perf_event_init(void); |
| 815 | extern void perf_tp_event(int event_id, u64 addr, u64 count, | 857 | extern void perf_tp_event(int event_id, u64 addr, u64 count, |
| 816 | void *record, int entry_size); | 858 | void *record, int entry_size); |
| 859 | extern void perf_bp_event(struct perf_event *event, void *data); | ||
| 817 | 860 | ||
| 818 | #ifndef perf_misc_flags | 861 | #ifndef perf_misc_flags |
| 819 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ | 862 | #define perf_misc_flags(regs) (user_mode(regs) ? PERF_RECORD_MISC_USER : \ |
| @@ -827,6 +870,10 @@ extern int perf_output_begin(struct perf_output_handle *handle, | |||
| 827 | extern void perf_output_end(struct perf_output_handle *handle); | 870 | extern void perf_output_end(struct perf_output_handle *handle); |
| 828 | extern void perf_output_copy(struct perf_output_handle *handle, | 871 | extern void perf_output_copy(struct perf_output_handle *handle, |
| 829 | const void *buf, unsigned int len); | 872 | const void *buf, unsigned int len); |
| 873 | extern int perf_swevent_get_recursion_context(void); | ||
| 874 | extern void perf_swevent_put_recursion_context(int rctx); | ||
| 875 | extern void perf_event_enable(struct perf_event *event); | ||
| 876 | extern void perf_event_disable(struct perf_event *event); | ||
| 830 | #else | 877 | #else |
| 831 | static inline void | 878 | static inline void |
| 832 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } | 879 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } |
| @@ -848,12 +895,17 @@ static inline int perf_event_task_enable(void) { return -EINVAL; } | |||
| 848 | static inline void | 895 | static inline void |
| 849 | perf_sw_event(u32 event_id, u64 nr, int nmi, | 896 | perf_sw_event(u32 event_id, u64 nr, int nmi, |
| 850 | struct pt_regs *regs, u64 addr) { } | 897 | struct pt_regs *regs, u64 addr) { } |
| 898 | static inline void | ||
| 899 | perf_bp_event(struct perf_event *event, void *data) { } | ||
| 851 | 900 | ||
| 852 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 901 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
| 853 | static inline void perf_event_comm(struct task_struct *tsk) { } | 902 | static inline void perf_event_comm(struct task_struct *tsk) { } |
| 854 | static inline void perf_event_fork(struct task_struct *tsk) { } | 903 | static inline void perf_event_fork(struct task_struct *tsk) { } |
| 855 | static inline void perf_event_init(void) { } | 904 | static inline void perf_event_init(void) { } |
| 856 | 905 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | |
| 906 | static inline void perf_swevent_put_recursion_context(int rctx) { } | ||
| 907 | static inline void perf_event_enable(struct perf_event *event) { } | ||
| 908 | static inline void perf_event_disable(struct perf_event *event) { } | ||
| 857 | #endif | 909 | #endif |
| 858 | 910 | ||
| 859 | #define perf_output_put(handle, x) \ | 911 | #define perf_output_put(handle, x) \ |
