blob: a9377c0083ad3ed612547f783647132a8268ef09 [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 Rostedtff038f52009-11-18 20:27:27 -050021/*
Ingo Molnar091ad362009-11-26 09:04:55 +010022 * DECLARE_EVENT_CLASS can be used to add a generic function
Steven Rostedtff038f52009-11-18 20:27:27 -050023 * handlers for events. That is, if all events have the same
24 * parameters and just have distinct trace points.
25 * Each tracepoint can be defined with DEFINE_EVENT and that
Ingo Molnar091ad362009-11-26 09:04:55 +010026 * will map the DECLARE_EVENT_CLASS to the tracepoint.
Steven Rostedtff038f52009-11-18 20:27:27 -050027 *
28 * TRACE_EVENT is a one to one mapping between tracepoint and template.
29 */
30#undef TRACE_EVENT
31#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
Ingo Molnar091ad362009-11-26 09:04:55 +010032 DECLARE_EVENT_CLASS(name, \
Steven Rostedtff038f52009-11-18 20:27:27 -050033 PARAMS(proto), \
34 PARAMS(args), \
35 PARAMS(tstruct), \
36 PARAMS(assign), \
37 PARAMS(print)); \
38 DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
39
40
Steven Rostedtf42c85e2009-04-13 12:25:37 -040041#undef __field
42#define __field(type, item) type item;
43
Li Zefan43b51ea2009-08-07 10:33:22 +080044#undef __field_ext
45#define __field_ext(type, item, filter_type) type item;
46
Li Zefan7fcb7c42009-06-01 15:35:46 +080047#undef __array
48#define __array(type, item, len) type item[len];
49
50#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +080051#define __dynamic_array(type, item, len) u32 __data_loc_##item;
Li Zefan7fcb7c42009-06-01 15:35:46 +080052
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020053#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +080054#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020055
Steven Rostedtf42c85e2009-04-13 12:25:37 -040056#undef TP_STRUCT__entry
57#define TP_STRUCT__entry(args...) args
58
Ingo Molnar091ad362009-11-26 09:04:55 +010059#undef DECLARE_EVENT_CLASS
60#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print) \
Steven Rostedtff038f52009-11-18 20:27:27 -050061 struct ftrace_raw_##name { \
62 struct trace_entry ent; \
63 tstruct \
64 char __data[0]; \
Steven Rostedt8f082012010-04-20 10:47:33 -040065 }; \
66 \
67 static struct ftrace_event_class event_class_##name;
68
Steven Rostedtff038f52009-11-18 20:27:27 -050069#undef DEFINE_EVENT
70#define DEFINE_EVENT(template, name, proto, args) \
Steven Rostedt49c17742010-05-25 06:19:35 -070071 static struct ftrace_event_call __used \
Jeff Mahoney86c38a32010-02-24 13:59:23 -050072 __attribute__((__aligned__(4))) event_##name
Steven Rostedtf42c85e2009-04-13 12:25:37 -040073
Steven Rostedte5bc9722009-11-18 20:36:26 -050074#undef DEFINE_EVENT_PRINT
75#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
76 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
77
Josh Stone97419872009-08-24 14:43:13 -070078/* Callbacks are meaningless to ftrace. */
79#undef TRACE_EVENT_FN
Frederic Weisbecker0dd7b742009-08-28 00:50:06 +020080#define TRACE_EVENT_FN(name, proto, args, tstruct, \
81 assign, print, reg, unreg) \
Frederic Weisbecker819ce452010-07-20 18:41:24 +020082 TRACE_EVENT(name, PARAMS(proto), PARAMS(args), \
83 PARAMS(tstruct), PARAMS(assign), PARAMS(print)) \
Josh Stone97419872009-08-24 14:43:13 -070084
Steven Rostedtf42c85e2009-04-13 12:25:37 -040085#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
86
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020087
Steven Rostedtf42c85e2009-04-13 12:25:37 -040088/*
89 * Stage 2 of the trace events.
90 *
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020091 * Include the following:
92 *
Li Zefan7fcb7c42009-06-01 15:35:46 +080093 * struct ftrace_data_offsets_<call> {
Li Zefan7d536cb2009-07-16 10:54:02 +080094 * u32 <item1>;
95 * u32 <item2>;
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +020096 * [...]
97 * };
98 *
Li Zefan7d536cb2009-07-16 10:54:02 +080099 * The __dynamic_array() macro will create each u32 <item>, this is
Li Zefan7fcb7c42009-06-01 15:35:46 +0800100 * to keep the offset of each array from the beginning of the event.
Li Zefan7d536cb2009-07-16 10:54:02 +0800101 * The size of an array is also encoded, in the higher 16 bits of <item>.
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200102 */
103
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200104#undef __field
Li Zefan43b51ea2009-08-07 10:33:22 +0800105#define __field(type, item)
106
107#undef __field_ext
108#define __field_ext(type, item, filter_type)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200109
Li Zefan7fcb7c42009-06-01 15:35:46 +0800110#undef __array
111#define __array(type, item, len)
112
113#undef __dynamic_array
Li Zefan7d536cb2009-07-16 10:54:02 +0800114#define __dynamic_array(type, item, len) u32 item;
Li Zefan7fcb7c42009-06-01 15:35:46 +0800115
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200116#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800117#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200118
Ingo Molnar091ad362009-11-26 09:04:55 +0100119#undef DECLARE_EVENT_CLASS
120#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800121 struct ftrace_data_offsets_##call { \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200122 tstruct; \
123 };
124
Steven Rostedtff038f52009-11-18 20:27:27 -0500125#undef DEFINE_EVENT
126#define DEFINE_EVENT(template, name, proto, args)
127
Steven Rostedte5bc9722009-11-18 20:36:26 -0500128#undef DEFINE_EVENT_PRINT
129#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
130 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
131
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200132#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
133
134/*
135 * Stage 3 of the trace events.
136 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400137 * Override the macros in <trace/trace_events.h> to include the following:
138 *
139 * enum print_line_t
140 * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
141 * {
142 * struct trace_seq *s = &iter->seq;
143 * struct ftrace_raw_<call> *field; <-- defined in stage 1
144 * struct trace_entry *entry;
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800145 * struct trace_seq *p = &iter->tmp_seq;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400146 * int ret;
147 *
148 * entry = iter->ent;
149 *
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400150 * if (entry->type != event_<call>->event.type) {
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400151 * WARN_ON_ONCE(1);
152 * return TRACE_TYPE_UNHANDLED;
153 * }
154 *
155 * field = (typeof(field))entry;
156 *
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100157 * trace_seq_init(p);
Li Zefan50354a82010-03-24 10:58:24 +0800158 * ret = trace_seq_printf(s, "%s: ", <call>);
159 * if (ret)
160 * ret = trace_seq_printf(s, <TP_printk> "\n");
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400161 * if (!ret)
162 * return TRACE_TYPE_PARTIAL_LINE;
163 *
164 * return TRACE_TYPE_HANDLED;
165 * }
166 *
167 * This is the method used to print the raw event to the trace
168 * output format. Note, this is not needed if the data is read
169 * in binary.
170 */
171
172#undef __entry
173#define __entry field
174
175#undef TP_printk
176#define TP_printk(fmt, args...) fmt "\n", args
177
Li Zefan7fcb7c42009-06-01 15:35:46 +0800178#undef __get_dynamic_array
179#define __get_dynamic_array(field) \
Li Zefan7d536cb2009-07-16 10:54:02 +0800180 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
Li Zefan7fcb7c42009-06-01 15:35:46 +0800181
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200182#undef __get_str
Li Zefan7fcb7c42009-06-01 15:35:46 +0800183#define __get_str(field) (char *)__get_dynamic_array(field)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200184
Steven Rostedtbe74b732009-05-26 20:25:22 +0200185#undef __print_flags
186#define __print_flags(flag, delim, flag_array...) \
187 ({ \
Steven Rostedta48f4942009-09-14 11:18:02 -0400188 static const struct trace_print_flags __flags[] = \
Steven Rostedtbe74b732009-05-26 20:25:22 +0200189 { flag_array, { -1, NULL }}; \
Steven Rostedta48f4942009-09-14 11:18:02 -0400190 ftrace_print_flags_seq(p, delim, flag, __flags); \
Steven Rostedtbe74b732009-05-26 20:25:22 +0200191 })
192
Steven Rostedt0f4fc292009-05-20 19:21:47 -0400193#undef __print_symbolic
194#define __print_symbolic(value, symbol_array...) \
195 ({ \
196 static const struct trace_print_flags symbols[] = \
197 { symbol_array, { -1, NULL }}; \
198 ftrace_print_symbols_seq(p, value, symbols); \
199 })
200
Kei Tokunaga5a2e3992010-04-01 20:40:58 +0900201#undef __print_hex
202#define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len)
203
Ingo Molnar091ad362009-11-26 09:04:55 +0100204#undef DECLARE_EVENT_CLASS
205#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500206static notrace enum print_line_t \
Steven Rostedt80decc72010-04-23 10:00:22 -0400207ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
208 struct trace_event *trace_event) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400209{ \
Steven Rostedt80decc72010-04-23 10:00:22 -0400210 struct ftrace_event_call *event; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400211 struct trace_seq *s = &iter->seq; \
212 struct ftrace_raw_##call *field; \
213 struct trace_entry *entry; \
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800214 struct trace_seq *p = &iter->tmp_seq; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400215 int ret; \
216 \
Steven Rostedt80decc72010-04-23 10:00:22 -0400217 event = container_of(trace_event, struct ftrace_event_call, \
218 event); \
219 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400220 entry = iter->ent; \
221 \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400222 if (entry->type != event->event.type) { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400223 WARN_ON_ONCE(1); \
224 return TRACE_TYPE_UNHANDLED; \
225 } \
226 \
227 field = (typeof(field))entry; \
228 \
Steven Whitehouse56d8bd32009-06-03 14:52:03 +0100229 trace_seq_init(p); \
Steven Rostedt80decc72010-04-23 10:00:22 -0400230 ret = trace_seq_printf(s, "%s: ", event->name); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500231 if (ret) \
232 ret = trace_seq_printf(s, print); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400233 if (!ret) \
234 return TRACE_TYPE_PARTIAL_LINE; \
235 \
236 return TRACE_TYPE_HANDLED; \
Steven Rostedt80decc72010-04-23 10:00:22 -0400237} \
238static struct trace_event_functions ftrace_event_type_funcs_##call = { \
239 .trace = ftrace_raw_output_##call, \
240};
Steven Rostedtff038f52009-11-18 20:27:27 -0500241
Steven Rostedte5bc9722009-11-18 20:36:26 -0500242#undef DEFINE_EVENT_PRINT
243#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500244static notrace enum print_line_t \
Steven Rostedta9a57762010-04-22 18:46:14 -0400245ftrace_raw_output_##call(struct trace_iterator *iter, int flags, \
246 struct trace_event *event) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400247{ \
248 struct trace_seq *s = &iter->seq; \
Steven Rostedte5bc9722009-11-18 20:36:26 -0500249 struct ftrace_raw_##template *field; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400250 struct trace_entry *entry; \
Lai Jiangshanbc289ae2010-06-03 18:26:24 +0800251 struct trace_seq *p = &iter->tmp_seq; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400252 int ret; \
253 \
254 entry = iter->ent; \
255 \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400256 if (entry->type != event_##call.event.type) { \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400257 WARN_ON_ONCE(1); \
258 return TRACE_TYPE_UNHANDLED; \
259 } \
260 \
261 field = (typeof(field))entry; \
262 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400263 trace_seq_init(p); \
Steven Rostedte5bc9722009-11-18 20:36:26 -0500264 ret = trace_seq_printf(s, "%s: ", #call); \
265 if (ret) \
266 ret = trace_seq_printf(s, print); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400267 if (!ret) \
268 return TRACE_TYPE_PARTIAL_LINE; \
269 \
270 return TRACE_TYPE_HANDLED; \
Steven Rostedt80decc72010-04-23 10:00:22 -0400271} \
272static struct trace_event_functions ftrace_event_type_funcs_##call = { \
273 .trace = ftrace_raw_output_##call, \
274};
Steven Rostedte5bc9722009-11-18 20:36:26 -0500275
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400276#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
277
Li Zefan43b51ea2009-08-07 10:33:22 +0800278#undef __field_ext
279#define __field_ext(type, item, filter_type) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400280 ret = trace_define_field(event_call, #type, #item, \
281 offsetof(typeof(field), item), \
Li Zefan43b51ea2009-08-07 10:33:22 +0800282 sizeof(field.item), \
283 is_signed_type(type), filter_type); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400284 if (ret) \
285 return ret;
286
Li Zefan43b51ea2009-08-07 10:33:22 +0800287#undef __field
288#define __field(type, item) __field_ext(type, item, FILTER_OTHER)
289
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400290#undef __array
291#define __array(type, item, len) \
292 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
293 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
294 offsetof(typeof(field), item), \
Lai Jiangshanfb7ae982009-12-15 15:39:38 +0800295 sizeof(field.item), \
296 is_signed_type(type), FILTER_OTHER); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400297 if (ret) \
298 return ret;
299
Li Zefan7fcb7c42009-06-01 15:35:46 +0800300#undef __dynamic_array
301#define __dynamic_array(type, item, len) \
Lai Jiangshan68fd60a2009-07-16 10:53:34 +0800302 ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \
Li Zefan43b51ea2009-08-07 10:33:22 +0800303 offsetof(typeof(field), __data_loc_##item), \
Lai Jiangshanfb7ae982009-12-15 15:39:38 +0800304 sizeof(field.__data_loc_##item), \
305 is_signed_type(type), FILTER_OTHER);
Li Zefan7fcb7c42009-06-01 15:35:46 +0800306
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200307#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800308#define __string(item, src) __dynamic_array(char, item, -1)
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200309
Ingo Molnar091ad362009-11-26 09:04:55 +0100310#undef DECLARE_EVENT_CLASS
311#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500312static int notrace \
Li Zefan14be96c2009-08-19 15:53:52 +0800313ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400314{ \
315 struct ftrace_raw_##call field; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400316 int ret; \
317 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400318 tstruct; \
319 \
320 return ret; \
321}
322
Steven Rostedtff038f52009-11-18 20:27:27 -0500323#undef DEFINE_EVENT
324#define DEFINE_EVENT(template, name, proto, args)
325
Steven Rostedte5bc9722009-11-18 20:36:26 -0500326#undef DEFINE_EVENT_PRINT
327#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
328 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
329
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400330#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
331
332/*
Li Zefan7fcb7c42009-06-01 15:35:46 +0800333 * remember the offset of each array from the beginning of the event.
334 */
335
336#undef __entry
337#define __entry entry
338
339#undef __field
340#define __field(type, item)
341
Li Zefan43b51ea2009-08-07 10:33:22 +0800342#undef __field_ext
343#define __field_ext(type, item, filter_type)
344
Li Zefan7fcb7c42009-06-01 15:35:46 +0800345#undef __array
346#define __array(type, item, len)
347
348#undef __dynamic_array
349#define __dynamic_array(type, item, len) \
350 __data_offsets->item = __data_size + \
351 offsetof(typeof(*entry), __data); \
Li Zefan7d536cb2009-07-16 10:54:02 +0800352 __data_offsets->item |= (len * sizeof(type)) << 16; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800353 __data_size += (len) * sizeof(type);
354
355#undef __string
Steven Rostedtff038f52009-11-18 20:27:27 -0500356#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1)
Li Zefan7fcb7c42009-06-01 15:35:46 +0800357
Ingo Molnar091ad362009-11-26 09:04:55 +0100358#undef DECLARE_EVENT_CLASS
359#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500360static inline notrace int ftrace_get_offsets_##call( \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800361 struct ftrace_data_offsets_##call *__data_offsets, proto) \
362{ \
363 int __data_size = 0; \
364 struct ftrace_raw_##call __maybe_unused *entry; \
365 \
366 tstruct; \
367 \
368 return __data_size; \
369}
370
Steven Rostedtff038f52009-11-18 20:27:27 -0500371#undef DEFINE_EVENT
372#define DEFINE_EVENT(template, name, proto, args)
373
Steven Rostedte5bc9722009-11-18 20:36:26 -0500374#undef DEFINE_EVENT_PRINT
375#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
376 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
377
Li Zefan7fcb7c42009-06-01 15:35:46 +0800378#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
379
380/*
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200381 * Stage 4 of the trace events.
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400382 *
383 * Override the macros in <trace/trace_events.h> to include the following:
384 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400385 * For those macros defined with TRACE_EVENT:
386 *
387 * static struct ftrace_event_call event_<call>;
388 *
Steven Rostedt22392912010-04-21 12:27:06 -0400389 * static void ftrace_raw_event_<call>(void *__data, proto)
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400390 * {
Steven Rostedt22392912010-04-21 12:27:06 -0400391 * struct ftrace_event_call *event_call = __data;
Li Zefan50354a82010-03-24 10:58:24 +0800392 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400393 * struct ring_buffer_event *event;
394 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
Steven Rostedte77405a2009-09-02 14:17:06 -0400395 * struct ring_buffer *buffer;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400396 * unsigned long irq_flags;
Li Zefan50354a82010-03-24 10:58:24 +0800397 * int __data_size;
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400398 * int pc;
399 *
400 * local_save_flags(irq_flags);
401 * pc = preempt_count();
402 *
Li Zefan50354a82010-03-24 10:58:24 +0800403 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
404 *
Steven Rostedte77405a2009-09-02 14:17:06 -0400405 * event = trace_current_buffer_lock_reserve(&buffer,
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400406 * event_<call>->event.type,
Li Zefan50354a82010-03-24 10:58:24 +0800407 * sizeof(*entry) + __data_size,
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400408 * irq_flags, pc);
409 * if (!event)
410 * return;
411 * entry = ring_buffer_event_data(event);
412 *
Li Zefan50354a82010-03-24 10:58:24 +0800413 * { <assign>; } <-- Here we assign the entries by the __field and
414 * __array macros.
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400415 *
Li Zefan50354a82010-03-24 10:58:24 +0800416 * if (!filter_current_check_discard(buffer, event_call, entry, event))
417 * trace_current_buffer_unlock_commit(buffer,
418 * event, irq_flags, pc);
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400419 * }
420 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400421 * static struct trace_event ftrace_event_type_<call> = {
422 * .trace = ftrace_raw_output_<call>, <-- stage 2
423 * };
424 *
Li Zefan50354a82010-03-24 10:58:24 +0800425 * static const char print_fmt_<call>[] = <TP_printk>;
426 *
Steven Rostedt8f082012010-04-20 10:47:33 -0400427 * static struct ftrace_event_class __used event_class_<template> = {
428 * .system = "<system>",
Steven Rostedt2e33af02010-04-22 10:35:55 -0400429 * .define_fields = ftrace_define_fields_<call>,
Steven Rostedt0405ab82010-04-22 11:46:44 -0400430 * .fields = LIST_HEAD_INIT(event_class_##call.fields),
431 * .raw_init = trace_event_raw_init,
432 * .probe = ftrace_raw_event_##call,
Steven Rostedta1d0ce82010-06-08 11:22:06 -0400433 * .reg = ftrace_event_reg,
Steven Rostedt8f082012010-04-20 10:47:33 -0400434 * };
435 *
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400436 * static struct ftrace_event_call __used
437 * __attribute__((__aligned__(4)))
438 * __attribute__((section("_ftrace_events"))) event_<call> = {
439 * .name = "<call>",
Steven Rostedt8f082012010-04-20 10:47:33 -0400440 * .class = event_class_<template>,
Steven Rostedt2e33af02010-04-22 10:35:55 -0400441 * .event = &ftrace_event_type_<call>,
Li Zefan50354a82010-03-24 10:58:24 +0800442 * .print_fmt = print_fmt_<call>,
Steven Rostedt8f082012010-04-20 10:47:33 -0400443 * };
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400444 *
445 */
446
Li Zefan07b139c2009-12-21 14:27:35 +0800447#ifdef CONFIG_PERF_EVENTS
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400448
Steven Rostedt22392912010-04-21 12:27:06 -0400449#define _TRACE_PERF_PROTO(call, proto) \
450 static notrace void \
451 perf_trace_##call(void *__data, proto);
452
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100453#define _TRACE_PERF_INIT(call) \
Steven Rostedt22392912010-04-21 12:27:06 -0400454 .perf_probe = perf_trace_##call,
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400455
456#else
Steven Rostedt22392912010-04-21 12:27:06 -0400457#define _TRACE_PERF_PROTO(call, proto)
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100458#define _TRACE_PERF_INIT(call)
Li Zefan07b139c2009-12-21 14:27:35 +0800459#endif /* CONFIG_PERF_EVENTS */
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400460
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400461#undef __entry
462#define __entry entry
463
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200464#undef __field
465#define __field(type, item)
466
467#undef __array
468#define __array(type, item, len)
469
Li Zefan7fcb7c42009-06-01 15:35:46 +0800470#undef __dynamic_array
471#define __dynamic_array(type, item, len) \
472 __entry->__data_loc_##item = __data_offsets.item;
473
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200474#undef __string
Li Zefan7fcb7c42009-06-01 15:35:46 +0800475#define __string(item, src) __dynamic_array(char, item, -1) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200476
477#undef __assign_str
478#define __assign_str(dst, src) \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200479 strcpy(__get_str(dst), src);
480
Lai Jiangshan0fa0eda2009-12-15 15:39:57 +0800481#undef TP_fast_assign
482#define TP_fast_assign(args...) args
483
484#undef TP_perf_assign
485#define TP_perf_assign(args...)
486
Ingo Molnar091ad362009-11-26 09:04:55 +0100487#undef DECLARE_EVENT_CLASS
488#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400489 \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500490static notrace void \
Steven Rostedt22392912010-04-21 12:27:06 -0400491ftrace_raw_event_##call(void *__data, proto) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400492{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400493 struct ftrace_event_call *event_call = __data; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800494 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400495 struct ring_buffer_event *event; \
496 struct ftrace_raw_##call *entry; \
Steven Rostedte77405a2009-09-02 14:17:06 -0400497 struct ring_buffer *buffer; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400498 unsigned long irq_flags; \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800499 int __data_size; \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400500 int pc; \
501 \
502 local_save_flags(irq_flags); \
503 pc = preempt_count(); \
504 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800505 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200506 \
Steven Rostedte77405a2009-09-02 14:17:06 -0400507 event = trace_current_buffer_lock_reserve(&buffer, \
Steven Rostedt32c0eda2010-04-23 10:38:03 -0400508 event_call->event.type, \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800509 sizeof(*entry) + __data_size, \
Frederic Weisbecker9cbf1172009-04-19 04:51:29 +0200510 irq_flags, pc); \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400511 if (!event) \
512 return; \
513 entry = ring_buffer_event_data(event); \
514 \
Li Zefan7fcb7c42009-06-01 15:35:46 +0800515 tstruct \
516 \
Li Zefana9c1c3a2009-06-01 15:35:13 +0800517 { assign; } \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400518 \
Steven Rostedte77405a2009-09-02 14:17:06 -0400519 if (!filter_current_check_discard(buffer, event_call, entry, event)) \
520 trace_nowake_buffer_unlock_commit(buffer, \
521 event, irq_flags, pc); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500522}
Steven Rostedt22392912010-04-21 12:27:06 -0400523/*
524 * The ftrace_test_probe is compiled out, it is only here as a build time check
525 * to make sure that if the tracepoint handling changes, the ftrace probe will
526 * fail to compile unless it too is updated.
527 */
Steven Rostedtff038f52009-11-18 20:27:27 -0500528
529#undef DEFINE_EVENT
530#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedt22392912010-04-21 12:27:06 -0400531static inline void ftrace_test_probe_##call(void) \
Steven Rostedtff038f52009-11-18 20:27:27 -0500532{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400533 check_trace_callback_type_##call(ftrace_raw_event_##template); \
534}
Steven Rostedte5bc9722009-11-18 20:36:26 -0500535
536#undef DEFINE_EVENT_PRINT
Steven Rostedt80decc72010-04-23 10:00:22 -0400537#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
Steven Rostedte5bc9722009-11-18 20:36:26 -0500538
539#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
540
Lai Jiangshan509e7602009-12-15 15:39:42 +0800541#undef __entry
542#define __entry REC
543
544#undef __print_flags
545#undef __print_symbolic
546#undef __get_dynamic_array
547#undef __get_str
548
549#undef TP_printk
550#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
551
Ingo Molnar091ad362009-11-26 09:04:55 +0100552#undef DECLARE_EVENT_CLASS
Lai Jiangshan509e7602009-12-15 15:39:42 +0800553#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt22392912010-04-21 12:27:06 -0400554_TRACE_PERF_PROTO(call, PARAMS(proto)); \
Steven Rostedt8f082012010-04-20 10:47:33 -0400555static const char print_fmt_##call[] = print; \
556static struct ftrace_event_class __used event_class_##call = { \
Steven Rostedt22392912010-04-21 12:27:06 -0400557 .system = __stringify(TRACE_SYSTEM), \
Steven Rostedt2e33af02010-04-22 10:35:55 -0400558 .define_fields = ftrace_define_fields_##call, \
559 .fields = LIST_HEAD_INIT(event_class_##call.fields),\
Steven Rostedt0405ab82010-04-22 11:46:44 -0400560 .raw_init = trace_event_raw_init, \
Steven Rostedt22392912010-04-21 12:27:06 -0400561 .probe = ftrace_raw_event_##call, \
Steven Rostedta1d0ce82010-06-08 11:22:06 -0400562 .reg = ftrace_event_reg, \
Steven Rostedt22392912010-04-21 12:27:06 -0400563 _TRACE_PERF_INIT(call) \
Steven Rostedt8f082012010-04-20 10:47:33 -0400564};
Steven Rostedte5bc9722009-11-18 20:36:26 -0500565
566#undef DEFINE_EVENT
567#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400568 \
569static struct ftrace_event_call __used \
570__attribute__((__aligned__(4))) \
571__attribute__((section("_ftrace_events"))) event_##call = { \
572 .name = #call, \
Steven Rostedt8f082012010-04-20 10:47:33 -0400573 .class = &event_class_##template, \
Steven Rostedt80decc72010-04-23 10:00:22 -0400574 .event.funcs = &ftrace_event_type_funcs_##template, \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800575 .print_fmt = print_fmt_##template, \
Steven Rostedt8f082012010-04-20 10:47:33 -0400576};
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400577
Steven Rostedte5bc9722009-11-18 20:36:26 -0500578#undef DEFINE_EVENT_PRINT
579#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400580 \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800581static const char print_fmt_##call[] = print; \
582 \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400583static struct ftrace_event_call __used \
584__attribute__((__aligned__(4))) \
585__attribute__((section("_ftrace_events"))) event_##call = { \
586 .name = #call, \
Steven Rostedt8f082012010-04-20 10:47:33 -0400587 .class = &event_class_##template, \
Steven Rostedt80decc72010-04-23 10:00:22 -0400588 .event.funcs = &ftrace_event_type_funcs_##call, \
Lai Jiangshan509e7602009-12-15 15:39:42 +0800589 .print_fmt = print_fmt_##call, \
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400590}
591
592#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
593
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200594/*
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100595 * Define the insertion callback to perf events
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200596 *
597 * The job is very similar to ftrace_raw_event_<call> except that we don't
598 * insert in the ring buffer but in a perf counter.
599 *
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100600 * static void ftrace_perf_<call>(proto)
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200601 * {
602 * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
603 * struct ftrace_event_call *event_call = &event_<call>;
Ingo Molnarcdd6c482009-09-21 12:02:48 +0200604 * extern void perf_tp_event(int, u64, u64, void *, int);
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200605 * struct ftrace_raw_##call *entry;
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100606 * struct perf_trace_buf *trace_buf;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200607 * u64 __addr = 0, __count = 1;
608 * unsigned long irq_flags;
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200609 * struct trace_entry *ent;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200610 * int __entry_size;
611 * int __data_size;
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200612 * int __cpu
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200613 * int pc;
614 *
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200615 * pc = preempt_count();
616 *
617 * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
Frederic Weisbecker304703a2009-08-10 16:11:32 +0200618 *
619 * // Below we want to get the aligned size by taking into account
620 * // the u32 field that will later store the buffer size
621 * __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),
622 * sizeof(u64));
623 * __entry_size -= sizeof(u32);
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200624 *
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200625 * // Protect the non nmi buffer
626 * // This also protects the rcu read side
627 * local_irq_save(irq_flags);
628 * __cpu = smp_processor_id();
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200629 *
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200630 * if (in_nmi())
Paul E. McKenney8d53dd52010-03-03 17:50:18 -0800631 * trace_buf = rcu_dereference_sched(perf_trace_buf_nmi);
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200632 * else
Paul E. McKenney8d53dd52010-03-03 17:50:18 -0800633 * trace_buf = rcu_dereference_sched(perf_trace_buf);
Frederic Weisbecker1853db02009-08-10 16:38:36 +0200634 *
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100635 * if (!trace_buf)
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200636 * goto end;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200637 *
Frederic Weisbecker444a2a32009-11-06 04:13:05 +0100638 * trace_buf = per_cpu_ptr(trace_buf, __cpu);
639 *
640 * // Avoid recursion from perf that could mess up the buffer
641 * if (trace_buf->recursion++)
642 * goto end_recursion;
643 *
644 * raw_data = trace_buf->buf;
645 *
646 * // Make recursion update visible before entering perf_tp_event
647 * // so that we protect from perf recursions.
648 *
649 * barrier();
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200650 *
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200651 * //zero dead bytes from alignment to avoid stack leak to userspace:
652 * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL;
653 * entry = (struct ftrace_raw_<call> *)raw_data;
654 * ent = &entry->ent;
655 * tracing_generic_entry_update(ent, irq_flags, pc);
656 * ent->type = event_call->id;
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200657 *
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200658 * <tstruct> <- do some jobs with dynamic arrays
659 *
660 * <assign> <- affect our values
661 *
Linus Torvalds43c12662009-09-21 09:15:07 -0700662 * perf_tp_event(event_call->id, __addr, __count, entry,
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200663 * __entry_size); <- submit them to perf counter
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200664 *
665 * }
666 */
667
Li Zefan07b139c2009-12-21 14:27:35 +0800668#ifdef CONFIG_PERF_EVENTS
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200669
Lai Jiangshan509e7602009-12-15 15:39:42 +0800670#undef __entry
671#define __entry entry
672
673#undef __get_dynamic_array
674#define __get_dynamic_array(field) \
675 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
676
677#undef __get_str
678#define __get_str(field) (char *)__get_dynamic_array(field)
679
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200680#undef __perf_addr
681#define __perf_addr(a) __addr = (a)
682
683#undef __perf_count
684#define __perf_count(c) __count = (c)
685
Ingo Molnar091ad362009-11-26 09:04:55 +0100686#undef DECLARE_EVENT_CLASS
687#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
Steven Rostedt83f0d532010-02-16 10:38:47 -0500688static notrace void \
Steven Rostedt22392912010-04-21 12:27:06 -0400689perf_trace_##call(void *__data, proto) \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200690{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400691 struct ftrace_event_call *event_call = __data; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200692 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200693 struct ftrace_raw_##call *entry; \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400694 struct pt_regs __regs; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200695 u64 __addr = 0, __count = 1; \
Peter Zijlstra1c024eca2010-05-19 14:02:22 +0200696 struct hlist_head *head; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200697 int __entry_size; \
698 int __data_size; \
Peter Zijlstra4ed7c922009-11-23 11:37:29 +0100699 int rctx; \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200700 \
Frederic Weisbeckerb0f82b82010-05-20 07:47:21 +0200701 perf_fetch_caller_regs(&__regs); \
Steven Rostedtf0218b32010-05-17 22:26:53 -0400702 \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200703 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
Peter Zijlstraa0445602009-08-10 11:16:52 +0200704 __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\
705 sizeof(u64)); \
Frederic Weisbecker304703a2009-08-10 16:11:32 +0200706 __entry_size -= sizeof(u32); \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200707 \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100708 if (WARN_ONCE(__entry_size > PERF_MAX_TRACE_SIZE, \
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200709 "profile buffer not large enough")) \
710 return; \
Peter Zijlstrab7e2ece2010-05-19 10:52:27 +0200711 \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100712 entry = (struct ftrace_raw_##call *)perf_trace_buf_prepare( \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400713 __entry_size, event_call->event.type, &__regs, &rctx); \
Xiao Guangrong430ad5a2010-01-28 09:32:29 +0800714 if (!entry) \
715 return; \
Peter Zijlstrab7e2ece2010-05-19 10:52:27 +0200716 \
Frederic Weisbecker20ab4422009-09-18 06:10:28 +0200717 tstruct \
718 \
719 { assign; } \
720 \
Peter Zijlstra3771f072010-05-21 12:31:09 +0200721 head = this_cpu_ptr(event_call->perf_events); \
Frederic Weisbecker97d5a222010-03-05 05:35:37 +0100722 perf_trace_buf_submit(entry, __entry_size, rctx, __addr, \
Steven Rostedtff5f1492010-05-21 11:49:57 -0400723 __count, &__regs, head); \
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200724}
725
Steven Rostedt22392912010-04-21 12:27:06 -0400726/*
727 * This part is compiled out, it is only here as a build time check
728 * to make sure that if the tracepoint handling changes, the
729 * perf probe will fail to compile unless it too is updated.
730 */
Steven Rostedtff038f52009-11-18 20:27:27 -0500731#undef DEFINE_EVENT
Frederic Weisbecker6cc8a7c2010-03-19 01:23:53 +0100732#define DEFINE_EVENT(template, call, proto, args) \
Steven Rostedt22392912010-04-21 12:27:06 -0400733static inline void perf_test_probe_##call(void) \
Frederic Weisbecker6cc8a7c2010-03-19 01:23:53 +0100734{ \
Steven Rostedt22392912010-04-21 12:27:06 -0400735 check_trace_callback_type_##call(perf_trace_##template); \
Steven Rostedtff038f52009-11-18 20:27:27 -0500736}
737
Steven Rostedt22392912010-04-21 12:27:06 -0400738
Steven Rostedte5bc9722009-11-18 20:36:26 -0500739#undef DEFINE_EVENT_PRINT
740#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
741 DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
742
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200743#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
Li Zefan07b139c2009-12-21 14:27:35 +0800744#endif /* CONFIG_PERF_EVENTS */
Frederic Weisbeckerf413cdb2009-08-07 01:25:54 +0200745
Steven Rostedtf42c85e2009-04-13 12:25:37 -0400746#undef _TRACE_PROFILE_INIT
747