aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/ftrace.h
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-12-15 02:39:57 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-06 12:08:46 -0500
commit0fa0edaf32b9a78b9854f1da98d4511a501089b0 (patch)
tree2226710ff7f455cfc9ed9e29252337f70cf3ab33 /include/trace/ftrace.h
parent5a65e956220efc2421e21ee56d6153fd5c533a95 (diff)
tracing: Remove show_format and related macros from TRACE_EVENT
The previous patches added the use of print_fmt string and changes the trace_define_field() function to also create the fields and format output for the event format files. text data bss dec hex filename 5857201 1355780 9336808 16549789 fc879d vmlinux 5884589 1351684 9337896 16574169 fce6d9 vmlinux-orig The above shows the size of the vmlinux after this patch set compared to the vmlinux-orig which is before the patch set. This saves us 27k on text, 1k on bss and adds just 4k of data. The total savings of 24k in size. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> LKML-Reference: <4B273D4D.40604@cn.fujitsu.com> Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r--include/trace/ftrace.h133
1 files changed, 6 insertions, 127 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 3351d85c83a..df65b99880b 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -131,130 +131,6 @@
131#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 131#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
132 132
133/* 133/*
134 * Setup the showing format of trace point.
135 *
136 * int
137 * ftrace_format_##call(struct trace_seq *s)
138 * {
139 * struct ftrace_raw_##call field;
140 * int ret;
141 *
142 * ret = trace_seq_printf(s, #type " " #item ";"
143 * " offset:%u; size:%u;\n",
144 * offsetof(struct ftrace_raw_##call, item),
145 * sizeof(field.type));
146 *
147 * }
148 */
149
150#undef TP_STRUCT__entry
151#define TP_STRUCT__entry(args...) args
152
153#undef __field
154#define __field(type, item) \
155 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
156 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
157 (unsigned int)offsetof(typeof(field), item), \
158 (unsigned int)sizeof(field.item), \
159 (unsigned int)is_signed_type(type)); \
160 if (!ret) \
161 return 0;
162
163#undef __field_ext
164#define __field_ext(type, item, filter_type) __field(type, item)
165
166#undef __array
167#define __array(type, item, len) \
168 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
169 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
170 (unsigned int)offsetof(typeof(field), item), \
171 (unsigned int)sizeof(field.item), \
172 (unsigned int)is_signed_type(type)); \
173 if (!ret) \
174 return 0;
175
176#undef __dynamic_array
177#define __dynamic_array(type, item, len) \
178 ret = trace_seq_printf(s, "\tfield:__data_loc " #type "[] " #item ";\t"\
179 "offset:%u;\tsize:%u;\tsigned:%u;\n", \
180 (unsigned int)offsetof(typeof(field), \
181 __data_loc_##item), \
182 (unsigned int)sizeof(field.__data_loc_##item), \
183 (unsigned int)is_signed_type(type)); \
184 if (!ret) \
185 return 0;
186
187#undef __string
188#define __string(item, src) __dynamic_array(char, item, -1)
189
190#undef __entry
191#define __entry REC
192
193#undef __print_symbolic
194#undef __get_dynamic_array
195#undef __get_str
196
197#undef TP_printk
198#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)
199
200#undef TP_fast_assign
201#define TP_fast_assign(args...) args
202
203#undef TP_perf_assign
204#define TP_perf_assign(args...)
205
206#undef DECLARE_EVENT_CLASS
207#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \
208static int \
209ftrace_format_setup_##call(struct ftrace_event_call *unused, \
210 struct trace_seq *s) \
211{ \
212 struct ftrace_raw_##call field __attribute__((unused)); \
213 int ret = 0; \
214 \
215 tstruct; \
216 \
217 return ret; \
218} \
219 \
220static int \
221ftrace_format_##call(struct ftrace_event_call *unused, \
222 struct trace_seq *s) \
223{ \
224 int ret = 0; \
225 \
226 ret = ftrace_format_setup_##call(unused, s); \
227 if (!ret) \
228 return ret; \
229 \
230 ret = trace_seq_printf(s, "\nprint fmt: " print); \
231 \
232 return ret; \
233}
234
235#undef DEFINE_EVENT
236#define DEFINE_EVENT(template, name, proto, args)
237
238#undef DEFINE_EVENT_PRINT
239#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
240static int \
241ftrace_format_##name(struct ftrace_event_call *unused, \
242 struct trace_seq *s) \
243{ \
244 int ret = 0; \
245 \
246 ret = ftrace_format_setup_##template(unused, s); \
247 if (!ret) \
248 return ret; \
249 \
250 trace_seq_printf(s, "\nprint fmt: " print); \
251 \
252 return ret; \
253}
254
255#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
256
257/*
258 * Stage 3 of the trace events. 134 * Stage 3 of the trace events.
259 * 135 *
260 * Override the macros in <trace/trace_events.h> to include the following: 136 * Override the macros in <trace/trace_events.h> to include the following:
@@ -622,7 +498,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
622 * .raw_init = trace_event_raw_init, 498 * .raw_init = trace_event_raw_init,
623 * .regfunc = ftrace_reg_event_<call>, 499 * .regfunc = ftrace_reg_event_<call>,
624 * .unregfunc = ftrace_unreg_event_<call>, 500 * .unregfunc = ftrace_unreg_event_<call>,
625 * .show_format = ftrace_format_<call>,
626 * } 501 * }
627 * 502 *
628 */ 503 */
@@ -657,6 +532,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
657#define __assign_str(dst, src) \ 532#define __assign_str(dst, src) \
658 strcpy(__get_str(dst), src); 533 strcpy(__get_str(dst), src);
659 534
535#undef TP_fast_assign
536#define TP_fast_assign(args...) args
537
538#undef TP_perf_assign
539#define TP_perf_assign(args...)
540
660#undef DECLARE_EVENT_CLASS 541#undef DECLARE_EVENT_CLASS
661#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ 542#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
662 \ 543 \
@@ -750,7 +631,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
750 .regfunc = ftrace_raw_reg_event_##call, \ 631 .regfunc = ftrace_raw_reg_event_##call, \
751 .unregfunc = ftrace_raw_unreg_event_##call, \ 632 .unregfunc = ftrace_raw_unreg_event_##call, \
752 .print_fmt = print_fmt_##template, \ 633 .print_fmt = print_fmt_##template, \
753 .show_format = ftrace_format_##template, \
754 .define_fields = ftrace_define_fields_##template, \ 634 .define_fields = ftrace_define_fields_##template, \
755 _TRACE_PROFILE_INIT(call) \ 635 _TRACE_PROFILE_INIT(call) \
756} 636}
@@ -770,7 +650,6 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
770 .regfunc = ftrace_raw_reg_event_##call, \ 650 .regfunc = ftrace_raw_reg_event_##call, \
771 .unregfunc = ftrace_raw_unreg_event_##call, \ 651 .unregfunc = ftrace_raw_unreg_event_##call, \
772 .print_fmt = print_fmt_##call, \ 652 .print_fmt = print_fmt_##call, \
773 .show_format = ftrace_format_##call, \
774 .define_fields = ftrace_define_fields_##template, \ 653 .define_fields = ftrace_define_fields_##template, \
775 _TRACE_PROFILE_INIT(call) \ 654 _TRACE_PROFILE_INIT(call) \
776} 655}