History

tracing: flip the TP_printk and TP_fast_assign in the TRACE_EVENT macro

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.

Steven Rostedt committed 17 years ago

Commit 30a8fec1 parent 2314c4a6 files · +60 −60Browse files

Unified · Split

6 files
  1. include/linux/tracepoint.h +1 −1
  2. include/trace/irq_event_types.h +4 −4
  3. include/trace/sched_event_types.h +51 −51
  4. kernel/trace/trace_events_stage_1.h +1 −1
  5. kernel/trace/trace_events_stage_2.h +2 −2
  6. kernel/trace/trace_events_stage_3.h +1 −1
include/linux/tracepoint.h+1−1
@@ -157,7 +157,7 @@ static inline void tracepoint_synchronize_unregister(void) · 156 unmodified lines
157157 #define TRACE_FORMAT(name, proto, args, fmt) \
158158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
159159
160−#define TRACE_EVENT(name, proto, args, struct, print, assign) \
160+#define TRACE_EVENT(name, proto, args, struct, assign, print) \
161161 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
162162
163163 #endif
include/trace/irq_event_types.h+4−4
@@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit, · 30 unmodified lines
3131 __field( int, ret )
3232 ),
3333
34− TP_printk("irq=%d return=%s",
35− __entry->irq, __entry->ret ? "handled" : "unhandled"),
36−
3734 TP_fast_assign(
3835 __entry->irq = irq;
3936 __entry->ret = ret;
40− )
37+ ),
38+
39+ TP_printk("irq=%d return=%s",
40+ __entry->irq, __entry->ret ? "handled" : "unhandled")
4141 );
4242
4343 #undef TRACE_SYSTEM
include/trace/sched_event_types.h+51−51
@@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop, · 21 unmodified lines
2222 __field( pid_t, pid )
2323 ),
2424
25− TP_printk("task %s:%d", __entry->comm, __entry->pid),
26−
2725 TP_fast_assign(
2826 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
2927 __entry->pid = t->pid;
30− )
28+ ),
29+
30+ TP_printk("task %s:%d", __entry->comm, __entry->pid)
3131 );
3232
3333 /*
@@ -43,11 +43,11 @@ TRACE_EVENT(sched_kthread_stop_ret, · 9 unmodified lines
4343 __field( int, ret )
4444 ),
4545
46− TP_printk("ret %d", __entry->ret),
47−
4846 TP_fast_assign(
4947 __entry->ret = ret;
50− )
48+ ),
49+
50+ TP_printk("ret %d", __entry->ret)
5151 );
5252
5353 /*
@@ -68,14 +68,14 @@ TRACE_EVENT(sched_wait_task, · 14 unmodified lines
6868 __field( int, prio )
6969 ),
7070
71− TP_printk("task %s:%d [%d]",
72− __entry->comm, __entry->pid, __entry->prio),
73−
7471 TP_fast_assign(
7572 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
7673 __entry->pid = p->pid;
7774 __entry->prio = p->prio;
78− )
75+ ),
76+
77+ TP_printk("task %s:%d [%d]",
78+ __entry->comm, __entry->pid, __entry->prio)
7979 );
8080
8181 /*
@@ -97,16 +97,16 @@ TRACE_EVENT(sched_wakeup, · 15 unmodified lines
9797 __field( int, success )
9898 ),
9999
100− TP_printk("task %s:%d [%d] success=%d",
101− __entry->comm, __entry->pid, __entry->prio,
102− __entry->success),
103−
104100 TP_fast_assign(
105101 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
106102 __entry->pid = p->pid;
107103 __entry->prio = p->prio;
108104 __entry->success = success;
109− )
105+ ),
106+
107+ TP_printk("task %s:%d [%d] success=%d",
108+ __entry->comm, __entry->pid, __entry->prio,
109+ __entry->success)
110110 );
111111
112112 /*
@@ -128,16 +128,16 @@ TRACE_EVENT(sched_wakeup_new, · 15 unmodified lines
128128 __field( int, success )
129129 ),
130130
131− TP_printk("task %s:%d [%d] success=%d",
132− __entry->comm, __entry->pid, __entry->prio,
133− __entry->success),
134−
135131 TP_fast_assign(
136132 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
137133 __entry->pid = p->pid;
138134 __entry->prio = p->prio;
139135 __entry->success = success;
140− )
136+ ),
137+
138+ TP_printk("task %s:%d [%d] success=%d",
139+ __entry->comm, __entry->pid, __entry->prio,
140+ __entry->success)
141141 );
142142
143143 /*
@@ -162,10 +162,6 @@ TRACE_EVENT(sched_switch, · 18 unmodified lines
162162 __field( int, next_prio )
163163 ),
164164
165− TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
166− __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
167− __entry->next_comm, __entry->next_pid, __entry->next_prio),
168−
169165 TP_fast_assign(
170166 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
171167 __entry->prev_pid = prev->pid;
@@ -173,7 +169,11 @@ TRACE_EVENT(sched_switch, · 1 unmodified line
173169 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
174170 __entry->next_pid = next->pid;
175171 __entry->next_prio = next->prio;
176− )
172+ ),
173+
174+ TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
175+ __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
176+ __entry->next_comm, __entry->next_pid, __entry->next_prio)
177177 );
178178
179179 /*
@@ -193,17 +193,17 @@ TRACE_EVENT(sched_migrate_task, · 13 unmodified lines
193193 __field( int, dest_cpu )
194194 ),
195195
196− TP_printk("task %s:%d [%d] from: %d to: %d",
197− __entry->comm, __entry->pid, __entry->prio,
198− __entry->orig_cpu, __entry->dest_cpu),
199−
200196 TP_fast_assign(
201197 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
202198 __entry->pid = p->pid;
203199 __entry->prio = p->prio;
204200 __entry->orig_cpu = orig_cpu;
205201 __entry->dest_cpu = dest_cpu;
206− )
202+ ),
203+
204+ TP_printk("task %s:%d [%d] from: %d to: %d",
205+ __entry->comm, __entry->pid, __entry->prio,
206+ __entry->orig_cpu, __entry->dest_cpu)
207207 );
208208
209209 /*
@@ -221,14 +221,14 @@ TRACE_EVENT(sched_process_free, · 11 unmodified lines
221221 __field( int, prio )
222222 ),
223223
224− TP_printk("task %s:%d [%d]",
225− __entry->comm, __entry->pid, __entry->prio),
226−
227224 TP_fast_assign(
228225 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
229226 __entry->pid = p->pid;
230227 __entry->prio = p->prio;
231− )
228+ ),
229+
230+ TP_printk("task %s:%d [%d]",
231+ __entry->comm, __entry->pid, __entry->prio)
232232 );
233233
234234 /*
@@ -246,14 +246,14 @@ TRACE_EVENT(sched_process_exit, · 11 unmodified lines
246246 __field( int, prio )
247247 ),
248248
249− TP_printk("task %s:%d [%d]",
250− __entry->comm, __entry->pid, __entry->prio),
251−
252249 TP_fast_assign(
253250 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
254251 __entry->pid = p->pid;
255252 __entry->prio = p->prio;
256− )
253+ ),
254+
255+ TP_printk("task %s:%d [%d]",
256+ __entry->comm, __entry->pid, __entry->prio)
257257 );
258258
259259 /*
@@ -271,14 +271,14 @@ TRACE_EVENT(sched_process_wait, · 11 unmodified lines
271271 __field( int, prio )
272272 ),
273273
274− TP_printk("task %s:%d [%d]",
275− __entry->comm, __entry->pid, __entry->prio),
276−
277274 TP_fast_assign(
278275 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
279276 __entry->pid = pid_nr(pid);
280277 __entry->prio = current->prio;
281− )
278+ ),
279+
280+ TP_printk("task %s:%d [%d]",
281+ __entry->comm, __entry->pid, __entry->prio)
282282 );
283283
284284 /*
@@ -297,16 +297,16 @@ TRACE_EVENT(sched_process_fork, · 12 unmodified lines
297297 __field( pid_t, child_pid )
298298 ),
299299
300− TP_printk("parent %s:%d child %s:%d",
301− __entry->parent_comm, __entry->parent_pid,
302− __entry->child_comm, __entry->child_pid),
303−
304300 TP_fast_assign(
305301 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
306302 __entry->parent_pid = parent->pid;
307303 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
308304 __entry->child_pid = child->pid;
309− )
305+ ),
306+
307+ TP_printk("parent %s:%d child %s:%d",
308+ __entry->parent_comm, __entry->parent_pid,
309+ __entry->child_comm, __entry->child_pid)
310310 );
311311
312312 /*
@@ -324,14 +324,14 @@ TRACE_EVENT(sched_signal_send, · 11 unmodified lines
324324 __field( pid_t, pid )
325325 ),
326326
327− TP_printk("sig: %d task %s:%d",
328− __entry->sig, __entry->comm, __entry->pid),
329−
330327 TP_fast_assign(
331328 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
332329 __entry->pid = p->pid;
333330 __entry->sig = sig;
334− )
331+ ),
332+
333+ TP_printk("sig: %d task %s:%d",
334+ __entry->sig, __entry->comm, __entry->pid)
335335 );
336336
337337 #undef TRACE_SYSTEM
kernel/trace/trace_events_stage_1.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727 #define TP_STRUCT__entry(args...) args
2828
2929 #undef TRACE_EVENT
30−#define TRACE_EVENT(name, proto, args, tstruct, print, assign) \
30+#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
3131 struct ftrace_raw_##name { \
3232 struct trace_entry ent; \
3333 tstruct \
kernel/trace/trace_events_stage_2.h+2−2
@@ -39,7 +39,7 @@ · 38 unmodified lines
3939 #define TP_printk(fmt, args...) fmt "\n", args
4040
4141 #undef TRACE_EVENT
42−#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
42+#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
4343 enum print_line_t \
4444 ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
4545 { \
@@ -115,7 +115,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ · 69 unmodified lines
115115 #define TP_fast_assign(args...) args
116116
117117 #undef TRACE_EVENT
118−#define TRACE_EVENT(call, proto, args, tstruct, print, func) \
118+#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
119119 static int \
120120 ftrace_format_##call(struct trace_seq *s) \
121121 { \
kernel/trace/trace_events_stage_3.h+1−1
@@ -148,7 +148,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ · 147 unmodified lines
148148 #define __entry entry
149149
150150 #undef TRACE_EVENT
151−#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \
151+#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
152152 \
153153 static struct ftrace_event_call event_##call; \
154154 \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t