tracing: Add print_fmt field
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 15 Dec 2009 07:39:42 +0000 (15:39 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 6 Jan 2010 16:41:54 +0000 (11:41 -0500)
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>
include/linux/ftrace_event.h
include/trace/ftrace.h
kernel/trace/trace_export.c

index 2233c98d80df5f473ba2f8616f8f3b55e6afd0a4..bd23d8e52f028bbcea85c1af409ac9a12202d400 100644 (file)
@@ -121,6 +121,7 @@ struct ftrace_event_call {
        int                     (*regfunc)(struct ftrace_event_call *);
        void                    (*unregfunc)(struct ftrace_event_call *);
        int                     id;
+       const char              *print_fmt;
        int                     (*raw_init)(struct ftrace_event_call *);
        int                     (*show_format)(struct ftrace_event_call *,
                                               struct trace_seq *);
index c6fe03e902ca2c4502c984b79645d1d3648f2640..3351d85c83a3b55515a2d2ef42ef87be1abe422f 100644 (file)
@@ -722,8 +722,20 @@ static struct trace_event ftrace_event_type_##call = {                     \
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
+#undef __entry
+#define __entry REC
+
+#undef __print_flags
+#undef __print_symbolic
+#undef __get_dynamic_array
+#undef __get_str
+
+#undef TP_printk
+#define TP_printk(fmt, args...) "\"" fmt "\", "  __stringify(args)
+
 #undef DECLARE_EVENT_CLASS
-#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print)
+#define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
+static const char print_fmt_##call[] = print;
 
 #undef DEFINE_EVENT
 #define DEFINE_EVENT(template, call, proto, args)                      \
@@ -737,6 +749,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
+       .print_fmt              = print_fmt_##template,                 \
        .show_format            = ftrace_format_##template,             \
        .define_fields          = ftrace_define_fields_##template,      \
        _TRACE_PROFILE_INIT(call)                                       \
@@ -745,6 +758,8 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, call, proto, args, print)         \
                                                                        \
+static const char print_fmt_##call[] = print;                          \
+                                                                       \
 static struct ftrace_event_call __used                                 \
 __attribute__((__aligned__(4)))                                                \
 __attribute__((section("_ftrace_events"))) event_##call = {            \
@@ -754,6 +769,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
+       .print_fmt              = print_fmt_##call,                     \
        .show_format            = ftrace_format_##call,                 \
        .define_fields          = ftrace_define_fields_##template,      \
        _TRACE_PROFILE_INIT(call)                                       \
@@ -837,6 +853,16 @@ __attribute__((section("_ftrace_events"))) event_##call = {                \
 
 #ifdef CONFIG_EVENT_PROFILE
 
+#undef __entry
+#define __entry entry
+
+#undef __get_dynamic_array
+#define __get_dynamic_array(field)     \
+               ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
+
+#undef __get_str
+#define __get_str(field) (char *)__get_dynamic_array(field)
+
 #undef __perf_addr
 #define __perf_addr(a) __addr = (a)
 
index 9978a4f40090db459fb79a020d41bcf098c14505..95d14b640a66c5edc253dad6e4654e62ee164a9b 100644 (file)
@@ -203,6 +203,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
        return 0;
 }
 
+#undef __entry
+#define __entry REC
+
 #undef __field
 #define __field(type, item)
 
@@ -218,6 +221,9 @@ static int ftrace_raw_init_event(struct ftrace_event_call *call)
 #undef __dynamic_array
 #define __dynamic_array(type, item)
 
+#undef F_printk
+#define F_printk(fmt, args...) #fmt ", "  __stringify(args)
+
 #undef FTRACE_ENTRY
 #define FTRACE_ENTRY(call, struct_name, type, tstruct, print)          \
                                                                        \
@@ -228,6 +234,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .id                     = type,                                 \
        .system                 = __stringify(TRACE_SYSTEM),            \
        .raw_init               = ftrace_raw_init_event,                \
+       .print_fmt              = print,                                \
        .show_format            = ftrace_format_##call,                 \
        .define_fields          = ftrace_define_fields_##call,          \
 };                                                                     \