diff options
Diffstat (limited to 'include/linux/ftrace_event.h')
-rw-r--r-- | include/linux/ftrace_event.h | 103 |
1 files changed, 75 insertions, 28 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index c082f223e2fe..3167f2df4126 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
@@ -73,18 +73,25 @@ struct trace_iterator { | |||
73 | }; | 73 | }; |
74 | 74 | ||
75 | 75 | ||
76 | struct trace_event; | ||
77 | |||
76 | typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, | 78 | typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter, |
77 | int flags); | 79 | int flags, struct trace_event *event); |
78 | struct trace_event { | 80 | |
79 | struct hlist_node node; | 81 | struct trace_event_functions { |
80 | struct list_head list; | ||
81 | int type; | ||
82 | trace_print_func trace; | 82 | trace_print_func trace; |
83 | trace_print_func raw; | 83 | trace_print_func raw; |
84 | trace_print_func hex; | 84 | trace_print_func hex; |
85 | trace_print_func binary; | 85 | trace_print_func binary; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | struct trace_event { | ||
89 | struct hlist_node node; | ||
90 | struct list_head list; | ||
91 | int type; | ||
92 | struct trace_event_functions *funcs; | ||
93 | }; | ||
94 | |||
88 | extern int register_ftrace_event(struct trace_event *event); | 95 | extern int register_ftrace_event(struct trace_event *event); |
89 | extern int unregister_ftrace_event(struct trace_event *event); | 96 | extern int unregister_ftrace_event(struct trace_event *event); |
90 | 97 | ||
@@ -116,28 +123,70 @@ void tracing_record_cmdline(struct task_struct *tsk); | |||
116 | 123 | ||
117 | struct event_filter; | 124 | struct event_filter; |
118 | 125 | ||
126 | enum trace_reg { | ||
127 | TRACE_REG_REGISTER, | ||
128 | TRACE_REG_UNREGISTER, | ||
129 | TRACE_REG_PERF_REGISTER, | ||
130 | TRACE_REG_PERF_UNREGISTER, | ||
131 | }; | ||
132 | |||
133 | struct ftrace_event_call; | ||
134 | |||
135 | struct ftrace_event_class { | ||
136 | char *system; | ||
137 | void *probe; | ||
138 | #ifdef CONFIG_PERF_EVENTS | ||
139 | void *perf_probe; | ||
140 | #endif | ||
141 | int (*reg)(struct ftrace_event_call *event, | ||
142 | enum trace_reg type); | ||
143 | int (*define_fields)(struct ftrace_event_call *); | ||
144 | struct list_head *(*get_fields)(struct ftrace_event_call *); | ||
145 | struct list_head fields; | ||
146 | int (*raw_init)(struct ftrace_event_call *); | ||
147 | }; | ||
148 | |||
149 | enum { | ||
150 | TRACE_EVENT_FL_ENABLED_BIT, | ||
151 | TRACE_EVENT_FL_FILTERED_BIT, | ||
152 | }; | ||
153 | |||
154 | enum { | ||
155 | TRACE_EVENT_FL_ENABLED = (1 << TRACE_EVENT_FL_ENABLED_BIT), | ||
156 | TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT), | ||
157 | }; | ||
158 | |||
119 | struct ftrace_event_call { | 159 | struct ftrace_event_call { |
120 | struct list_head list; | 160 | struct list_head list; |
161 | struct ftrace_event_class *class; | ||
121 | char *name; | 162 | char *name; |
122 | char *system; | ||
123 | struct dentry *dir; | 163 | struct dentry *dir; |
124 | struct trace_event *event; | 164 | struct trace_event event; |
125 | int enabled; | ||
126 | int (*regfunc)(struct ftrace_event_call *); | ||
127 | void (*unregfunc)(struct ftrace_event_call *); | ||
128 | int id; | ||
129 | const char *print_fmt; | 165 | const char *print_fmt; |
130 | int (*raw_init)(struct ftrace_event_call *); | ||
131 | int (*define_fields)(struct ftrace_event_call *); | ||
132 | struct list_head fields; | ||
133 | int filter_active; | ||
134 | struct event_filter *filter; | 166 | struct event_filter *filter; |
135 | void *mod; | 167 | void *mod; |
136 | void *data; | 168 | void *data; |
137 | 169 | ||
170 | /* | ||
171 | * 32 bit flags: | ||
172 | * bit 1: enabled | ||
173 | * bit 2: filter_active | ||
174 | * | ||
175 | * Changes to flags must hold the event_mutex. | ||
176 | * | ||
177 | * Note: Reads of flags do not hold the event_mutex since | ||
178 | * they occur in critical sections. But the way flags | ||
179 | * is currently used, these changes do no affect the code | ||
180 | * except that when a change is made, it may have a slight | ||
181 | * delay in propagating the changes to other CPUs due to | ||
182 | * caching and such. | ||
183 | */ | ||
184 | unsigned int flags; | ||
185 | |||
186 | #ifdef CONFIG_PERF_EVENTS | ||
138 | int perf_refcount; | 187 | int perf_refcount; |
139 | int (*perf_event_enable)(struct ftrace_event_call *); | 188 | struct hlist_head *perf_events; |
140 | void (*perf_event_disable)(struct ftrace_event_call *); | 189 | #endif |
141 | }; | 190 | }; |
142 | 191 | ||
143 | #define PERF_MAX_TRACE_SIZE 2048 | 192 | #define PERF_MAX_TRACE_SIZE 2048 |
@@ -194,24 +243,22 @@ struct perf_event; | |||
194 | 243 | ||
195 | DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); | 244 | DECLARE_PER_CPU(struct pt_regs, perf_trace_regs); |
196 | 245 | ||
197 | extern int perf_trace_enable(int event_id); | 246 | extern int perf_trace_init(struct perf_event *event); |
198 | extern void perf_trace_disable(int event_id); | 247 | extern void perf_trace_destroy(struct perf_event *event); |
199 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | 248 | extern int perf_trace_enable(struct perf_event *event); |
249 | extern void perf_trace_disable(struct perf_event *event); | ||
250 | extern int ftrace_profile_set_filter(struct perf_event *event, int event_id, | ||
200 | char *filter_str); | 251 | char *filter_str); |
201 | extern void ftrace_profile_free_filter(struct perf_event *event); | 252 | extern void ftrace_profile_free_filter(struct perf_event *event); |
202 | extern void * | 253 | extern void *perf_trace_buf_prepare(int size, unsigned short type, |
203 | perf_trace_buf_prepare(int size, unsigned short type, int *rctxp, | 254 | struct pt_regs *regs, int *rctxp); |
204 | unsigned long *irq_flags); | ||
205 | 255 | ||
206 | static inline void | 256 | static inline void |
207 | perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, | 257 | perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr, |
208 | u64 count, unsigned long irq_flags, struct pt_regs *regs) | 258 | u64 count, struct pt_regs *regs, void *head) |
209 | { | 259 | { |
210 | struct trace_entry *entry = raw_data; | 260 | perf_tp_event(addr, count, raw_data, size, regs, head); |
211 | |||
212 | perf_tp_event(entry->type, addr, count, raw_data, size, regs); | ||
213 | perf_swevent_put_recursion_context(rctx); | 261 | perf_swevent_put_recursion_context(rctx); |
214 | local_irq_restore(irq_flags); | ||
215 | } | 262 | } |
216 | #endif | 263 | #endif |
217 | 264 | ||