tracing: flip the TP_printk and TP_fast_assign in the TRACE_EVENT macro
authorSteven Rostedt <srostedt@redhat.com>
Tue, 10 Mar 2009 16:41:38 +0000 (12:41 -0400)
committerSteven Rostedt <srostedt@redhat.com>
Tue, 10 Mar 2009 16:41:38 +0000 (12:41 -0400)
Impact: clean up

In trying to stay consistant with the C style format in the TRACE_EVENT
macro, it makes more sense to do the printk after the assigning of
the variables.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
include/linux/tracepoint.h
include/trace/irq_event_types.h
include/trace/sched_event_types.h
kernel/trace/trace_events_stage_1.h
kernel/trace/trace_events_stage_2.h
kernel/trace/trace_events_stage_3.h

index 69b56988813d84eabdf5c2be7e52ff11b018fa62..c7b09452514b9267e97bd4ade5e53493932ea817 100644 (file)
@@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void)
 #define TRACE_FORMAT(name, proto, args, fmt)           \
        DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
-#define TRACE_EVENT(name, proto, args, struct, print, assign)  \
+#define TRACE_EVENT(name, proto, args, struct, assign, print)  \
        DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
 #endif
index 43bcb74dd49f4272f4398d7ceef1de6acaf2dcf6..214bb928fe9e6d887131c35baef531a3e9a5352c 100644 (file)
@@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit,
                __field(        int,    ret     )
        ),
 
-       TP_printk("irq=%d return=%s",
-                 __entry->irq, __entry->ret ? "handled" : "unhandled"),
-
        TP_fast_assign(
                __entry->irq    = irq;
                __entry->ret    = ret;
-       )
+       ),
+
+       TP_printk("irq=%d return=%s",
+                 __entry->irq, __entry->ret ? "handled" : "unhandled")
 );
 
 #undef TRACE_SYSTEM
index fb37af672c8824e5d86918f0676ba0d1c978b336..63547dc1125f7dc59bcc38cf55b92a253e178353 100644 (file)
@@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop,
                __field(        pid_t,  pid                     )
        ),
 
-       TP_printk("task %s:%d", __entry->comm, __entry->pid),
-
        TP_fast_assign(
                memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
                __entry->pid    = t->pid;
-       )
+       ),
+
+       TP_printk("task %s:%d", __entry->comm, __entry->pid)
 );
 
 /*
@@ -43,11 +43,11 @@ TRACE_EVENT(sched_kthread_stop_ret,
                __field(        int,    ret     )
        ),
 
-       TP_printk("ret %d", __entry->ret),
-
        TP_fast_assign(
                __entry->ret    = ret;
-       )
+       ),
+
+       TP_printk("ret %d", __entry->ret)
 );
 
 /*
@@ -68,14 +68,14 @@ TRACE_EVENT(sched_wait_task,
                __field(        int,    prio                    )
        ),
 
-       TP_printk("task %s:%d [%d]",
-                 __entry->comm, __entry->pid, __entry->prio),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid    = p->pid;
                __entry->prio   = p->prio;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d]",
+                 __entry->comm, __entry->pid, __entry->prio)
 );
 
 /*
@@ -97,16 +97,16 @@ TRACE_EVENT(sched_wakeup,
                __field(        int,    success                 )
        ),
 
-       TP_printk("task %s:%d [%d] success=%d",
-                 __entry->comm, __entry->pid, __entry->prio,
-                 __entry->success),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
                __entry->success        = success;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d] success=%d",
+                 __entry->comm, __entry->pid, __entry->prio,
+                 __entry->success)
 );
 
 /*
@@ -128,16 +128,16 @@ TRACE_EVENT(sched_wakeup_new,
                __field(        int,    success                 )
        ),
 
-       TP_printk("task %s:%d [%d] success=%d",
-                 __entry->comm, __entry->pid, __entry->prio,
-                 __entry->success),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
                __entry->success        = success;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d] success=%d",
+                 __entry->comm, __entry->pid, __entry->prio,
+                 __entry->success)
 );
 
 /*
@@ -162,10 +162,6 @@ TRACE_EVENT(sched_switch,
                __field(        int,    next_prio                       )
        ),
 
-       TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
-               __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
-               __entry->next_comm, __entry->next_pid, __entry->next_prio),
-
        TP_fast_assign(
                memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
                __entry->prev_pid       = prev->pid;
@@ -173,7 +169,11 @@ TRACE_EVENT(sched_switch,
                memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
                __entry->next_pid       = next->pid;
                __entry->next_prio      = next->prio;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
+               __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
+               __entry->next_comm, __entry->next_pid, __entry->next_prio)
 );
 
 /*
@@ -193,17 +193,17 @@ TRACE_EVENT(sched_migrate_task,
                __field(        int,    dest_cpu                )
        ),
 
-       TP_printk("task %s:%d [%d] from: %d  to: %d",
-                 __entry->comm, __entry->pid, __entry->prio,
-                 __entry->orig_cpu, __entry->dest_cpu),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
                __entry->orig_cpu       = orig_cpu;
                __entry->dest_cpu       = dest_cpu;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d] from: %d  to: %d",
+                 __entry->comm, __entry->pid, __entry->prio,
+                 __entry->orig_cpu, __entry->dest_cpu)
 );
 
 /*
@@ -221,14 +221,14 @@ TRACE_EVENT(sched_process_free,
                __field(        int,    prio                    )
        ),
 
-       TP_printk("task %s:%d [%d]",
-                 __entry->comm, __entry->pid, __entry->prio),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d]",
+                 __entry->comm, __entry->pid, __entry->prio)
 );
 
 /*
@@ -246,14 +246,14 @@ TRACE_EVENT(sched_process_exit,
                __field(        int,    prio                    )
        ),
 
-       TP_printk("task %s:%d [%d]",
-                 __entry->comm, __entry->pid, __entry->prio),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid            = p->pid;
                __entry->prio           = p->prio;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d]",
+                 __entry->comm, __entry->pid, __entry->prio)
 );
 
 /*
@@ -271,14 +271,14 @@ TRACE_EVENT(sched_process_wait,
                __field(        int,    prio                    )
        ),
 
-       TP_printk("task %s:%d [%d]",
-                 __entry->comm, __entry->pid, __entry->prio),
-
        TP_fast_assign(
                memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
                __entry->pid            = pid_nr(pid);
                __entry->prio           = current->prio;
-       )
+       ),
+
+       TP_printk("task %s:%d [%d]",
+                 __entry->comm, __entry->pid, __entry->prio)
 );
 
 /*
@@ -297,16 +297,16 @@ TRACE_EVENT(sched_process_fork,
                __field(        pid_t,  child_pid                       )
        ),
 
-       TP_printk("parent %s:%d  child %s:%d",
-               __entry->parent_comm, __entry->parent_pid,
-               __entry->child_comm, __entry->child_pid),
-
        TP_fast_assign(
                memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
                __entry->parent_pid     = parent->pid;
                memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
                __entry->child_pid      = child->pid;
-       )
+       ),
+
+       TP_printk("parent %s:%d  child %s:%d",
+               __entry->parent_comm, __entry->parent_pid,
+               __entry->child_comm, __entry->child_pid)
 );
 
 /*
@@ -324,14 +324,14 @@ TRACE_EVENT(sched_signal_send,
                __field(        pid_t,  pid                     )
        ),
 
-       TP_printk("sig: %d  task %s:%d",
-                 __entry->sig, __entry->comm, __entry->pid),
-
        TP_fast_assign(
                memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
                __entry->pid    = p->pid;
                __entry->sig    = sig;
-       )
+       ),
+
+       TP_printk("sig: %d  task %s:%d",
+                 __entry->sig, __entry->comm, __entry->pid)
 );
 
 #undef TRACE_SYSTEM
index 15e9bf965a189ea8f685f17bb84665f35b51a389..82f68443c556456ce95dc767bdfb0d1a0d80e274 100644 (file)
@@ -27,7 +27,7 @@
 #define TP_STRUCT__entry(args...) args
 
 #undef TRACE_EVENT
-#define TRACE_EVENT(name, proto, args, tstruct, print, assign) \
+#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
        struct ftrace_raw_##name {                              \
                struct trace_entry      ent;                    \
                tstruct                                         \
index d91bf4c566613eaebd8b403edceb3b947fe9ea00..1ad9f8d2fe45d3fd2b4818aa5dc45e4b4651018a 100644 (file)
@@ -39,7 +39,7 @@
 #define TP_printk(fmt, args...) fmt "\n", args
 
 #undef TRACE_EVENT
-#define TRACE_EVENT(call, proto, args, tstruct, print, assign)         \
+#define TRACE_EVENT(call, proto, args, tstruct, assign, print)         \
 enum print_line_t                                                      \
 ftrace_raw_output_##call(struct trace_iterator *iter, int flags)       \
 {                                                                      \
@@ -115,7 +115,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags)    \
 #define TP_fast_assign(args...) args
 
 #undef TRACE_EVENT
-#define TRACE_EVENT(call, proto, args, tstruct, print, func)           \
+#define TRACE_EVENT(call, proto, args, tstruct, func, print)           \
 static int                                                             \
 ftrace_format_##call(struct trace_seq *s)                              \
 {                                                                      \
index 3ba55d4ab073829d9a378622b6bebab2e77d92fe..d6de06b9201a29e59cdb66b7af6c8bf58b45db5f 100644 (file)
@@ -148,7 +148,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
 #define __entry entry
 
 #undef TRACE_EVENT
-#define TRACE_EVENT(call, proto, args, tstruct, print, assign)         \
+#define TRACE_EVENT(call, proto, args, tstruct, assign, print)         \
                                                                        \
 static struct ftrace_event_call event_##call;                          \
                                                                        \