blob: 3cbb96ef34f489e51faa629573696b6b238381f7 [file] [log] [blame]
Steven Rostedtf42c85e2009-04-13 12:25:37 -04001/*
2 * Stage 1 of the trace events.
3 *
4 * Override the macros in <trace/trace_events.h> to include the following:
5 *
6 * struct ftrace_raw_<call> {
7 * struct trace_entry ent;
8 * <type> <item>;
9 * <type2> <item2>[<len>];
10 * [...]
11 * };
12 *
13 * The <type> <item> is created by the __field(type, item) macro or
14 * the __array(type2, item2, len) macro.
15 * We simply do "type item;", and that will create the fields
16 * in the structure.
17 */
18
19#include <linux/ftrace_event.h>
20
Steven Rostedtf42c85e2009-04-13 12:25:37 -040021#undef __field
22#define __field(type, item) type item;
23
Li Zefan7fcb7c42009-06-01 15:35:46 +080024#undef __array
25#define __array(type, item, len) type item[len];
26
27#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +080028#define __dynamic_array(type, item, len) u32 __data_loc_##item;
Li Zefan7fcb7c42009-06-01 15:35:46 +080029
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020030#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +080031#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020032
Steven Rostedtf42c85e2009-04-13 12:25:37 -040033#undef TP_STRUCT__entry
34#define TP_STRUCT__entry(args...) args
35
36#undef TRACE_EVENT
37#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
38 struct ftrace_raw_##name { \
39 struct trace_entry ent; \
40 tstruct \
Li Zefan7fcb7c42009-06-01 15:35:46 +080041 char __data[0]; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -040042 }; \
43 static struct ftrace_event_call event_##name
44
45#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
46
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020047
Steven Rostedtf42c85e2009-04-13 12:25:37 -040048/*
49 * Stage 2 of the trace events.
50 *
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020051 * Include the following:
52 *
Li Zefan7fcb7c42009-06-01 15:35:46 +080053 * struct ftrace_data_offsets_<call> {
Li Zefan7d536cb2009-07-16 10:54:02 +080054 * u32 <item1>;
55 * u32 <item2>;
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020056 * [...]
57 * };
58 *
Li Zefan7d536cb2009-07-16 10:54:02 +080059 * The __dynamic_array() macro will create each u32 <item>, this is
Li Zefan7fcb7c42009-06-01 15:35:46 +080060 * to keep the offset of each array from the beginning of the event.
Li Zefan7d536cb2009-07-16 10:54:02 +080061 * The size of an array is also encoded, in the higher 16 bits of <item>.
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020062 */
63
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020064#undef __field
65#define __field(type, item);
66
Li Zefan7fcb7c42009-06-01 15:35:46 +080067#undef __array
68#define __array(type, item, len)
69
70#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +080071#define __dynamic_array(type, item, len) u32 item;
Li Zefan7fcb7c42009-06-01 15:35:46 +080072
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020073#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +080074#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020075
76#undef TRACE_EVENT
77#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
Li Zefan7fcb7c42009-06-01 15:35:46 +080078 struct ftrace_data_offsets_##call { \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020079 tstruct; \
80 };
81
82#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
83
84/*
Steven Rostedt6ff9a642009-06-10 14:28:34 -040085 * Setup the showing format of trace point.
86 *
87 * int
88 * ftrace_format_##call(struct trace_seq *s)
89 * {
90 * struct ftrace_raw_##call field;
91 * int ret;
92 *
93 * ret = trace_seq_printf(s, #type " " #item ";"
94 * " offset:%u; size:%u;\n",
95 * offsetof(struct ftrace_raw_##call, item),
96 * sizeof(field.type));
97 *
98 * }
99 */
100
101#undef TP_STRUCT__entry
102#define TP_STRUCT__entry(args...) args
103
104#undef __field
105#define __field(type, item) \
106 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
107 "offset:%u;\tsize:%u;\n", \
108 (unsigned int)offsetof(typeof(field), item), \
109 (unsigned int)sizeof(field.item)); \
110 if (!ret) \
111 return 0;
112
113#undef __array
114#define __array(type, item, len) \
115 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
116 "offset:%u;\tsize:%u;\n", \
117 (unsigned int)offsetof(typeof(field), item), \
118 (unsigned int)sizeof(field.item)); \
119 if (!ret) \
120 return 0;
121
122#undef __dynamic_array
123#define __dynamic_array(type, item, len) \
Lai Jiangshan68fd60a2009-07-16 10:53:34 +0800124 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
Steven Rostedt6ff9a642009-06-10 14:28:34 -0400125 "offset:%u;\tsize:%u;\n", \
126 (unsigned int)offsetof(typeof(field), \
127 __data_loc_##item), \
128 (unsigned int)sizeof(field.__data_loc_##item)); \
129 if (!ret) \
130 return 0;
131
132#undef __string
133#define __string(item, src) __dynamic_array(char, item, -1)
134
135#undef __entry
136#define __entry REC
137
138#undef __print_symbolic
139#undef __get_dynamic_array
140#undef __get_str
141
142#undef TP_printk
143#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
144
145#undef TP_fast_assign
146#define TP_fast_assign(args...) args
147
148#undef TRACE_EVENT
149#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
150static int \
151ftrace_format_##call(struct trace_seq *s) \
152{ \
153 struct ftrace_raw_##call field __attribute__((unused)); \
154 int ret = 0; \
155 \
156 tstruct; \
157 \
158 trace_seq_printf(s, "\nprint fmt: " print); \
159 \
160 return ret; \
161}
162
163#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
164
165/*
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200166 * Stage 3 of the trace events.
167 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400168 * Override the macros in <trace/trace_events.h> to include the following:
169 *
170 * enum print_line_t
171 * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
172 * {
173 * struct trace_seq *s = &iter->seq;
174 * struct ftrace_raw_<call> *field; <-- defined in stage 1
175 * struct trace_entry *entry;
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200176 * struct trace_seq *p;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400177 * int ret;
178 *
179 * entry = iter->ent;
180 *
181 * if (entry->type != event_<call>.id) {
182 * WARN_ON_ONCE(1);
183 * return TRACE_TYPE_UNHANDLED;
184 * }
185 *
186 * field = (typeof(field))entry;
187 *
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200188 * p = get_cpu_var(ftrace_event_seq);
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100189 * trace_seq_init(p);
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400190 * ret = trace_seq_printf(s, <TP_printk> "\n");
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200191 * put_cpu();
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400192 * if (!ret)
193 * return TRACE_TYPE_PARTIAL_LINE;
194 *
195 * return TRACE_TYPE_HANDLED;
196 * }
197 *
198 * This is the method used to print the raw event to the trace
199 * output format. Note, this is not needed if the data is read
200 * in binary.
201 */
202
203#undef __entry
204#define __entry field
205
206#undef TP_printk
207#define TP_printk(fmt, args...) fmt "\n", args
208
Li Zefan7fcb7c42009-06-01 15:35:46 +0800209#undef __get_dynamic_array
210#define __get_dynamic_array(field) \
Li Zefan7d536cb2009-07-16 10:54:02 +0800211 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
Li Zefan7fcb7c42009-06-01 15:35:46 +0800212
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200213#undef __get_str
Li Zefan7fcb7c42009-06-01 15:35:46 +0800214#define __get_str(field) (char *)__get_dynamic_array(field)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200215
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200216#undef __print_flags
217#define __print_flags(flag, delim, flag_array...) \
218 ({ \
219 static const struct trace_print_flags flags[] = \
220 { flag_array, { -1, NULL }}; \
221 ftrace_print_flags_seq(p, delim, flag, flags); \
222 })
223
Steven Rostedt0f4fc292009-05-20 19:21:47 -0400224#undef __print_symbolic
225#define __print_symbolic(value, symbol_array...) \
226 ({ \
227 static const struct trace_print_flags symbols[] = \
228 { symbol_array, { -1, NULL }}; \
229 ftrace_print_symbols_seq(p, value, symbols); \
230 })
231
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400232#undef TRACE_EVENT
233#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
234enum print_line_t \
235ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
236{ \
237 struct trace_seq *s = &iter->seq; \
238 struct ftrace_raw_##call *field; \
239 struct trace_entry *entry; \
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200240 struct trace_seq *p; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400241 int ret; \
242 \
243 entry = iter->ent; \
244 \
245 if (entry->type != event_##call.id) { \
246 WARN_ON_ONCE(1); \
247 return TRACE_TYPE_UNHANDLED; \
248 } \
249 \
250 field = (typeof(field))entry; \
251 \
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200252 p = &get_cpu_var(ftrace_event_seq); \
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100253 trace_seq_init(p); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400254 ret = trace_seq_printf(s, #call ": " print); \
Steven Rostedtbe74b73a2009-05-26 20:25:22 +0200255 put_cpu(); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400256 if (!ret) \
257 return TRACE_TYPE_PARTIAL_LINE; \
258 \
259 return TRACE_TYPE_HANDLED; \
260}
261
262#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
263
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400264#undef __field
265#define __field(type, item) \
266 ret = trace_define_field(event_call, #type, #item, \
267 offsetof(typeof(field), item), \
Tom Zanussia118e4d2009-04-28 03:04:53 -0500268 sizeof(field.item), is_signed_type(type)); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400269 if (ret) \
270 return ret;
271
272#undef __array
273#define __array(type, item, len) \
274 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
275 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
276 offsetof(typeof(field), item), \
Tom Zanussia118e4d2009-04-28 03:04:53 -0500277 sizeof(field.item), 0); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400278 if (ret) \
279 return ret;
280
Li Zefan7fcb7c42009-06-01 15:35:46 +0800281#undef __dynamic_array
282#define __dynamic_array(type, item, len) \
Lai Jiangshan68fd60a2009-07-16 10:53:34 +0800283 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800284 offsetof(typeof(field), __data_loc_##item), \
285 sizeof(field.__data_loc_##item), 0);
286
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200287#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800288#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200289
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400290#undef TRACE_EVENT
291#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
292int \
293ftrace_define_fields_##call(void) \
294{ \
295 struct ftrace_raw_##call field; \
296 struct ftrace_event_call *event_call = &event_##call; \
297 int ret; \
298 \
Tom Zanussia118e4d2009-04-28 03:04:53 -0500299 __common_field(int, type, 1); \
300 __common_field(unsigned char, flags, 0); \
301 __common_field(unsigned char, preempt_count, 0); \
302 __common_field(int, pid, 1); \
303 __common_field(int, tgid, 1); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400304 \
305 tstruct; \
306 \
307 return ret; \
308}
309
310#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
311
312/*
Li Zefan7fcb7c42009-06-01 15:35:46 +0800313 * remember the offset of each array from the beginning of the event.
314 */
315
316#undef __entry
317#define __entry entry
318
319#undef __field
320#define __field(type, item)
321
322#undef __array
323#define __array(type, item, len)
324
325#undef __dynamic_array
326#define __dynamic_array(type, item, len) \
327 __data_offsets->item = __data_size + \
328 offsetof(typeof(*entry), __data); \
Li Zefan7d536cb2009-07-16 10:54:02 +0800329 __data_offsets->item |= (len * sizeof(type)) << 16; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800330 __data_size += (len) * sizeof(type);
331
332#undef __string
333#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) \
334
335#undef TRACE_EVENT
336#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
337static inline int ftrace_get_offsets_##call( \
338 struct ftrace_data_offsets_##call *__data_offsets, proto) \
339{ \
340 int __data_size = 0; \
341 struct ftrace_raw_##call __maybe_unused *entry; \
342 \
343 tstruct; \
344 \
345 return __data_size; \
346}
347
348#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
349
350/*
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200351 * Stage 4 of the trace events.
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400352 *
353 * Override the macros in <trace/trace_events.h> to include the following:
354 *
355 * static void ftrace_event_<call>(proto)
356 * {
357 * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
358 * }
359 *
360 * static int ftrace_reg_event_<call>(void)
361 * {
362 * int ret;
363 *
364 * ret = register_trace_<call>(ftrace_event_<call>);
365 * if (!ret)
366 * pr_info("event trace: Could not activate trace point "
367 * "probe to <call>");
368 * return ret;
369 * }
370 *
371 * static void ftrace_unreg_event_<call>(void)
372 * {
373 * unregister_trace_<call>(ftrace_event_<call>);
374 * }
375 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400376 *
377 * For those macros defined with TRACE_EVENT:
378 *
379 * static struct ftrace_event_call event_<call>;
380 *
381 * static void ftrace_raw_event_<call>(proto)
382 * {
383 * struct ring_buffer_event *event;
384 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
385 * unsigned long irq_flags;
386 * int pc;
387 *
388 * local_save_flags(irq_flags);
389 * pc = preempt_count();
390 *
391 * event = trace_current_buffer_lock_reserve(event_<call>.id,
392 * sizeof(struct ftrace_raw_<call>),
393 * irq_flags, pc);
394 * if (!event)
395 * return;
396 * entry = ring_buffer_event_data(event);
397 *
398 * <assign>; <-- Here we assign the entries by the __field and
399 * __array macros.
400 *
401 * trace_current_buffer_unlock_commit(event, irq_flags, pc);
402 * }
403 *
404 * static int ftrace_raw_reg_event_<call>(void)
405 * {
406 * int ret;
407 *
408 * ret = register_trace_<call>(ftrace_raw_event_<call>);
409 * if (!ret)
410 * pr_info("event trace: Could not activate trace point "
411 * "probe to <call>");
412 * return ret;
413 * }
414 *
415 * static void ftrace_unreg_event_<call>(void)
416 * {
417 * unregister_trace_<call>(ftrace_raw_event_<call>);
418 * }
419 *
420 * static struct trace_event ftrace_event_type_<call> = {
421 * .trace = ftrace_raw_output_<call>, <-- stage 2
422 * };
423 *
424 * static int ftrace_raw_init_event_<call>(void)
425 * {
426 * int id;
427 *
428 * id = register_ftrace_event(&ftrace_event_type_<call>);
429 * if (!id)
430 * return -ENODEV;
431 * event_<call>.id = id;
432 * return 0;
433 * }
434 *
435 * static struct ftrace_event_call __used
436 * __attribute__((__aligned__(4)))
437 * __attribute__((section("_ftrace_events"))) event_<call> = {
438 * .name = "<call>",
439 * .system = "<system>",
440 * .raw_init = ftrace_raw_init_event_<call>,
441 * .regfunc = ftrace_reg_event_<call>,
442 * .unregfunc = ftrace_unreg_event_<call>,
443 * .show_format = ftrace_format_<call>,
444 * }
445 *
446 */
447
448#undef TP_FMT
449#define TP_FMT(fmt, args...) fmt "\n", ##args
450
451#ifdef CONFIG_EVENT_PROFILE
452#define _TRACE_PROFILE(call, proto, args) \
453static void ftrace_profile_##call(proto) \
454{ \
455 extern void perf_tpcounter_event(int); \
456 perf_tpcounter_event(event_##call.id); \
457} \
458 \
Zhaoleif2aebae2009-05-27 21:36:02 +0800459static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400460{ \
461 int ret = 0; \
462 \
Zhaoleif2aebae2009-05-27 21:36:02 +0800463 if (!atomic_inc_return(&event_call->profile_count)) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400464 ret = register_trace_##call(ftrace_profile_##call); \
465 \
466 return ret; \
467} \
468 \
Zhaoleif2aebae2009-05-27 21:36:02 +0800469static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400470{ \
Zhaoleif2aebae2009-05-27 21:36:02 +0800471 if (atomic_add_negative(-1, &event_call->profile_count)) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400472 unregister_trace_##call(ftrace_profile_##call); \
473}
474
475#define _TRACE_PROFILE_INIT(call) \
476 .profile_count = ATOMIC_INIT(-1), \
477 .profile_enable = ftrace_profile_enable_##call, \
478 .profile_disable = ftrace_profile_disable_##call,
479
480#else
481#define _TRACE_PROFILE(call, proto, args)
482#define _TRACE_PROFILE_INIT(call)
483#endif
484
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400485#undef __entry
486#define __entry entry
487
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200488#undef __field
489#define __field(type, item)
490
491#undef __array
492#define __array(type, item, len)
493
Li Zefan7fcb7c42009-06-01 15:35:46 +0800494#undef __dynamic_array
495#define __dynamic_array(type, item, len) \
496 __entry->__data_loc_##item = __data_offsets.item;
497
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200498#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800499#define __string(item, src) __dynamic_array(char, item, -1) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200500
501#undef __assign_str
502#define __assign_str(dst, src) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200503 strcpy(__get_str(dst), src);
504
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400505#undef TRACE_EVENT
506#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
507_TRACE_PROFILE(call, PARAMS(proto), PARAMS(args)) \
508 \
509static struct ftrace_event_call event_##call; \
510 \
511static void ftrace_raw_event_##call(proto) \
512{ \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800513 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
Zhaoleif2aebae2009-05-27 21:36:02 +0800514 struct ftrace_event_call *event_call = &event_##call; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400515 struct ring_buffer_event *event; \
516 struct ftrace_raw_##call *entry; \
517 unsigned long irq_flags; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800518 int __data_size; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400519 int pc; \
520 \
521 local_save_flags(irq_flags); \
522 pc = preempt_count(); \
523 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800524 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200525 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400526 event = trace_current_buffer_lock_reserve(event_##call.id, \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800527 sizeof(*entry) + __data_size, \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200528 irq_flags, pc); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400529 if (!event) \
530 return; \
531 entry = ring_buffer_event_data(event); \
532 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800533 \
534 tstruct \
535 \
Li Zefana9c1c3a2009-06-01 15:35:13 +0800536 { assign; } \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400537 \
Zhaoleif2aebae2009-05-27 21:36:02 +0800538 if (!filter_current_check_discard(event_call, entry, event)) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400539 trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
540} \
541 \
542static int ftrace_raw_reg_event_##call(void) \
543{ \
544 int ret; \
545 \
546 ret = register_trace_##call(ftrace_raw_event_##call); \
547 if (ret) \
548 pr_info("event trace: Could not activate trace point " \
549 "probe to " #call "\n"); \
550 return ret; \
551} \
552 \
553static void ftrace_raw_unreg_event_##call(void) \
554{ \
555 unregister_trace_##call(ftrace_raw_event_##call); \
556} \
557 \
558static struct trace_event ftrace_event_type_##call = { \
559 .trace = ftrace_raw_output_##call, \
560}; \
561 \
562static int ftrace_raw_init_event_##call(void) \
563{ \
564 int id; \
565 \
566 id = register_ftrace_event(&ftrace_event_type_##call); \
567 if (!id) \
568 return -ENODEV; \
569 event_##call.id = id; \
570 INIT_LIST_HEAD(&event_##call.fields); \
571 init_preds(&event_##call); \
572 return 0; \
573} \
574 \
575static struct ftrace_event_call __used \
576__attribute__((__aligned__(4))) \
577__attribute__((section("_ftrace_events"))) event_##call = { \
578 .name = #call, \
579 .system = __stringify(TRACE_SYSTEM), \
Steven Rostedt6d723732009-04-10 14:53:50 -0400580 .event = &ftrace_event_type_##call, \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400581 .raw_init = ftrace_raw_init_event_##call, \
582 .regfunc = ftrace_raw_reg_event_##call, \
583 .unregfunc = ftrace_raw_unreg_event_##call, \
584 .show_format = ftrace_format_##call, \
585 .define_fields = ftrace_define_fields_##call, \
586 _TRACE_PROFILE_INIT(call) \
587}
588
589#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
590
591#undef _TRACE_PROFILE
592#undef _TRACE_PROFILE_INIT
593