aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-12-15 02:39:42 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-01-06 11:41:54 -0500
commit509e760cd91c831983097ae174cb6c0b8c6c8e6b (patch)
tree985da24e69e80b81713c2901c94b127c961cd426
parent809826a389040e0ad9d646b587bccc0e34691afd (diff)
tracing: Add print_fmt field
This is part of a patch set that removes the show_format method in the ftrace event macros. The print_fmt field is added to hold the string that shows the print_fmt in the event format files. This patch only adds the field but it is currently not used. Later patches will use this field to enable us to remove the show_format field and function. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> LKML-Reference: <4B273D3E.2000704@cn.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--include/linux/ftrace_event.h1
-rw-r--r--include/trace/ftrace.h28
-rw-r--r--kernel/trace/trace_export.c7
3 files changed, 35 insertions, 1 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 2233c98d80df..bd23d8e52f02 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -121,6 +121,7 @@ struct ftrace_event_call {
121 int (*regfunc)(struct ftrace_event_call *); 121 int (*regfunc)(struct ftrace_event_call *);
122 void (*unregfunc)(struct ftrace_event_call *); 122 void (*unregfunc)(struct ftrace_event_call *);
123 int id; 123 int id;
124 const char *print_fmt;
124 int (*raw_init)(struct ftrace_event_call *); 125 int (*raw_init)(struct ftrace_event_call *);
125 int (*show_format)(struct ftrace_event_call *, 126 int (*show_format)(struct ftrace_event_call *,
126 struct trace_seq *); 127 struct trace_seq *);
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index c6fe03e902ca..3351d85c83a3 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -722,8 +722,20 @@ static struct trace_event ftrace_event_type_##call = { \
722 722
723#include TRACE_INCLUDE(TRACE_INCLUDE_FILE) 723#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
724 724
725#undef __entry
726#define __entry REC
727
728#undef __print_flags
729#undef __print_symbolic
730#undef __get_dynamic_array
731#undef __get_str
732
733#undef TP_printk
734#define TP_printk(fmt, args...) "\"" fmt "\", " __stringify(args)
735
725#undef DECLARE_EVENT_CLASS 736#undef DECLARE_EVENT_CLASS
726#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) 737#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
738static const char print_fmt_##call[] = print;
727 739
728#undef DEFINE_EVENT 740#undef DEFINE_EVENT
729#define DEFINE_EVENT(template, call, proto, args) \ 741#define DEFINE_EVENT(template, call, proto, args) \
@@ -737,6 +749,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
737 .raw_init = trace_event_raw_init, \ 749 .raw_init = trace_event_raw_init, \
738 .regfunc = ftrace_raw_reg_event_##call, \ 750 .regfunc = ftrace_raw_reg_event_##call, \
739 .unregfunc = ftrace_raw_unreg_event_##call, \ 751 .unregfunc = ftrace_raw_unreg_event_##call, \
752 .print_fmt = print_fmt_##template, \
740 .show_format = ftrace_format_##template, \ 753 .show_format = ftrace_format_##template, \
741 .define_fields = ftrace_define_fields_##template, \ 754 .define_fields = ftrace_define_fields_##template, \
742 _TRACE_PROFILE_INIT(call) \ 755 _TRACE_PROFILE_INIT(call) \
@@ -745,6 +758,8 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
745#undef DEFINE_EVENT_PRINT 758#undef DEFINE_EVENT_PRINT
746#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \ 759#define DEFINE_EVENT_PRINT(template, call, proto, args, print) \
747 \ 760 \
761static const char print_fmt_##call[] = print; \
762 \
748static struct ftrace_event_call __used \ 763static struct ftrace_event_call __used \
749__attribute__((__aligned__(4))) \ 764__attribute__((__aligned__(4))) \
750__attribute__((section("_ftrace_events"))) event_##call = { \ 765__attribute__((section("_ftrace_events"))) event_##call = { \
@@ -754,6 +769,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
754 .raw_init = trace_event_raw_init, \ 769 .raw_init = trace_event_raw_init, \
755 .regfunc = ftrace_raw_reg_event_##call, \ 770 .regfunc = ftrace_raw_reg_event_##call, \
756 .unregfunc = ftrace_raw_unreg_event_##call, \ 771 .unregfunc = ftrace_raw_unreg_event_##call, \
772 .print_fmt = print_fmt_##call, \
757 .show_format = ftrace_format_##call, \ 773 .show_format = ftrace_format_##call, \
758 .define_fields = ftrace_define_fields_##template, \ 774 .define_fields = ftrace_define_fields_##template, \
759 _TRACE_PROFILE_INIT(call) \ 775 _TRACE_PROFILE_INIT(call) \
@@ -837,6 +853,16 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
837 853
838#ifdef CONFIG_EVENT_PROFILE 854#ifdef CONFIG_EVENT_PROFILE
839 855
856#undef __entry
857#define __entry entry
858
859#undef __get_dynamic_array
860#define __get_dynamic_array(field) \
861 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
862
863#undef __get_str
864#define __get_str(field) (char *)__get_dynamic_array(field)
865
840#undef __perf_addr 866#undef __perf_addr
841#define __perf_addr(a) __addr = (a) 867#define __perf_addr(a) __addr = (a)
842 868
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 9978a4f40090..95d14b640a66 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -203,6 +203,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
203 return 0; 203 return 0;
204} 204}
205 205
206#undef __entry
207#define __entry REC
208
206#undef __field 209#undef __field
207#define __field(type, item) 210#define __field(type, item)
208 211
@@ -218,6 +221,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
218#undef __dynamic_array 221#undef __dynamic_array
219#define __dynamic_array(type, item) 222#define __dynamic_array(type, item)
220 223
224#undef F_printk
225#define F_printk(fmt, args...) #fmt ", " __stringify(args)
226
221#undef FTRACE_ENTRY 227#undef FTRACE_ENTRY
222#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \ 228#define FTRACE_ENTRY(call, struct_name, type, tstruct, print) \
223 \ 229 \
@@ -228,6 +234,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
228 .id = type, \ 234 .id = type, \
229 .system = __stringify(TRACE_SYSTEM), \ 235 .system = __stringify(TRACE_SYSTEM), \
230 .raw_init = ftrace_raw_init_event, \ 236 .raw_init = ftrace_raw_init_event, \
237 .print_fmt = print, \
231 .show_format = ftrace_format_##call, \ 238 .show_format = ftrace_format_##call, \
232 .define_fields = ftrace_define_fields_##call, \ 239 .define_fields = ftrace_define_fields_##call, \
233}; \ 240}; \