diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-20 18:54:37 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-20 18:54:37 -0400 |
| commit | 467f9957d9283be40101d7255d06fae7e211ff4c (patch) | |
| tree | 71d155ab52b3a78bc88d0c8088b09b3c37f9357a /include/linux | |
| parent | 78f28b7c555359c67c2a0d23f7436e915329421e (diff) | |
| parent | cdf8073d6b2c6c5a3cd6ce0e6c1297157f7f99ba (diff) | |
Merge branch 'perfcounters-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perfcounters-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (58 commits)
perf_counter: Fix perf_copy_attr() pointer arithmetic
perf utils: Use a define for the maximum length of a trace event
perf: Add timechart help text and add timechart to "perf help"
tracing, x86, cpuidle: Move the end point of a C state in the power tracer
perf utils: Be consistent about minimum text size in the svghelper
perf timechart: Add "perf timechart record"
perf: Add the timechart tool
perf: Add a SVG helper library file
tracing, perf: Convert the power tracer into an event tracer
perf: Add a sample_event type to the event_union
perf: Allow perf utilities to have "callback" options without arguments
perf: Store trace event name/id pairs in perf.data
perf: Add a timestamp to fork events
sched_clock: Make it NMI safe
perf_counter: Fix up swcounter throttling
x86, perf_counter, bts: Optimize BTS overflow handling
perf sched: Add --input=file option to builtin-sched.c
perf trace: Sample timestamp and cpu when using record flag
perf tools: Increase MAX_EVENT_LENGTH
perf tools: Fix memory leak in read_ftrace_printk()
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/perf_counter.h | 80 |
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 | ||
| 696 | struct 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, | |||
| 716 | extern void perf_counter_update_userpage(struct perf_counter *counter); | 735 | extern void perf_counter_update_userpage(struct perf_counter *counter); |
| 717 | 736 | ||
| 718 | struct perf_sample_data { | 737 | struct 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 | ||
| 758 | extern 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); | ||
| 762 | extern 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 | |||
| 725 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, | 767 | extern int perf_counter_overflow(struct perf_counter *counter, int nmi, |
| 726 | struct perf_sample_data *data); | 768 | struct perf_sample_data *data, |
| 727 | extern 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 | ||
| 819 | extern int perf_output_begin(struct perf_output_handle *handle, | ||
| 820 | struct perf_counter *counter, unsigned int size, | ||
| 821 | int nmi, int sample); | ||
| 822 | extern void perf_output_end(struct perf_output_handle *handle); | ||
| 823 | extern void perf_output_copy(struct perf_output_handle *handle, | ||
| 824 | const void *buf, unsigned int len); | ||
| 778 | #else | 825 | #else |
| 779 | static inline void | 826 | static inline void |
| 780 | perf_counter_task_sched_in(struct task_struct *task, int cpu) { } | 827 | perf_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) { } | |||
| 801 | static inline void perf_counter_comm(struct task_struct *tsk) { } | 848 | static inline void perf_counter_comm(struct task_struct *tsk) { } |
| 802 | static inline void perf_counter_fork(struct task_struct *tsk) { } | 849 | static inline void perf_counter_fork(struct task_struct *tsk) { } |
| 803 | static inline void perf_counter_init(void) { } | 850 | static inline void perf_counter_init(void) { } |
| 851 | |||
| 852 | static inline int | ||
| 853 | perf_output_begin(struct perf_output_handle *handle, struct perf_counter *c, | ||
| 854 | unsigned int size, int nmi, int sample) { } | ||
| 855 | static inline void perf_output_end(struct perf_output_handle *handle) { } | ||
| 856 | static inline void | ||
| 857 | perf_output_copy(struct perf_output_handle *handle, | ||
| 858 | const void *buf, unsigned int len) { } | ||
| 859 | static inline void | ||
| 860 | perf_output_sample(struct perf_output_handle *handle, | ||
| 861 | struct perf_event_header *header, | ||
| 862 | struct perf_sample_data *data, | ||
| 863 | struct perf_counter *counter) { } | ||
| 864 | static inline void | ||
| 865 | perf_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 */ |
