diff options
Diffstat (limited to 'include/linux/perf_event.h')
-rw-r--r-- | include/linux/perf_event.h | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 057bf22a8323..de2c41758e29 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -747,6 +747,16 @@ struct perf_event { | |||
747 | u64 tstamp_running; | 747 | u64 tstamp_running; |
748 | u64 tstamp_stopped; | 748 | u64 tstamp_stopped; |
749 | 749 | ||
750 | /* | ||
751 | * timestamp shadows the actual context timing but it can | ||
752 | * be safely used in NMI interrupt context. It reflects the | ||
753 | * context time as it was when the event was last scheduled in. | ||
754 | * | ||
755 | * ctx_time already accounts for ctx->timestamp. Therefore to | ||
756 | * compute ctx_time for a sample, simply add perf_clock(). | ||
757 | */ | ||
758 | u64 shadow_ctx_time; | ||
759 | |||
750 | struct perf_event_attr attr; | 760 | struct perf_event_attr attr; |
751 | struct hw_perf_event hw; | 761 | struct hw_perf_event hw; |
752 | 762 | ||
@@ -840,6 +850,7 @@ struct perf_event_context { | |||
840 | int nr_active; | 850 | int nr_active; |
841 | int is_active; | 851 | int is_active; |
842 | int nr_stat; | 852 | int nr_stat; |
853 | int rotate_disable; | ||
843 | atomic_t refcount; | 854 | atomic_t refcount; |
844 | struct task_struct *task; | 855 | struct task_struct *task; |
845 | 856 | ||
@@ -898,20 +909,6 @@ extern int perf_num_counters(void); | |||
898 | extern const char *perf_pmu_name(void); | 909 | extern const char *perf_pmu_name(void); |
899 | extern void __perf_event_task_sched_in(struct task_struct *task); | 910 | extern void __perf_event_task_sched_in(struct task_struct *task); |
900 | extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); | 911 | extern void __perf_event_task_sched_out(struct task_struct *task, struct task_struct *next); |
901 | |||
902 | extern atomic_t perf_task_events; | ||
903 | |||
904 | static inline void perf_event_task_sched_in(struct task_struct *task) | ||
905 | { | ||
906 | COND_STMT(&perf_task_events, __perf_event_task_sched_in(task)); | ||
907 | } | ||
908 | |||
909 | static inline | ||
910 | void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) | ||
911 | { | ||
912 | COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next)); | ||
913 | } | ||
914 | |||
915 | extern int perf_event_init_task(struct task_struct *child); | 912 | extern int perf_event_init_task(struct task_struct *child); |
916 | extern void perf_event_exit_task(struct task_struct *child); | 913 | extern void perf_event_exit_task(struct task_struct *child); |
917 | extern void perf_event_free_task(struct task_struct *task); | 914 | extern void perf_event_free_task(struct task_struct *task); |
@@ -1020,6 +1017,21 @@ have_event: | |||
1020 | __perf_sw_event(event_id, nr, nmi, regs, addr); | 1017 | __perf_sw_event(event_id, nr, nmi, regs, addr); |
1021 | } | 1018 | } |
1022 | 1019 | ||
1020 | extern atomic_t perf_task_events; | ||
1021 | |||
1022 | static inline void perf_event_task_sched_in(struct task_struct *task) | ||
1023 | { | ||
1024 | COND_STMT(&perf_task_events, __perf_event_task_sched_in(task)); | ||
1025 | } | ||
1026 | |||
1027 | static inline | ||
1028 | void perf_event_task_sched_out(struct task_struct *task, struct task_struct *next) | ||
1029 | { | ||
1030 | perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0); | ||
1031 | |||
1032 | COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next)); | ||
1033 | } | ||
1034 | |||
1023 | extern void perf_event_mmap(struct vm_area_struct *vma); | 1035 | extern void perf_event_mmap(struct vm_area_struct *vma); |
1024 | extern struct perf_guest_info_callbacks *perf_guest_cbs; | 1036 | extern struct perf_guest_info_callbacks *perf_guest_cbs; |
1025 | extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); | 1037 | extern int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *callbacks); |