diff options
Diffstat (limited to 'include/linux/ftrace_event.h')
-rw-r--r-- | include/linux/ftrace_event.h | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index 4ec5e67e18cf..c0f4b364c711 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/trace_seq.h> | 5 | #include <linux/trace_seq.h> |
6 | #include <linux/percpu.h> | 6 | #include <linux/percpu.h> |
7 | #include <linux/hardirq.h> | 7 | #include <linux/hardirq.h> |
8 | #include <linux/perf_event.h> | ||
8 | 9 | ||
9 | struct trace_array; | 10 | struct trace_array; |
10 | struct tracer; | 11 | struct tracer; |
@@ -57,6 +58,7 @@ struct trace_iterator { | |||
57 | /* The below is zeroed out in pipe_read */ | 58 | /* The below is zeroed out in pipe_read */ |
58 | struct trace_seq seq; | 59 | struct trace_seq seq; |
59 | struct trace_entry *ent; | 60 | struct trace_entry *ent; |
61 | int leftover; | ||
60 | int cpu; | 62 | int cpu; |
61 | u64 ts; | 63 | u64 ts; |
62 | 64 | ||
@@ -117,12 +119,11 @@ struct ftrace_event_call { | |||
117 | struct dentry *dir; | 119 | struct dentry *dir; |
118 | struct trace_event *event; | 120 | struct trace_event *event; |
119 | int enabled; | 121 | int enabled; |
120 | int (*regfunc)(void *); | 122 | int (*regfunc)(struct ftrace_event_call *); |
121 | void (*unregfunc)(void *); | 123 | void (*unregfunc)(struct ftrace_event_call *); |
122 | int id; | 124 | int id; |
123 | int (*raw_init)(void); | 125 | const char *print_fmt; |
124 | int (*show_format)(struct ftrace_event_call *call, | 126 | int (*raw_init)(struct ftrace_event_call *); |
125 | struct trace_seq *s); | ||
126 | int (*define_fields)(struct ftrace_event_call *); | 127 | int (*define_fields)(struct ftrace_event_call *); |
127 | struct list_head fields; | 128 | struct list_head fields; |
128 | int filter_active; | 129 | int filter_active; |
@@ -130,21 +131,18 @@ struct ftrace_event_call { | |||
130 | void *mod; | 131 | void *mod; |
131 | void *data; | 132 | void *data; |
132 | 133 | ||
133 | atomic_t profile_count; | 134 | int perf_refcount; |
134 | int (*profile_enable)(void); | 135 | int (*perf_event_enable)(struct ftrace_event_call *); |
135 | void (*profile_disable)(void); | 136 | void (*perf_event_disable)(struct ftrace_event_call *); |
136 | }; | 137 | }; |
137 | 138 | ||
138 | #define FTRACE_MAX_PROFILE_SIZE 2048 | 139 | #define PERF_MAX_TRACE_SIZE 2048 |
139 | |||
140 | extern char *trace_profile_buf; | ||
141 | extern char *trace_profile_buf_nmi; | ||
142 | 140 | ||
143 | #define MAX_FILTER_PRED 32 | 141 | #define MAX_FILTER_PRED 32 |
144 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ | 142 | #define MAX_FILTER_STR_VAL 256 /* Should handle KSYM_SYMBOL_LEN */ |
145 | 143 | ||
146 | extern void destroy_preds(struct ftrace_event_call *call); | 144 | extern void destroy_preds(struct ftrace_event_call *call); |
147 | extern int filter_match_preds(struct ftrace_event_call *call, void *rec); | 145 | extern int filter_match_preds(struct event_filter *filter, void *rec); |
148 | extern int filter_current_check_discard(struct ring_buffer *buffer, | 146 | extern int filter_current_check_discard(struct ring_buffer *buffer, |
149 | struct ftrace_event_call *call, | 147 | struct ftrace_event_call *call, |
150 | void *rec, | 148 | void *rec, |
@@ -157,11 +155,12 @@ enum { | |||
157 | FILTER_PTR_STRING, | 155 | FILTER_PTR_STRING, |
158 | }; | 156 | }; |
159 | 157 | ||
160 | extern int trace_define_field(struct ftrace_event_call *call, | 158 | extern int trace_event_raw_init(struct ftrace_event_call *call); |
161 | const char *type, const char *name, | 159 | extern int trace_define_field(struct ftrace_event_call *call, const char *type, |
162 | int offset, int size, int is_signed, | 160 | const char *name, int offset, int size, |
163 | int filter_type); | 161 | int is_signed, int filter_type); |
164 | extern int trace_define_common_fields(struct ftrace_event_call *call); | 162 | extern int trace_add_event_call(struct ftrace_event_call *call); |
163 | extern void trace_remove_event_call(struct ftrace_event_call *call); | ||
165 | 164 | ||
166 | #define is_signed_type(type) (((type)(-1)) < 0) | 165 | #define is_signed_type(type) (((type)(-1)) < 0) |
167 | 166 | ||
@@ -186,4 +185,30 @@ do { \ | |||
186 | __trace_printk(ip, fmt, ##args); \ | 185 | __trace_printk(ip, fmt, ##args); \ |
187 | } while (0) | 186 | } while (0) |
188 | 187 | ||
188 | #ifdef CONFIG_PERF_EVENTS | ||
189 | struct perf_event; | ||
190 | |||
191 | DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); | ||
192 | |||
193 | extern int perf_trace_enable(int event_id); | ||
194 | extern void perf_trace_disable(int event_id); | ||
195 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | ||
196 | char *filter_str); | ||
197 | extern void ftrace_profile_free_filter(struct perf_event *event); | ||
198 | extern void * | ||
199 | perf_trace_buf_prepare(int size, unsigned short type, int *rctxp, | ||
200 | unsigned long *irq_flags); | ||
201 | |||
202 | static inline void | ||
203 | perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, | ||
204 | u64 count, unsigned long irq_flags, struct pt_regs *regs) | ||
205 | { | ||
206 | struct trace_entry *entry = raw_data; | ||
207 | |||
208 | perf_tp_event(entry->type, addr, count, raw_data, size, regs); | ||
209 | perf_swevent_put_recursion_context(rctx); | ||
210 | local_irq_restore(irq_flags); | ||
211 | } | ||
212 | #endif | ||
213 | |||
189 | #endif /* _LINUX_FTRACE_EVENT_H */ | 214 | #endif /* _LINUX_FTRACE_EVENT_H */ |