diff options
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 75 |
1 files changed, 48 insertions, 27 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index a177698d95e2..90e0521b1690 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -288,7 +288,7 @@ struct perf_event_mmap_page { | |||
288 | }; | 288 | }; |
289 | 289 | ||
290 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) | 290 | #define PERF_RECORD_MISC_CPUMODE_MASK (3 << 0) |
291 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) | 291 | #define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0) |
292 | #define PERF_RECORD_MISC_KERNEL (1 << 0) | 292 | #define PERF_RECORD_MISC_KERNEL (1 << 0) |
293 | #define PERF_RECORD_MISC_USER (2 << 0) | 293 | #define PERF_RECORD_MISC_USER (2 << 0) |
294 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) | 294 | #define PERF_RECORD_MISC_HYPERVISOR (3 << 0) |
@@ -354,8 +354,8 @@ enum perf_event_type { | |||
354 | * u64 stream_id; | 354 | * u64 stream_id; |
355 | * }; | 355 | * }; |
356 | */ | 356 | */ |
357 | PERF_RECORD_THROTTLE = 5, | 357 | PERF_RECORD_THROTTLE = 5, |
358 | PERF_RECORD_UNTHROTTLE = 6, | 358 | PERF_RECORD_UNTHROTTLE = 6, |
359 | 359 | ||
360 | /* | 360 | /* |
361 | * struct { | 361 | * struct { |
@@ -369,10 +369,10 @@ enum perf_event_type { | |||
369 | 369 | ||
370 | /* | 370 | /* |
371 | * struct { | 371 | * struct { |
372 | * struct perf_event_header header; | 372 | * struct perf_event_header header; |
373 | * u32 pid, tid; | 373 | * u32 pid, tid; |
374 | * | 374 | * |
375 | * struct read_format values; | 375 | * struct read_format values; |
376 | * }; | 376 | * }; |
377 | */ | 377 | */ |
378 | PERF_RECORD_READ = 8, | 378 | PERF_RECORD_READ = 8, |
@@ -410,7 +410,7 @@ enum perf_event_type { | |||
410 | * char data[size];}&& PERF_SAMPLE_RAW | 410 | * char data[size];}&& PERF_SAMPLE_RAW |
411 | * }; | 411 | * }; |
412 | */ | 412 | */ |
413 | PERF_RECORD_SAMPLE = 9, | 413 | PERF_RECORD_SAMPLE = 9, |
414 | 414 | ||
415 | PERF_RECORD_MAX, /* non-ABI */ | 415 | PERF_RECORD_MAX, /* non-ABI */ |
416 | }; | 416 | }; |
@@ -476,18 +476,19 @@ struct hw_perf_event { | |||
476 | union { | 476 | union { |
477 | struct { /* hardware */ | 477 | struct { /* hardware */ |
478 | u64 config; | 478 | u64 config; |
479 | u64 last_tag; | ||
479 | unsigned long config_base; | 480 | unsigned long config_base; |
480 | unsigned long event_base; | 481 | unsigned long event_base; |
481 | int idx; | 482 | int idx; |
483 | int last_cpu; | ||
482 | }; | 484 | }; |
483 | struct { /* software */ | 485 | struct { /* software */ |
484 | s64 remaining; | 486 | s64 remaining; |
485 | struct hrtimer hrtimer; | 487 | struct hrtimer hrtimer; |
486 | }; | 488 | }; |
487 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | 489 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
488 | union { /* breakpoint */ | 490 | /* breakpoint */ |
489 | struct arch_hw_breakpoint info; | 491 | struct arch_hw_breakpoint info; |
490 | }; | ||
491 | #endif | 492 | #endif |
492 | }; | 493 | }; |
493 | atomic64_t prev_count; | 494 | atomic64_t prev_count; |
@@ -496,9 +497,8 @@ struct hw_perf_event { | |||
496 | atomic64_t period_left; | 497 | atomic64_t period_left; |
497 | u64 interrupts; | 498 | u64 interrupts; |
498 | 499 | ||
499 | u64 freq_count; | 500 | u64 freq_time_stamp; |
500 | u64 freq_interrupts; | 501 | u64 freq_count_stamp; |
501 | u64 freq_stamp; | ||
502 | #endif | 502 | #endif |
503 | }; | 503 | }; |
504 | 504 | ||
@@ -510,6 +510,8 @@ struct perf_event; | |||
510 | struct pmu { | 510 | struct pmu { |
511 | int (*enable) (struct perf_event *event); | 511 | int (*enable) (struct perf_event *event); |
512 | void (*disable) (struct perf_event *event); | 512 | void (*disable) (struct perf_event *event); |
513 | int (*start) (struct perf_event *event); | ||
514 | void (*stop) (struct perf_event *event); | ||
513 | void (*read) (struct perf_event *event); | 515 | void (*read) (struct perf_event *event); |
514 | void (*unthrottle) (struct perf_event *event); | 516 | void (*unthrottle) (struct perf_event *event); |
515 | }; | 517 | }; |
@@ -563,6 +565,10 @@ typedef void (*perf_overflow_handler_t)(struct perf_event *, int, | |||
563 | struct perf_sample_data *, | 565 | struct perf_sample_data *, |
564 | struct pt_regs *regs); | 566 | struct pt_regs *regs); |
565 | 567 | ||
568 | enum perf_group_flag { | ||
569 | PERF_GROUP_SOFTWARE = 0x1, | ||
570 | }; | ||
571 | |||
566 | /** | 572 | /** |
567 | * struct perf_event - performance event kernel representation: | 573 | * struct perf_event - performance event kernel representation: |
568 | */ | 574 | */ |
@@ -572,6 +578,7 @@ struct perf_event { | |||
572 | struct list_head event_entry; | 578 | struct list_head event_entry; |
573 | struct list_head sibling_list; | 579 | struct list_head sibling_list; |
574 | int nr_siblings; | 580 | int nr_siblings; |
581 | int group_flags; | ||
575 | struct perf_event *group_leader; | 582 | struct perf_event *group_leader; |
576 | struct perf_event *output; | 583 | struct perf_event *output; |
577 | const struct pmu *pmu; | 584 | const struct pmu *pmu; |
@@ -656,7 +663,7 @@ struct perf_event { | |||
656 | 663 | ||
657 | perf_overflow_handler_t overflow_handler; | 664 | perf_overflow_handler_t overflow_handler; |
658 | 665 | ||
659 | #ifdef CONFIG_EVENT_PROFILE | 666 | #ifdef CONFIG_EVENT_TRACING |
660 | struct event_filter *filter; | 667 | struct event_filter *filter; |
661 | #endif | 668 | #endif |
662 | 669 | ||
@@ -681,7 +688,8 @@ struct perf_event_context { | |||
681 | */ | 688 | */ |
682 | struct mutex mutex; | 689 | struct mutex mutex; |
683 | 690 | ||
684 | struct list_head group_list; | 691 | struct list_head pinned_groups; |
692 | struct list_head flexible_groups; | ||
685 | struct list_head event_list; | 693 | struct list_head event_list; |
686 | int nr_events; | 694 | int nr_events; |
687 | int nr_active; | 695 | int nr_active; |
@@ -744,10 +752,9 @@ extern int perf_max_events; | |||
744 | 752 | ||
745 | extern const struct pmu *hw_perf_event_init(struct perf_event *event); | 753 | extern const struct pmu *hw_perf_event_init(struct perf_event *event); |
746 | 754 | ||
747 | extern void perf_event_task_sched_in(struct task_struct *task, int cpu); | 755 | extern void perf_event_task_sched_in(struct task_struct *task); |
748 | extern void perf_event_task_sched_out(struct task_struct *task, | 756 | extern void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); |
749 | struct task_struct *next, int cpu); | 757 | extern void perf_event_task_tick(struct task_struct *task); |
750 | extern void perf_event_task_tick(struct task_struct *task, int cpu); | ||
751 | extern int perf_event_init_task(struct task_struct *child); | 758 | extern int perf_event_init_task(struct task_struct *child); |
752 | extern void perf_event_exit_task(struct task_struct *child); | 759 | extern void perf_event_exit_task(struct task_struct *child); |
753 | extern void perf_event_free_task(struct task_struct *task); | 760 | extern void perf_event_free_task(struct task_struct *task); |
@@ -762,7 +769,7 @@ extern int perf_event_task_disable(void); | |||
762 | extern int perf_event_task_enable(void); | 769 | extern int perf_event_task_enable(void); |
763 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, | 770 | extern int hw_perf_group_sched_in(struct perf_event *group_leader, |
764 | struct perf_cpu_context *cpuctx, | 771 | struct perf_cpu_context *cpuctx, |
765 | struct perf_event_context *ctx, int cpu); | 772 | struct perf_event_context *ctx); |
766 | extern void perf_event_update_userpage(struct perf_event *event); | 773 | extern void perf_event_update_userpage(struct perf_event *event); |
767 | extern int perf_event_release_kernel(struct perf_event *event); | 774 | extern int perf_event_release_kernel(struct perf_event *event); |
768 | extern struct perf_event * | 775 | extern struct perf_event * |
@@ -850,9 +857,23 @@ extern int sysctl_perf_event_paranoid; | |||
850 | extern int sysctl_perf_event_mlock; | 857 | extern int sysctl_perf_event_mlock; |
851 | extern int sysctl_perf_event_sample_rate; | 858 | extern int sysctl_perf_event_sample_rate; |
852 | 859 | ||
860 | static inline bool perf_paranoid_tracepoint_raw(void) | ||
861 | { | ||
862 | return sysctl_perf_event_paranoid > -1; | ||
863 | } | ||
864 | |||
865 | static inline bool perf_paranoid_cpu(void) | ||
866 | { | ||
867 | return sysctl_perf_event_paranoid > 0; | ||
868 | } | ||
869 | |||
870 | static inline bool perf_paranoid_kernel(void) | ||
871 | { | ||
872 | return sysctl_perf_event_paranoid > 1; | ||
873 | } | ||
874 | |||
853 | extern void perf_event_init(void); | 875 | extern void perf_event_init(void); |
854 | extern void perf_tp_event(int event_id, u64 addr, u64 count, | 876 | extern void perf_tp_event(int event_id, u64 addr, u64 count, void *record, int entry_size); |
855 | void *record, int entry_size); | ||
856 | extern void perf_bp_event(struct perf_event *event, void *data); | 877 | extern void perf_bp_event(struct perf_event *event, void *data); |
857 | 878 | ||
858 | #ifndef perf_misc_flags | 879 | #ifndef perf_misc_flags |
@@ -873,12 +894,12 @@ extern void perf_event_enable(struct perf_event *event); | |||
873 | extern void perf_event_disable(struct perf_event *event); | 894 | extern void perf_event_disable(struct perf_event *event); |
874 | #else | 895 | #else |
875 | static inline void | 896 | static inline void |
876 | perf_event_task_sched_in(struct task_struct *task, int cpu) { } | 897 | perf_event_task_sched_in(struct task_struct *task) { } |
877 | static inline void | 898 | static inline void |
878 | perf_event_task_sched_out(struct task_struct *task, | 899 | perf_event_task_sched_out(struct task_struct *task, |
879 | struct task_struct *next, int cpu) { } | 900 | struct task_struct *next) { } |
880 | static inline void | 901 | static inline void |
881 | perf_event_task_tick(struct task_struct *task, int cpu) { } | 902 | perf_event_task_tick(struct task_struct *task) { } |
882 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } | 903 | static inline int perf_event_init_task(struct task_struct *child) { return 0; } |
883 | static inline void perf_event_exit_task(struct task_struct *child) { } | 904 | static inline void perf_event_exit_task(struct task_struct *child) { } |
884 | static inline void perf_event_free_task(struct task_struct *task) { } | 905 | static inline void perf_event_free_task(struct task_struct *task) { } |
@@ -893,13 +914,13 @@ static inline void | |||
893 | perf_sw_event(u32 event_id, u64 nr, int nmi, | 914 | perf_sw_event(u32 event_id, u64 nr, int nmi, |
894 | struct pt_regs *regs, u64 addr) { } | 915 | struct pt_regs *regs, u64 addr) { } |
895 | static inline void | 916 | static inline void |
896 | perf_bp_event(struct perf_event *event, void *data) { } | 917 | perf_bp_event(struct perf_event *event, void *data) { } |
897 | 918 | ||
898 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } | 919 | static inline void perf_event_mmap(struct vm_area_struct *vma) { } |
899 | static inline void perf_event_comm(struct task_struct *tsk) { } | 920 | static inline void perf_event_comm(struct task_struct *tsk) { } |
900 | static inline void perf_event_fork(struct task_struct *tsk) { } | 921 | static inline void perf_event_fork(struct task_struct *tsk) { } |
901 | static inline void perf_event_init(void) { } | 922 | static inline void perf_event_init(void) { } |
902 | static inline int perf_swevent_get_recursion_context(void) { return -1; } | 923 | static inline int perf_swevent_get_recursion_context(void) { return -1; } |
903 | static inline void perf_swevent_put_recursion_context(int rctx) { } | 924 | static inline void perf_swevent_put_recursion_context(int rctx) { } |
904 | static inline void perf_event_enable(struct perf_event *event) { } | 925 | static inline void perf_event_enable(struct perf_event *event) { } |
905 | static inline void perf_event_disable(struct perf_event *event) { } | 926 | static inline void perf_event_disable(struct perf_event *event) { } |