diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 18:30:21 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-05 18:30:21 -0500 |
| commit | c3fa27d1367fac63ac8533d6f20ea851d0d70a10 (patch) | |
| tree | e7731554085e22b6b63411b1ebb401079f3e0bbb /include | |
| parent | 96fa2b508d2d3fe040cf4ef2fffb955f0a537ea1 (diff) | |
| parent | d103d01e4b19f185d3c85f77402b605534c32e89 (diff) | |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (470 commits)
x86: Fix comments of register/stack access functions
perf tools: Replace %m with %a in sscanf
hw-breakpoints: Keep track of user disabled breakpoints
tracing/syscalls: Make syscall events print callbacks static
tracing: Add DEFINE_EVENT(), DEFINE_SINGLE_EVENT() support to docbook
perf: Don't free perf_mmap_data until work has been done
perf_event: Fix compile error
perf tools: Fix _GNU_SOURCE macro related strndup() build error
trace_syscalls: Remove unused syscall_name_to_nr()
trace_syscalls: Simplify syscall profile
trace_syscalls: Remove duplicate init_enter_##sname()
trace_syscalls: Add syscall_nr field to struct syscall_metadata
trace_syscalls: Remove enter_id exit_id
trace_syscalls: Set event_enter_##sname->data to its metadata
trace_syscalls: Remove unused event_syscall_enter and event_syscall_exit
perf_event: Initialize data.period in perf_swevent_hrtimer()
perf probe: Simplify event naming
perf probe: Add --list option for listing current probe events
perf probe: Add argv_split() from lib/argv_split.c
perf probe: Move probe event utility functions to probe-event.c
...
Diffstat (limited to 'include')
24 files changed, 1068 insertions, 850 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4ec5e67e18c..47bbdf9c38d 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -117,12 +117,12 @@ struct ftrace_event_call { | |||
| 117 | struct dentry *dir; | 117 | struct dentry *dir; |
| 118 | struct trace_event *event; | 118 | struct trace_event *event; |
| 119 | int enabled; | 119 | int enabled; |
| 120 | int (*regfunc)(void *); | 120 | int (*regfunc)(struct ftrace_event_call *); |
| 121 | void (*unregfunc)(void *); | 121 | void (*unregfunc)(struct ftrace_event_call *); |
| 122 | int id; | 122 | int id; |
| 123 | int (*raw_init)(void); | 123 | int (*raw_init)(struct ftrace_event_call *); |
| 124 | int (*show_format)(struct ftrace_event_call *call, | 124 | int (*show_format)(struct ftrace_event_call *, |
| 125 | struct trace_seq *s); | 125 | struct trace_seq *); |
| 126 | int (*define_fields)(struct ftrace_event_call *); | 126 | int (*define_fields)(struct ftrace_event_call *); |
| 127 | struct list_head fields; | 127 | struct list_head fields; |
| 128 | int filter_active; | 128 | int filter_active; |
| @@ -131,20 +131,20 @@ struct ftrace_event_call { | |||
| 131 | void *data; | 131 | void *data; |
| 132 | 132 | ||
| 133 | atomic_t profile_count; | 133 | atomic_t profile_count; |
| 134 | int (*profile_enable)(void); | 134 | int (*profile_enable)(struct ftrace_event_call *); |
| 135 | void (*profile_disable)(void); | 135 | void (*profile_disable)(struct ftrace_event_call *); |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | #define FTRACE_MAX_PROFILE_SIZE 2048 | 138 | #define FTRACE_MAX_PROFILE_SIZE 2048 |
| 139 | 139 | ||
| 140 | extern char *trace_profile_buf; | 140 | extern char *perf_trace_buf; |
| 141 | extern char *trace_profile_buf_nmi; | 141 | extern char *perf_trace_buf_nmi; |
| 142 | 142 | ||
| 143 | #define MAX_FILTER_PRED 32 | 143 | #define MAX_FILTER_PRED 32 |
| 144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
| 145 | 145 | ||
| 146 | extern void destroy_preds(struct ftrace_event_call *call); | 146 | extern void destroy_preds(struct ftrace_event_call *call); |
| 147 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); | 147 | extern int filter_match_preds(struct event_filter *filter, void *rec); |
| 148 | extern int filter_current_check_discard(struct ring_buffer *buffer, | 148 | extern int filter_current_check_discard(struct ring_buffer *buffer, |
| 149 | struct ftrace_event_call *call, | 149 | struct ftrace_event_call *call, |
| 150 | void *rec, | 150 | void *rec, |
| @@ -157,11 +157,12 @@ enum { | |||
| 157 | FILTER_PTR_STRING, | 157 | FILTER_PTR_STRING, |
| 158 | }; | 158 | }; |
| 159 | 159 | ||
| 160 | extern int trace_define_field(struct ftrace_event_call *call, | ||
| 161 | const char *type, const char *name, | ||
| 162 | int offset, int size, int is_signed, | ||
| 163 | int filter_type); | ||
| 164 | extern int trace_define_common_fields(struct ftrace_event_call *call); | 160 | extern int trace_define_common_fields(struct ftrace_event_call *call); |
| 161 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, | ||
| 162 | const char *name, int offset, int size, | ||
| 163 | int is_signed, int filter_type); | ||
| 164 | extern int trace_add_event_call(struct ftrace_event_call *call); | ||
| 165 | extern void trace_remove_event_call(struct ftrace_event_call *call); | ||
| 165 | 166 | ||
| 166 | #define is_signed_type(type) (((type)(-1)) < 0) | 167 | #define is_signed_type(type) (((type)(-1)) < 0) |
| 167 | 168 | ||
| @@ -186,4 +187,13 @@ do { \ | |||
| 186 | __trace_printk(ip, fmt, ##args); \ | 187 | __trace_printk(ip, fmt, ##args); \ |
| 187 | } while (0) | 188 | } while (0) |
| 188 | 189 | ||
| 190 | #ifdef CONFIG_EVENT_PROFILE | ||
| 191 | struct perf_event; | ||
| 192 | extern int ftrace_profile_enable(int event_id); | ||
| 193 | extern void ftrace_profile_disable(int event_id); | ||
| 194 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | ||
| 195 | char *filter_str); | ||
| 196 | extern void ftrace_profile_free_filter(struct perf_event *event); | ||
| 197 | #endif | ||
| 198 | |||
| 189 | #endif /* _LINUX_FTRACE_EVENT_H */ | 199 | #endif /* _LINUX_FTRACE_EVENT_H */ |
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h new file mode 100644 index 00000000000..a03daed08c5 --- /dev/null +++ b/include/linux/hw_breakpoint.h | |||
| @@ -0,0 +1,131 @@ | |||
| 1 | #ifndef _LINUX_HW_BREAKPOINT_H | ||
| 2 | #define _LINUX_HW_BREAKPOINT_H | ||
| 3 | |||
| 4 | enum { | ||
| 5 | HW_BREAKPOINT_LEN_1 = 1, | ||
| 6 | HW_BREAKPOINT_LEN_2 = 2, | ||
| 7 | HW_BREAKPOINT_LEN_4 = 4, | ||
| 8 | HW_BREAKPOINT_LEN_8 = 8, | ||
| 9 | }; | ||
| 10 | |||
| 11 | enum { | ||
| 12 | HW_BREAKPOINT_R = 1, | ||
| 13 | HW_BREAKPOINT_W = 2, | ||
| 14 | HW_BREAKPOINT_X = 4, | ||
| 15 | }; | ||
| 16 | |||
| 17 | #ifdef __KERNEL__ | ||
| 18 | |||
| 19 | #include <linux/perf_event.h> | ||
| 20 | |||
| 21 | #ifdef CONFIG_HAVE_HW_BREAKPOINT | ||
| 22 | |||
| 23 | /* As it's for in-kernel or ptrace use, we want it to be pinned */ | ||
| 24 | #define DEFINE_BREAKPOINT_ATTR(name) \ | ||
| 25 | struct perf_event_attr name = { \ | ||
| 26 | .type = PERF_TYPE_BREAKPOINT, \ | ||
| 27 | .size = sizeof(name), \ | ||
| 28 | .pinned = 1, \ | ||
| 29 | }; | ||
| 30 | |||
| 31 | static inline void hw_breakpoint_init(struct perf_event_attr *attr) | ||
| 32 | { | ||
| 33 | attr->type = PERF_TYPE_BREAKPOINT; | ||
| 34 | attr->size = sizeof(*attr); | ||
| 35 | attr->pinned = 1; | ||
| 36 | } | ||
| 37 | |||
| 38 | static inline unsigned long hw_breakpoint_addr(struct perf_event *bp) | ||
| 39 | { | ||
| 40 | return bp->attr.bp_addr; | ||
| 41 | } | ||
| 42 | |||
| 43 | static inline int hw_breakpoint_type(struct perf_event *bp) | ||
| 44 | { | ||
| 45 | return bp->attr.bp_type; | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline int hw_breakpoint_len(struct perf_event *bp) | ||
| 49 | { | ||
| 50 | return bp->attr.bp_len; | ||
| 51 | } | ||
| 52 | |||
| 53 | extern struct perf_event * | ||
| 54 | register_user_hw_breakpoint(struct perf_event_attr *attr, | ||
| 55 | perf_callback_t triggered, | ||
| 56 | struct task_struct *tsk); | ||
| 57 | |||
| 58 | /* FIXME: only change from the attr, and don't unregister */ | ||
| 59 | extern struct perf_event * | ||
| 60 | modify_user_hw_breakpoint(struct perf_event *bp, | ||
| 61 | struct perf_event_attr *attr, | ||
| 62 | perf_callback_t triggered, | ||
| 63 | struct task_struct *tsk); | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Kernel breakpoints are not associated with any particular thread. | ||
| 67 | */ | ||
| 68 | extern struct perf_event * | ||
| 69 | register_wide_hw_breakpoint_cpu(struct perf_event_attr *attr, | ||
| 70 | perf_callback_t triggered, | ||
