tracing: new format for specialized trace points
[linux-2.6.git] / kernel / trace / trace_events_stage_3.h
index 2ab65e9..8e398d8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * static void ftrace_event_<call>(proto)
  * {
- *     event_trace_printk(_RET_IP_, "(<call>) " <fmt>);
+ *     event_trace_printk(_RET_IP_, "<call>: " <fmt>);
  * }
  *
  * static int ftrace_reg_event_<call>(void)
  *     .raw_init               = ftrace_raw_init_event_<call>,
  *     .raw_reg                = ftrace_raw_reg_event_<call>,
  *     .raw_unreg              = ftrace_raw_unreg_event_<call>,
+ *     .show_format            = ftrace_format_<call>,
  * }
  *
  */
 
-#undef TPFMT
-#define TPFMT(fmt, args...)    fmt "\n", ##args
+#undef TP_FMT
+#define TP_FMT(fmt, args...)   fmt "\n", ##args
 
 #define _TRACE_FORMAT(call, proto, args, fmt)                          \
 static void ftrace_event_##call(proto)                                 \
 {                                                                      \
-       event_trace_printk(_RET_IP_, "(" #call ") " fmt);               \
+       event_trace_printk(_RET_IP_, #call ": " fmt);                   \
 }                                                                      \
                                                                        \
 static int ftrace_reg_event_##call(void)                               \
@@ -119,9 +120,9 @@ static int ftrace_reg_event_##call(void)                            \
        int ret;                                                        \
                                                                        \
        ret = register_trace_##call(ftrace_event_##call);               \
-       if (!ret)                                                       \
+       if (ret)                                                        \
                pr_info("event trace: Could not activate trace point "  \
-                       "probe to " #call);                             \
+                       "probe to " #call "\n");                        \
        return ret;                                                     \
 }                                                                      \
                                                                        \
@@ -138,32 +139,20 @@ static struct ftrace_event_call __used                                    \
 __attribute__((__aligned__(4)))                                                \
 __attribute__((section("_ftrace_events"))) event_##call = {            \
        .name                   = #call,                                \
-       .system                 = STR(TRACE_SYSTEM),                    \
+       .system                 = __stringify(TRACE_SYSTEM),            \
        .regfunc                = ftrace_reg_event_##call,              \
        .unregfunc              = ftrace_unreg_event_##call,            \
 }
 
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-       entry->item = assign;
-
-#undef TRACE_FIELD
-#define TRACE_FIELD(type, item, assign)\
-       entry->item = assign;
-
-#undef TPCMD
-#define TPCMD(cmd...)  cmd
-
-#undef TRACE_ENTRY
-#define TRACE_ENTRY    entry
+#undef TRACE_EVENT_FORMAT
+#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, raw)       \
+       TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt))
 
-#undef TRACE_FIELD_SPECIAL
-#define TRACE_FIELD_SPECIAL(type_item, item, cmd) \
-       cmd;
+#undef __entry
+#define __entry entry
 
-#undef TRACE_EVENT_FORMAT
-#define TRACE_EVENT_FORMAT(call, proto, args, fmt, tstruct, tpfmt)     \
-_TRACE_FORMAT(call, PARAMS(proto), PARAMS(args), PARAMS(fmt))          \
+#undef TRACE_EVENT
+#define TRACE_EVENT(call, proto, args, tstruct, print, assign)         \
                                                                        \
 static struct ftrace_event_call event_##call;                          \
                                                                        \
@@ -184,7 +173,7 @@ static void ftrace_raw_event_##call(proto)                          \
                return;                                                 \
        entry   = ring_buffer_event_data(event);                        \
                                                                        \
-       tstruct;                                                        \
+       assign;                                                         \
                                                                        \
        trace_current_buffer_unlock_commit(event, irq_flags, pc);       \
 }                                                                      \
@@ -194,9 +183,9 @@ static int ftrace_raw_reg_event_##call(void)                                \
        int ret;                                                        \
                                                                        \
        ret = register_trace_##call(ftrace_raw_event_##call);           \
-       if (!ret)                                                       \
+       if (ret)                                                        \
                pr_info("event trace: Could not activate trace point "  \
-                       "probe to " #call);                             \
+                       "probe to " #call "\n");                        \
        return ret;                                                     \
 }                                                                      \
                                                                        \
@@ -224,10 +213,9 @@ static struct ftrace_event_call __used                                     \
 __attribute__((__aligned__(4)))                                                \
 __attribute__((section("_ftrace_events"))) event_##call = {            \
        .name                   = #call,                                \
-       .system                 = STR(TRACE_SYSTEM),                    \
-       .regfunc                = ftrace_reg_event_##call,              \
-       .unregfunc              = ftrace_unreg_event_##call,            \
+       .system                 = __stringify(TRACE_SYSTEM),            \
        .raw_init               = ftrace_raw_init_event_##call,         \
-       .raw_reg                = ftrace_raw_reg_event_##call,          \
-       .raw_unreg              = ftrace_raw_unreg_event_##call,        \
+       .regfunc                = ftrace_raw_reg_event_##call,          \
+       .unregfunc              = ftrace_raw_unreg_event_##call,        \
+       .show_format            = ftrace_format_##call,                 \
 }