aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/perf_counter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/perf_counter.h')
-rw-r--r--include/linux/perf_counter.h80
1 files changed, 74 insertions, 6 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 972f90d7a32f..bd341007c4fc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -199,10 +199,14 @@ struct perf_counter_attr {
199 inherit_stat : 1, /* per task counts */ 199 inherit_stat : 1, /* per task counts */
200 enable_on_exec : 1, /* next exec enables */ 200 enable_on_exec : 1, /* next exec enables */
201 task : 1, /* trace fork/exit */ 201 task : 1, /* trace fork/exit */
202 watermark : 1, /* wakeup_watermark */
202 203
203 __reserved_1 : 50; 204 __reserved_1 : 49;
204 205
205 __u32 wakeup_events; /* wakeup every n events */ 206 union {
207 __u32 wakeup_events; /* wakeup every n events */
208 __u32 wakeup_watermark; /* bytes before wakeup */
209 };
206 __u32 __reserved_2; 210 __u32 __reserved_2;
207 211
208 __u64 __reserved_3; 212 __u64 __reserved_3;
@@ -332,6 +336,7 @@ enum perf_event_type {
332 * struct perf_event_header header; 336 * struct perf_event_header header;
333 * u32 pid, ppid; 337 * u32 pid, ppid;
334 * u32 tid, ptid; 338 * u32 tid, ptid;
339 * u64 time;
335 * }; 340 * };
336 */ 341 */
337 PERF_EVENT_EXIT = 4, 342 PERF_EVENT_EXIT = 4,
@@ -352,6 +357,7 @@ enum perf_event_type {
352 * struct perf_event_header header; 357 * struct perf_event_header header;
353 * u32 pid, ppid; 358 * u32 pid, ppid;
354 * u32 tid, ptid; 359 * u32 tid, ptid;
360 * { u64 time; } && PERF_SAMPLE_TIME
355 * }; 361 * };
356 */ 362 */
357 PERF_EVENT_FORK = 7, 363 PERF_EVENT_FORK = 7,
@@ -521,6 +527,8 @@ struct perf_mmap_data {
521 atomic_t wakeup; /* needs a wakeup */ 527 atomic_t wakeup; /* needs a wakeup */
522 atomic_t lost; /* nr records lost */ 528 atomic_t lost; /* nr records lost */
523 529
530 long watermark; /* wakeup watermark */
531
524 struct perf_counter_mmap_page *user_page; 532 struct perf_counter_mmap_page *user_page;
525 void *data_pages[0]; 533 void *data_pages[0];
526}; 534};
@@ -685,6 +693,17 @@ struct perf_cpu_context {
685 int recursion[4]; 693 int recursion[4];
686}; 694};
687 695
696struct perf_output_handle {
697 struct perf_counter *counter;
698 struct perf_mmap_data *data;
699 unsigned long head;
700 unsigned long offset;
701 int nmi;
702 int sample;
703 int locked;
704 unsigned long flags;
705};
706
688#ifdef CONFIG_PERF_COUNTERS 707#ifdef CONFIG_PERF_COUNTERS
689 708
690/* 709/*
@@ -716,16 +735,38 @@ extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
716extern void perf_counter_update_userpage(struct perf_counter *counter); 735extern void perf_counter_update_userpage(struct perf_counter *counter);
717 736
718struct perf_sample_data { 737struct perf_sample_data {
719 struct pt_regs *regs; 738 u64 type;
739
740 u64 ip;
741 struct {
742 u32 pid;
743 u32 tid;
744 } tid_entry;
745 u64 time;
720 u64 addr; 746 u64 addr;
747 u64 id;
748 u64 stream_id;
749 struct {
750 u32 cpu;
751 u32 reserved;
752 } cpu_entry;
721 u64 period; 753 u64 period;
754 struct perf_callchain_entry *callchain;
722 struct perf_raw_record *raw; 755 struct perf_raw_record *raw;
723}; 756};
724 757
758extern void perf_output_sample(struct perf_output_handle *handle,
759 struct perf_event_header *header,
760 struct perf_sample_data *data,
761 struct perf_counter *counter);
762extern void perf_prepare_sample(struct perf_event_header *header,
763 struct perf_sample_data *data,
764 struct perf_counter *counter,
765 struct pt_regs *regs);
766
725extern int perf_counter_overflow(struct perf_counter *counter, int nmi, 767extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
726 struct perf_sample_data *data); 768 struct perf_sample_data *data,
727extern void perf_counter_output(struct perf_counter *counter, int nmi, 769 struct pt_regs *regs);
728 struct perf_sample_data *data);
729 770
730/* 771/*
731 * Return 1 for a software counter, 0 for a hardware counter 772 * Return 1 for a software counter, 0 for a hardware counter
@@ -775,6 +816,12 @@ extern void perf_tpcounter_event(int event_id, u64 addr, u64 count,
775#define perf_instruction_pointer(regs) instruction_pointer(regs) 816#define perf_instruction_pointer(regs) instruction_pointer(regs)
776#endif 817#endif
777 818
819extern int perf_output_begin(struct perf_output_handle *handle,
820 struct perf_counter *counter, unsigned int size,
821 int nmi, int sample);
822extern void perf_output_end(struct perf_output_handle *handle);
823extern void perf_output_copy(struct perf_output_handle *handle,
824 const void *buf, unsigned int len);
778#else 825#else
779static inline void 826static inline void
780perf_counter_task_sched_in(struct task_struct *task, int cpu) { } 827perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
@@ -801,7 +848,28 @@ static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
801static inline void perf_counter_comm(struct task_struct *tsk) { } 848static inline void perf_counter_comm(struct task_struct *tsk) { }
802static inline void perf_counter_fork(struct task_struct *tsk) { } 849static inline void perf_counter_fork(struct task_struct *tsk) { }
803static inline void perf_counter_init(void) { } 850static inline void perf_counter_init(void) { }
851
852static inline int
853perf_output_begin(struct perf_output_handle *handle, struct perf_counter *c,
854 unsigned int size, int nmi, int sample) { }
855static inline void perf_output_end(struct perf_output_handle *handle) { }
856static inline void
857perf_output_copy(struct perf_output_handle *handle,
858 const void *buf, unsigned int len) { }
859static inline void
860perf_output_sample(struct perf_output_handle *handle,
861 struct perf_event_header *header,
862 struct perf_sample_data *data,
863 struct perf_counter *counter) { }
864static inline void
865perf_prepare_sample(struct perf_event_header *header,
866 struct perf_sample_data *data,
867 struct perf_counter *counter,
868 struct pt_regs *regs) { }
804#endif 869#endif
805 870
871#define perf_output_put(handle, x) \
872 perf_output_copy((handle), &(x), sizeof(x))
873
806#endif /* __KERNEL__ */ 874#endif /* __KERNEL__ */
807#endif /* _LINUX_PERF_COUNTER_H */ 875#endif /* _LINUX_PERF_COUNTER_H */