Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 1 | /* |
| 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 Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 21 | #undef __field |
| 22 | #define __field(type, item) type item; |
| 23 | |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 24 | #undef __field_ext |
| 25 | #define __field_ext(type, item, filter_type) type item; |
| 26 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 27 | #undef __array |
| 28 | #define __array(type, item, len) type item[len]; |
| 29 | |
| 30 | #undef __dynamic_array |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 31 | #define __dynamic_array(type, item, len) u32 __data_loc_##item; |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 32 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 33 | #undef __string |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 34 | #define __string(item, src) __dynamic_array(char, item, -1) |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 35 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 36 | #undef TP_STRUCT__entry |
| 37 | #define TP_STRUCT__entry(args...) args |
| 38 | |
| 39 | #undef TRACE_EVENT |
| 40 | #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ |
| 41 | struct ftrace_raw_##name { \ |
| 42 | struct trace_entry ent; \ |
| 43 | tstruct \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 44 | char __data[0]; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 45 | }; \ |
| 46 | static struct ftrace_event_call event_##name |
| 47 | |
Frederic Weisbecker | 0dd7b74 | 2009-08-28 00:50:06 +0200 | [diff] [blame] | 48 | #undef __cpparg |
| 49 | #define __cpparg(arg...) arg |
| 50 | |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 51 | /* Callbacks are meaningless to ftrace. */ |
| 52 | #undef TRACE_EVENT_FN |
Frederic Weisbecker | 0dd7b74 | 2009-08-28 00:50:06 +0200 | [diff] [blame] | 53 | #define TRACE_EVENT_FN(name, proto, args, tstruct, \ |
| 54 | assign, print, reg, unreg) \ |
| 55 | TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \ |
| 56 | __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \ |
Josh Stone | 9741987 | 2009-08-24 14:43:13 -0700 | [diff] [blame] | 57 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 58 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 59 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 60 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 61 | /* |
| 62 | * Stage 2 of the trace events. |
| 63 | * |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 64 | * Include the following: |
| 65 | * |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 66 | * struct ftrace_data_offsets_<call> { |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 67 | * u32 <item1>; |
| 68 | * u32 <item2>; |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 69 | * [...] |
| 70 | * }; |
| 71 | * |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 72 | * The __dynamic_array() macro will create each u32 <item>, this is |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 73 | * to keep the offset of each array from the beginning of the event. |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 74 | * The size of an array is also encoded, in the higher 16 bits of <item>. |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 75 | */ |
| 76 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 77 | #undef __field |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 78 | #define __field(type, item) |
| 79 | |
| 80 | #undef __field_ext |
| 81 | #define __field_ext(type, item, filter_type) |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 82 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 83 | #undef __array |
| 84 | #define __array(type, item, len) |
| 85 | |
| 86 | #undef __dynamic_array |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 87 | #define __dynamic_array(type, item, len) u32 item; |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 88 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 89 | #undef __string |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 90 | #define __string(item, src) __dynamic_array(char, item, -1) |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 91 | |
| 92 | #undef TRACE_EVENT |
| 93 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 94 | struct ftrace_data_offsets_##call { \ |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 95 | tstruct; \ |
| 96 | }; |
| 97 | |
| 98 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 99 | |
| 100 | /* |
Steven Rostedt | 6ff9a64 | 2009-06-10 14:28:34 -0400 | [diff] [blame] | 101 | * Setup the showing format of trace point. |
| 102 | * |
| 103 | * int |
| 104 | * ftrace_format_##call(struct trace_seq *s) |
| 105 | * { |
| 106 | * struct ftrace_raw_##call field; |
| 107 | * int ret; |
| 108 | * |
| 109 | * ret = trace_seq_printf(s, #type " " #item ";" |
| 110 | * " offset:%u; size:%u;\n", |
| 111 | * offsetof(struct ftrace_raw_##call, item), |
| 112 | * sizeof(field.type)); |
| 113 | * |
| 114 | * } |
| 115 | */ |
| 116 | |
| 117 | #undef TP_STRUCT__entry |
| 118 | #define TP_STRUCT__entry(args...) args |
| 119 | |
| 120 | #undef __field |
| 121 | #define __field(type, item) \ |
| 122 | ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \ |
| 123 | "offset:%u;\tsize:%u;\n", \ |
| 124 | (unsigned int)offsetof(typeof(field), item), \ |
| 125 | (unsigned int)sizeof(field.item)); \ |
| 126 | if (!ret) \ |
| 127 | return 0; |
| 128 | |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 129 | #undef __field_ext |
| 130 | #define __field_ext(type, item, filter_type) __field(type, item) |
| 131 | |
Steven Rostedt | 6ff9a64 | 2009-06-10 14:28:34 -0400 | [diff] [blame] | 132 | #undef __array |
| 133 | #define __array(type, item, len) \ |
| 134 | ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \ |
| 135 | "offset:%u;\tsize:%u;\n", \ |
| 136 | (unsigned int)offsetof(typeof(field), item), \ |
| 137 | (unsigned int)sizeof(field.item)); \ |
| 138 | if (!ret) \ |
| 139 | return 0; |
| 140 | |
| 141 | #undef __dynamic_array |
| 142 | #define __dynamic_array(type, item, len) \ |
Lai Jiangshan | 68fd60a | 2009-07-16 10:53:34 +0800 | [diff] [blame] | 143 | ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\ |
Steven Rostedt | 6ff9a64 | 2009-06-10 14:28:34 -0400 | [diff] [blame] | 144 | "offset:%u;\tsize:%u;\n", \ |
| 145 | (unsigned int)offsetof(typeof(field), \ |
| 146 | __data_loc_##item), \ |
| 147 | (unsigned int)sizeof(field.__data_loc_##item)); \ |
| 148 | if (!ret) \ |
| 149 | return 0; |
| 150 | |
| 151 | #undef __string |
| 152 | #define __string(item, src) __dynamic_array(char, item, -1) |
| 153 | |
| 154 | #undef __entry |
| 155 | #define __entry REC |
| 156 | |
| 157 | #undef __print_symbolic |
| 158 | #undef __get_dynamic_array |
| 159 | #undef __get_str |
| 160 | |
| 161 | #undef TP_printk |
| 162 | #define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args) |
| 163 | |
| 164 | #undef TP_fast_assign |
| 165 | #define TP_fast_assign(args...) args |
| 166 | |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 167 | #undef TP_perf_assign |
| 168 | #define TP_perf_assign(args...) |
| 169 | |
Steven Rostedt | 6ff9a64 | 2009-06-10 14:28:34 -0400 | [diff] [blame] | 170 | #undef TRACE_EVENT |
| 171 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ |
| 172 | static int \ |
Frederic Weisbecker | e8f9f4d | 2009-08-11 17:42:52 +0200 | [diff] [blame] | 173 | ftrace_format_##call(struct ftrace_event_call *unused, \ |
| 174 | struct trace_seq *s) \ |
Steven Rostedt | 6ff9a64 | 2009-06-10 14:28:34 -0400 | [diff] [blame] | 175 | { \ |
| 176 | struct ftrace_raw_##call field __attribute__((unused)); \ |
| 177 | int ret = 0; \ |
| 178 | \ |
| 179 | tstruct; \ |
| 180 | \ |
| 181 | trace_seq_printf(s, "\nprint fmt: " print); \ |
| 182 | \ |
| 183 | return ret; \ |
| 184 | } |
| 185 | |
| 186 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 187 | |
| 188 | /* |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 189 | * Stage 3 of the trace events. |
| 190 | * |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 191 | * Override the macros in <trace/trace_events.h> to include the following: |
| 192 | * |
| 193 | * enum print_line_t |
| 194 | * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags) |
| 195 | * { |
| 196 | * struct trace_seq *s = &iter->seq; |
| 197 | * struct ftrace_raw_<call> *field; <-- defined in stage 1 |
| 198 | * struct trace_entry *entry; |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 199 | * struct trace_seq *p; |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 200 | * int ret; |
| 201 | * |
| 202 | * entry = iter->ent; |
| 203 | * |
| 204 | * if (entry->type != event_<call>.id) { |
| 205 | * WARN_ON_ONCE(1); |
| 206 | * return TRACE_TYPE_UNHANDLED; |
| 207 | * } |
| 208 | * |
| 209 | * field = (typeof(field))entry; |
| 210 | * |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 211 | * p = get_cpu_var(ftrace_event_seq); |
Steven Whitehouse | 56d8bd3 | 2009-06-03 14:52:03 +0100 | [diff] [blame] | 212 | * trace_seq_init(p); |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 213 | * ret = trace_seq_printf(s, <TP_printk> "\n"); |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 214 | * put_cpu(); |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 215 | * if (!ret) |
| 216 | * return TRACE_TYPE_PARTIAL_LINE; |
| 217 | * |
| 218 | * return TRACE_TYPE_HANDLED; |
| 219 | * } |
| 220 | * |
| 221 | * This is the method used to print the raw event to the trace |
| 222 | * output format. Note, this is not needed if the data is read |
| 223 | * in binary. |
| 224 | */ |
| 225 | |
| 226 | #undef __entry |
| 227 | #define __entry field |
| 228 | |
| 229 | #undef TP_printk |
| 230 | #define TP_printk(fmt, args...) fmt "\n", args |
| 231 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 232 | #undef __get_dynamic_array |
| 233 | #define __get_dynamic_array(field) \ |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 234 | ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 235 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 236 | #undef __get_str |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 237 | #define __get_str(field) (char *)__get_dynamic_array(field) |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 238 | |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 239 | #undef __print_flags |
| 240 | #define __print_flags(flag, delim, flag_array...) \ |
| 241 | ({ \ |
Steven Rostedt | a48f494 | 2009-09-14 11:18:02 -0400 | [diff] [blame] | 242 | static const struct trace_print_flags __flags[] = \ |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 243 | { flag_array, { -1, NULL }}; \ |
Steven Rostedt | a48f494 | 2009-09-14 11:18:02 -0400 | [diff] [blame] | 244 | ftrace_print_flags_seq(p, delim, flag, __flags); \ |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 245 | }) |
| 246 | |
Steven Rostedt | 0f4fc29 | 2009-05-20 19:21:47 -0400 | [diff] [blame] | 247 | #undef __print_symbolic |
| 248 | #define __print_symbolic(value, symbol_array...) \ |
| 249 | ({ \ |
| 250 | static const struct trace_print_flags symbols[] = \ |
| 251 | { symbol_array, { -1, NULL }}; \ |
| 252 | ftrace_print_symbols_seq(p, value, symbols); \ |
| 253 | }) |
| 254 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 255 | #undef TRACE_EVENT |
| 256 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
Steven Rostedt | ec827c7 | 2009-09-14 10:50:23 -0400 | [diff] [blame] | 257 | static enum print_line_t \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 258 | ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ |
| 259 | { \ |
| 260 | struct trace_seq *s = &iter->seq; \ |
| 261 | struct ftrace_raw_##call *field; \ |
| 262 | struct trace_entry *entry; \ |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 263 | struct trace_seq *p; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 264 | int ret; \ |
| 265 | \ |
| 266 | entry = iter->ent; \ |
| 267 | \ |
| 268 | if (entry->type != event_##call.id) { \ |
| 269 | WARN_ON_ONCE(1); \ |
| 270 | return TRACE_TYPE_UNHANDLED; \ |
| 271 | } \ |
| 272 | \ |
| 273 | field = (typeof(field))entry; \ |
| 274 | \ |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 275 | p = &get_cpu_var(ftrace_event_seq); \ |
Steven Whitehouse | 56d8bd3 | 2009-06-03 14:52:03 +0100 | [diff] [blame] | 276 | trace_seq_init(p); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 277 | ret = trace_seq_printf(s, #call ": " print); \ |
Steven Rostedt | be74b73 | 2009-05-26 20:25:22 +0200 | [diff] [blame] | 278 | put_cpu(); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 279 | if (!ret) \ |
| 280 | return TRACE_TYPE_PARTIAL_LINE; \ |
| 281 | \ |
| 282 | return TRACE_TYPE_HANDLED; \ |
| 283 | } |
| 284 | |
| 285 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 286 | |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 287 | #undef __field_ext |
| 288 | #define __field_ext(type, item, filter_type) \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 289 | ret = trace_define_field(event_call, #type, #item, \ |
| 290 | offsetof(typeof(field), item), \ |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 291 | sizeof(field.item), \ |
| 292 | is_signed_type(type), filter_type); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 293 | if (ret) \ |
| 294 | return ret; |
| 295 | |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 296 | #undef __field |
| 297 | #define __field(type, item) __field_ext(type, item, FILTER_OTHER) |
| 298 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 299 | #undef __array |
| 300 | #define __array(type, item, len) \ |
| 301 | BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ |
| 302 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
| 303 | offsetof(typeof(field), item), \ |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 304 | sizeof(field.item), 0, FILTER_OTHER); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 305 | if (ret) \ |
| 306 | return ret; |
| 307 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 308 | #undef __dynamic_array |
| 309 | #define __dynamic_array(type, item, len) \ |
Lai Jiangshan | 68fd60a | 2009-07-16 10:53:34 +0800 | [diff] [blame] | 310 | ret = trace_define_field(event_call, "__data_loc " #type "[]", #item, \ |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 311 | offsetof(typeof(field), __data_loc_##item), \ |
| 312 | sizeof(field.__data_loc_##item), 0, \ |
| 313 | FILTER_OTHER); |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 314 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 315 | #undef __string |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 316 | #define __string(item, src) __dynamic_array(char, item, -1) |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 317 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 318 | #undef TRACE_EVENT |
| 319 | #define TRACE_EVENT(call, proto, args, tstruct, func, print) \ |
Steven Rostedt | ec827c7 | 2009-09-14 10:50:23 -0400 | [diff] [blame] | 320 | static int \ |
Li Zefan | 14be96c | 2009-08-19 15:53:52 +0800 | [diff] [blame] | 321 | ftrace_define_fields_##call(struct ftrace_event_call *event_call) \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 322 | { \ |
| 323 | struct ftrace_raw_##call field; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 324 | int ret; \ |
| 325 | \ |
Li Zefan | e647d6b | 2009-08-19 15:54:32 +0800 | [diff] [blame] | 326 | ret = trace_define_common_fields(event_call); \ |
| 327 | if (ret) \ |
| 328 | return ret; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 329 | \ |
| 330 | tstruct; \ |
| 331 | \ |
| 332 | return ret; \ |
| 333 | } |
| 334 | |
| 335 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 336 | |
| 337 | /* |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 338 | * remember the offset of each array from the beginning of the event. |
| 339 | */ |
| 340 | |
| 341 | #undef __entry |
| 342 | #define __entry entry |
| 343 | |
| 344 | #undef __field |
| 345 | #define __field(type, item) |
| 346 | |
Li Zefan | 43b51ea | 2009-08-07 10:33:22 +0800 | [diff] [blame] | 347 | #undef __field_ext |
| 348 | #define __field_ext(type, item, filter_type) |
| 349 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 350 | #undef __array |
| 351 | #define __array(type, item, len) |
| 352 | |
| 353 | #undef __dynamic_array |
| 354 | #define __dynamic_array(type, item, len) \ |
| 355 | __data_offsets->item = __data_size + \ |
| 356 | offsetof(typeof(*entry), __data); \ |
Li Zefan | 7d536cb | 2009-07-16 10:54:02 +0800 | [diff] [blame] | 357 | __data_offsets->item |= (len * sizeof(type)) << 16; \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 358 | __data_size += (len) * sizeof(type); |
| 359 | |
| 360 | #undef __string |
| 361 | #define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) \ |
| 362 | |
| 363 | #undef TRACE_EVENT |
| 364 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
| 365 | static inline int ftrace_get_offsets_##call( \ |
| 366 | struct ftrace_data_offsets_##call *__data_offsets, proto) \ |
| 367 | { \ |
| 368 | int __data_size = 0; \ |
| 369 | struct ftrace_raw_##call __maybe_unused *entry; \ |
| 370 | \ |
| 371 | tstruct; \ |
| 372 | \ |
| 373 | return __data_size; \ |
| 374 | } |
| 375 | |
| 376 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 377 | |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 378 | #ifdef CONFIG_EVENT_PROFILE |
| 379 | |
| 380 | /* |
| 381 | * Generate the functions needed for tracepoint perf_counter support. |
| 382 | * |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 383 | * NOTE: The insertion profile callback (ftrace_profile_<call>) is defined later |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 384 | * |
| 385 | * static int ftrace_profile_enable_<call>(struct ftrace_event_call *event_call) |
| 386 | * { |
| 387 | * int ret = 0; |
| 388 | * |
| 389 | * if (!atomic_inc_return(&event_call->profile_count)) |
| 390 | * ret = register_trace_<call>(ftrace_profile_<call>); |
| 391 | * |
| 392 | * return ret; |
| 393 | * } |
| 394 | * |
| 395 | * static void ftrace_profile_disable_<call>(struct ftrace_event_call *event_call) |
| 396 | * { |
| 397 | * if (atomic_add_negative(-1, &event->call->profile_count)) |
| 398 | * unregister_trace_<call>(ftrace_profile_<call>); |
| 399 | * } |
| 400 | * |
| 401 | */ |
| 402 | |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 403 | #undef TRACE_EVENT |
| 404 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
| 405 | \ |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 406 | static void ftrace_profile_##call(proto); \ |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 407 | \ |
| 408 | static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \ |
| 409 | { \ |
| 410 | int ret = 0; \ |
| 411 | \ |
| 412 | if (!atomic_inc_return(&event_call->profile_count)) \ |
| 413 | ret = register_trace_##call(ftrace_profile_##call); \ |
| 414 | \ |
| 415 | return ret; \ |
| 416 | } \ |
| 417 | \ |
| 418 | static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\ |
| 419 | { \ |
| 420 | if (atomic_add_negative(-1, &event_call->profile_count)) \ |
| 421 | unregister_trace_##call(ftrace_profile_##call); \ |
| 422 | } |
| 423 | |
| 424 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 425 | |
Peter Zijlstra | 3a65930 | 2009-07-21 17:34:57 +0200 | [diff] [blame] | 426 | #endif |
| 427 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 428 | /* |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 429 | * Stage 4 of the trace events. |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 430 | * |
| 431 | * Override the macros in <trace/trace_events.h> to include the following: |
| 432 | * |
| 433 | * static void ftrace_event_<call>(proto) |
| 434 | * { |
| 435 | * event_trace_printk(_RET_IP_, "<call>: " <fmt>); |
| 436 | * } |
| 437 | * |
| 438 | * static int ftrace_reg_event_<call>(void) |
| 439 | * { |
| 440 | * int ret; |
| 441 | * |
| 442 | * ret = register_trace_<call>(ftrace_event_<call>); |
| 443 | * if (!ret) |
| 444 | * pr_info("event trace: Could not activate trace point " |
| 445 | * "probe to <call>"); |
| 446 | * return ret; |
| 447 | * } |
| 448 | * |
| 449 | * static void ftrace_unreg_event_<call>(void) |
| 450 | * { |
| 451 | * unregister_trace_<call>(ftrace_event_<call>); |
| 452 | * } |
| 453 | * |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 454 | * |
| 455 | * For those macros defined with TRACE_EVENT: |
| 456 | * |
| 457 | * static struct ftrace_event_call event_<call>; |
| 458 | * |
| 459 | * static void ftrace_raw_event_<call>(proto) |
| 460 | * { |
| 461 | * struct ring_buffer_event *event; |
| 462 | * struct ftrace_raw_<call> *entry; <-- defined in stage 1 |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 463 | * struct ring_buffer *buffer; |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 464 | * unsigned long irq_flags; |
| 465 | * int pc; |
| 466 | * |
| 467 | * local_save_flags(irq_flags); |
| 468 | * pc = preempt_count(); |
| 469 | * |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 470 | * event = trace_current_buffer_lock_reserve(&buffer, |
| 471 | * event_<call>.id, |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 472 | * sizeof(struct ftrace_raw_<call>), |
| 473 | * irq_flags, pc); |
| 474 | * if (!event) |
| 475 | * return; |
| 476 | * entry = ring_buffer_event_data(event); |
| 477 | * |
| 478 | * <assign>; <-- Here we assign the entries by the __field and |
| 479 | * __array macros. |
| 480 | * |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 481 | * trace_current_buffer_unlock_commit(buffer, event, irq_flags, pc); |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 482 | * } |
| 483 | * |
| 484 | * static int ftrace_raw_reg_event_<call>(void) |
| 485 | * { |
| 486 | * int ret; |
| 487 | * |
| 488 | * ret = register_trace_<call>(ftrace_raw_event_<call>); |
| 489 | * if (!ret) |
| 490 | * pr_info("event trace: Could not activate trace point " |
| 491 | * "probe to <call>"); |
| 492 | * return ret; |
| 493 | * } |
| 494 | * |
| 495 | * static void ftrace_unreg_event_<call>(void) |
| 496 | * { |
| 497 | * unregister_trace_<call>(ftrace_raw_event_<call>); |
| 498 | * } |
| 499 | * |
| 500 | * static struct trace_event ftrace_event_type_<call> = { |
| 501 | * .trace = ftrace_raw_output_<call>, <-- stage 2 |
| 502 | * }; |
| 503 | * |
| 504 | * static int ftrace_raw_init_event_<call>(void) |
| 505 | * { |
| 506 | * int id; |
| 507 | * |
| 508 | * id = register_ftrace_event(&ftrace_event_type_<call>); |
| 509 | * if (!id) |
| 510 | * return -ENODEV; |
| 511 | * event_<call>.id = id; |
| 512 | * return 0; |
| 513 | * } |
| 514 | * |
| 515 | * static struct ftrace_event_call __used |
| 516 | * __attribute__((__aligned__(4))) |
| 517 | * __attribute__((section("_ftrace_events"))) event_<call> = { |
| 518 | * .name = "<call>", |
| 519 | * .system = "<system>", |
| 520 | * .raw_init = ftrace_raw_init_event_<call>, |
| 521 | * .regfunc = ftrace_reg_event_<call>, |
| 522 | * .unregfunc = ftrace_unreg_event_<call>, |
| 523 | * .show_format = ftrace_format_<call>, |
| 524 | * } |
| 525 | * |
| 526 | */ |
| 527 | |
| 528 | #undef TP_FMT |
| 529 | #define TP_FMT(fmt, args...) fmt "\n", ##args |
| 530 | |
| 531 | #ifdef CONFIG_EVENT_PROFILE |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 532 | |
| 533 | #define _TRACE_PROFILE_INIT(call) \ |
| 534 | .profile_count = ATOMIC_INIT(-1), \ |
| 535 | .profile_enable = ftrace_profile_enable_##call, \ |
| 536 | .profile_disable = ftrace_profile_disable_##call, |
| 537 | |
| 538 | #else |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 539 | #define _TRACE_PROFILE_INIT(call) |
| 540 | #endif |
| 541 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 542 | #undef __entry |
| 543 | #define __entry entry |
| 544 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 545 | #undef __field |
| 546 | #define __field(type, item) |
| 547 | |
| 548 | #undef __array |
| 549 | #define __array(type, item, len) |
| 550 | |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 551 | #undef __dynamic_array |
| 552 | #define __dynamic_array(type, item, len) \ |
| 553 | __entry->__data_loc_##item = __data_offsets.item; |
| 554 | |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 555 | #undef __string |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 556 | #define __string(item, src) __dynamic_array(char, item, -1) \ |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 557 | |
| 558 | #undef __assign_str |
| 559 | #define __assign_str(dst, src) \ |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 560 | strcpy(__get_str(dst), src); |
| 561 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 562 | #undef TRACE_EVENT |
| 563 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 564 | \ |
| 565 | static struct ftrace_event_call event_##call; \ |
| 566 | \ |
| 567 | static void ftrace_raw_event_##call(proto) \ |
| 568 | { \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 569 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
Zhaolei | f2aebae | 2009-05-27 21:36:02 +0800 | [diff] [blame] | 570 | struct ftrace_event_call *event_call = &event_##call; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 571 | struct ring_buffer_event *event; \ |
| 572 | struct ftrace_raw_##call *entry; \ |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 573 | struct ring_buffer *buffer; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 574 | unsigned long irq_flags; \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 575 | int __data_size; \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 576 | int pc; \ |
| 577 | \ |
| 578 | local_save_flags(irq_flags); \ |
| 579 | pc = preempt_count(); \ |
| 580 | \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 581 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 582 | \ |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 583 | event = trace_current_buffer_lock_reserve(&buffer, \ |
| 584 | event_##call.id, \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 585 | sizeof(*entry) + __data_size, \ |
Frederic Weisbecker | 9cbf117 | 2009-04-19 04:51:29 +0200 | [diff] [blame] | 586 | irq_flags, pc); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 587 | if (!event) \ |
| 588 | return; \ |
| 589 | entry = ring_buffer_event_data(event); \ |
| 590 | \ |
Li Zefan | 7fcb7c4 | 2009-06-01 15:35:46 +0800 | [diff] [blame] | 591 | \ |
| 592 | tstruct \ |
| 593 | \ |
Li Zefan | a9c1c3a | 2009-06-01 15:35:13 +0800 | [diff] [blame] | 594 | { assign; } \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 595 | \ |
Steven Rostedt | e77405a | 2009-09-02 14:17:06 -0400 | [diff] [blame] | 596 | if (!filter_current_check_discard(buffer, event_call, entry, event)) \ |
| 597 | trace_nowake_buffer_unlock_commit(buffer, \ |
| 598 | event, irq_flags, pc); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 599 | } \ |
| 600 | \ |
Jason Baron | 69fd4f0 | 2009-08-10 16:52:44 -0400 | [diff] [blame] | 601 | static int ftrace_raw_reg_event_##call(void *ptr) \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 602 | { \ |
| 603 | int ret; \ |
| 604 | \ |
| 605 | ret = register_trace_##call(ftrace_raw_event_##call); \ |
| 606 | if (ret) \ |
| 607 | pr_info("event trace: Could not activate trace point " \ |
| 608 | "probe to " #call "\n"); \ |
| 609 | return ret; \ |
| 610 | } \ |
| 611 | \ |
Jason Baron | 69fd4f0 | 2009-08-10 16:52:44 -0400 | [diff] [blame] | 612 | static void ftrace_raw_unreg_event_##call(void *ptr) \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 613 | { \ |
| 614 | unregister_trace_##call(ftrace_raw_event_##call); \ |
| 615 | } \ |
| 616 | \ |
| 617 | static struct trace_event ftrace_event_type_##call = { \ |
| 618 | .trace = ftrace_raw_output_##call, \ |
| 619 | }; \ |
| 620 | \ |
| 621 | static int ftrace_raw_init_event_##call(void) \ |
| 622 | { \ |
| 623 | int id; \ |
| 624 | \ |
| 625 | id = register_ftrace_event(&ftrace_event_type_##call); \ |
| 626 | if (!id) \ |
| 627 | return -ENODEV; \ |
| 628 | event_##call.id = id; \ |
| 629 | INIT_LIST_HEAD(&event_##call.fields); \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 630 | return 0; \ |
| 631 | } \ |
| 632 | \ |
| 633 | static struct ftrace_event_call __used \ |
| 634 | __attribute__((__aligned__(4))) \ |
| 635 | __attribute__((section("_ftrace_events"))) event_##call = { \ |
| 636 | .name = #call, \ |
| 637 | .system = __stringify(TRACE_SYSTEM), \ |
Steven Rostedt | 6d72373 | 2009-04-10 14:53:50 -0400 | [diff] [blame] | 638 | .event = &ftrace_event_type_##call, \ |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 639 | .raw_init = ftrace_raw_init_event_##call, \ |
| 640 | .regfunc = ftrace_raw_reg_event_##call, \ |
| 641 | .unregfunc = ftrace_raw_unreg_event_##call, \ |
| 642 | .show_format = ftrace_format_##call, \ |
| 643 | .define_fields = ftrace_define_fields_##call, \ |
| 644 | _TRACE_PROFILE_INIT(call) \ |
| 645 | } |
| 646 | |
| 647 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 648 | |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 649 | /* |
| 650 | * Define the insertion callback to profile events |
| 651 | * |
| 652 | * The job is very similar to ftrace_raw_event_<call> except that we don't |
| 653 | * insert in the ring buffer but in a perf counter. |
| 654 | * |
| 655 | * static void ftrace_profile_<call>(proto) |
| 656 | * { |
| 657 | * struct ftrace_data_offsets_<call> __maybe_unused __data_offsets; |
| 658 | * struct ftrace_event_call *event_call = &event_<call>; |
| 659 | * extern void perf_tpcounter_event(int, u64, u64, void *, int); |
| 660 | * struct ftrace_raw_##call *entry; |
| 661 | * u64 __addr = 0, __count = 1; |
| 662 | * unsigned long irq_flags; |
| 663 | * int __entry_size; |
| 664 | * int __data_size; |
| 665 | * int pc; |
| 666 | * |
| 667 | * local_save_flags(irq_flags); |
| 668 | * pc = preempt_count(); |
| 669 | * |
| 670 | * __data_size = ftrace_get_offsets_<call>(&__data_offsets, args); |
Frederic Weisbecker | 304703a | 2009-08-10 16:11:32 +0200 | [diff] [blame] | 671 | * |
| 672 | * // Below we want to get the aligned size by taking into account |
| 673 | * // the u32 field that will later store the buffer size |
| 674 | * __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32), |
| 675 | * sizeof(u64)); |
| 676 | * __entry_size -= sizeof(u32); |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 677 | * |
| 678 | * do { |
| 679 | * char raw_data[__entry_size]; <- allocate our sample in the stack |
| 680 | * struct trace_entry *ent; |
| 681 | * |
Frederic Weisbecker | 1853db0 | 2009-08-10 16:38:36 +0200 | [diff] [blame] | 682 | * zero dead bytes from alignment to avoid stack leak to userspace: |
| 683 | * |
| 684 | * *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 685 | * entry = (struct ftrace_raw_<call> *)raw_data; |
| 686 | * ent = &entry->ent; |
| 687 | * tracing_generic_entry_update(ent, irq_flags, pc); |
| 688 | * ent->type = event_call->id; |
| 689 | * |
| 690 | * <tstruct> <- do some jobs with dynamic arrays |
| 691 | * |
| 692 | * <assign> <- affect our values |
| 693 | * |
| 694 | * perf_tpcounter_event(event_call->id, __addr, __count, entry, |
| 695 | * __entry_size); <- submit them to perf counter |
| 696 | * } while (0); |
| 697 | * |
| 698 | * } |
| 699 | */ |
| 700 | |
| 701 | #ifdef CONFIG_EVENT_PROFILE |
| 702 | |
| 703 | #undef __perf_addr |
| 704 | #define __perf_addr(a) __addr = (a) |
| 705 | |
| 706 | #undef __perf_count |
| 707 | #define __perf_count(c) __count = (c) |
| 708 | |
| 709 | #undef TRACE_EVENT |
| 710 | #define TRACE_EVENT(call, proto, args, tstruct, assign, print) \ |
| 711 | static void ftrace_profile_##call(proto) \ |
| 712 | { \ |
| 713 | struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ |
| 714 | struct ftrace_event_call *event_call = &event_##call; \ |
| 715 | extern void perf_tpcounter_event(int, u64, u64, void *, int); \ |
| 716 | struct ftrace_raw_##call *entry; \ |
| 717 | u64 __addr = 0, __count = 1; \ |
| 718 | unsigned long irq_flags; \ |
| 719 | int __entry_size; \ |
| 720 | int __data_size; \ |
| 721 | int pc; \ |
| 722 | \ |
| 723 | local_save_flags(irq_flags); \ |
| 724 | pc = preempt_count(); \ |
| 725 | \ |
| 726 | __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \ |
Peter Zijlstra | a044560 | 2009-08-10 11:16:52 +0200 | [diff] [blame] | 727 | __entry_size = ALIGN(__data_size + sizeof(*entry) + sizeof(u32),\ |
| 728 | sizeof(u64)); \ |
Frederic Weisbecker | 304703a | 2009-08-10 16:11:32 +0200 | [diff] [blame] | 729 | __entry_size -= sizeof(u32); \ |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 730 | \ |
| 731 | do { \ |
| 732 | char raw_data[__entry_size]; \ |
| 733 | struct trace_entry *ent; \ |
| 734 | \ |
Frederic Weisbecker | 1853db0 | 2009-08-10 16:38:36 +0200 | [diff] [blame] | 735 | *(u64 *)(&raw_data[__entry_size - sizeof(u64)]) = 0ULL; \ |
Frederic Weisbecker | f413cdb | 2009-08-07 01:25:54 +0200 | [diff] [blame] | 736 | entry = (struct ftrace_raw_##call *)raw_data; \ |
| 737 | ent = &entry->ent; \ |
| 738 | tracing_generic_entry_update(ent, irq_flags, pc); \ |
| 739 | ent->type = event_call->id; \ |
| 740 | \ |
| 741 | tstruct \ |
| 742 | \ |
| 743 | { assign; } \ |
| 744 | \ |
| 745 | perf_tpcounter_event(event_call->id, __addr, __count, entry,\ |
| 746 | __entry_size); \ |
| 747 | } while (0); \ |
| 748 | \ |
| 749 | } |
| 750 | |
| 751 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) |
| 752 | #endif /* CONFIG_EVENT_PROFILE */ |
| 753 | |
Steven Rostedt | f42c85e | 2009-04-13 12:25:37 -0400 | [diff] [blame] | 754 | #undef _TRACE_PROFILE_INIT |
| 755 | |