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
157#define TRACE_FORMAT(name, proto, args, fmt) \157#define TRACE_FORMAT(name, proto, args, fmt) \
158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
159 159
160#define TRACE_EVENT(name, proto, args, struct, print, assign) \160#define TRACE_EVENT(name, proto, args, struct, assign, print) \
161 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))161 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
162 162
163#endif163#endif
include/trace/irq_event_types.h+4−4
@@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit, · 30 unmodified lines
31 __field( int, ret )31 __field( int, ret )
32 ),32 ),
33 33
34 TP_printk("irq=%d return=%s",
35 __entry->irq, __entry->ret ? "handled" : "unhandled"),
36
37 TP_fast_assign(34 TP_fast_assign(
38 __entry->irq = irq;35 __entry->irq = irq;
39 __entry->ret = ret;36 __entry->ret = ret;
40 )37 ),
38
39 TP_printk("irq=%d return=%s",
40 __entry->irq, __entry->ret ? "handled" : "unhandled")
41);41);
42 42
43#undef TRACE_SYSTEM43#undef TRACE_SYSTEM
include/trace/sched_event_types.h+51−51
@@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop, · 21 unmodified lines
22 __field( pid_t, pid )22 __field( pid_t, pid )
23 ),23 ),
24 24
25 TP_printk("task %s:%d", __entry->comm, __entry->pid),
26
27 TP_fast_assign(25 TP_fast_assign(
28 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);26 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
29 __entry->pid = t->pid;27 __entry->pid = t->pid;
30 )28 ),
29
30 TP_printk("task %s:%d", __entry->comm, __entry->pid)
31);31);
32 32
33/*33/*
@@ -43,11 +43,11 @@ TRACE_EVENT(sched_kthread_stop_ret, · 9 unmodified lines
43 __field( int, ret )43 __field( int, ret )
44 ),44 ),
45 45
46 TP_printk("ret %d", __entry->ret),
47
48 TP_fast_assign(46 TP_fast_assign(
49 __entry->ret = ret;47 __entry->ret = ret;
50 )48 ),
49
50 TP_printk("ret %d", __entry->ret)
51);51);
52 52
53/*53/*
@@ -68,14 +68,14 @@ TRACE_EVENT(sched_wait_task, · 14 unmodified lines
68 __field( int, prio )68 __field( int, prio )
69 ),69 ),
70 70
71 TP_printk("task %s:%d [%d]",
72 __entry->comm, __entry->pid, __entry->prio),
73
74 TP_fast_assign(71 TP_fast_assign(
75 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);72 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
76 __entry->pid = p->pid;73 __entry->pid = p->pid;
77 __entry->prio = p->prio;74 __entry->prio = p->prio;
78 )75 ),
76
77 TP_printk("task %s:%d [%d]",
78 __entry->comm, __entry->pid, __entry->prio)
79);79);
80 80
81/*81/*
@@ -97,16 +97,16 @@ TRACE_EVENT(sched_wakeup, · 15 unmodified lines
97 __field( int, success )97 __field( int, success )
98 ),98 ),
99 99
100 TP_printk("task %s:%d [%d] success=%d",
101 __entry->comm, __entry->pid, __entry->prio,
102 __entry->success),
103
104 TP_fast_assign(100 TP_fast_assign(
105 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);101 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
106 __entry->pid = p->pid;102 __entry->pid = p->pid;
107 __entry->prio = p->prio;103 __entry->prio = p->prio;
108 __entry->success = success;104 __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)
110);110);
111 111
112/*112/*
@@ -128,16 +128,16 @@ TRACE_EVENT(sched_wakeup_new, · 15 unmodified lines
128 __field( int, success )128 __field( int, success )
129 ),129 ),
130 130
131 TP_printk("task %s:%d [%d] success=%d",
132 __entry->comm, __entry->pid, __entry->prio,
133 __entry->success),
134
135 TP_fast_assign(131 TP_fast_assign(
136 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);132 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
137 __entry->pid = p->pid;133 __entry->pid = p->pid;
138 __entry->prio = p->prio;134 __entry->prio = p->prio;
139 __entry->success = success;135 __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)
141);141);
142 142
143/*143/*
@@ -162,10 +162,6 @@ TRACE_EVENT(sched_switch, · 18 unmodified lines
162 __field( int, next_prio )162 __field( int, next_prio )
163 ),163 ),
164 164
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
169 TP_fast_assign(165 TP_fast_assign(
170 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);166 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
171 __entry->prev_pid = prev->pid;167 __entry->prev_pid = prev->pid;
@@ -173,7 +169,11 @@ TRACE_EVENT(sched_switch, · 1 unmodified line
173 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);169 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
174 __entry->next_pid = next->pid;170 __entry->next_pid = next->pid;
175 __entry->next_prio = next->prio;171 __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)
177);177);
178 178
179/*179/*
@@ -193,17 +193,17 @@ TRACE_EVENT(sched_migrate_task, · 13 unmodified lines
193 __field( int, dest_cpu )193 __field( int, dest_cpu )
194 ),194 ),
195 195
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
200 TP_fast_assign(196 TP_fast_assign(
201 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);197 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
202 __entry->pid = p->pid;198 __entry->pid = p->pid;
203 __entry->prio = p->prio;199 __entry->prio = p->prio;
204 __entry->orig_cpu = orig_cpu;200 __entry->orig_cpu = orig_cpu;
205 __entry->dest_cpu = dest_cpu;201 __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)
207);207);
208 208
209/*209/*
@@ -221,14 +221,14 @@ TRACE_EVENT(sched_process_free, · 11 unmodified lines
221 __field( int, prio )221 __field( int, prio )
222 ),222 ),
223 223
224 TP_printk("task %s:%d [%d]",
225 __entry->comm, __entry->pid, __entry->prio),
226
227 TP_fast_assign(224 TP_fast_assign(
228 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);225 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
229 __entry->pid = p->pid;226 __entry->pid = p->pid;
230 __entry->prio = p->prio;227 __entry->prio = p->prio;
231 )228 ),
229
230 TP_printk("task %s:%d [%d]",
231 __entry->comm, __entry->pid, __entry->prio)
232);232);
233 233
234/*234/*
@@ -246,14 +246,14 @@ TRACE_EVENT(sched_process_exit, · 11 unmodified lines
246 __field( int, prio )246 __field( int, prio )
247 ),247 ),
248 248
249 TP_printk("task %s:%d [%d]",
250 __entry->comm, __entry->pid, __entry->prio),
251
252 TP_fast_assign(249 TP_fast_assign(
253 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);250 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
254 __entry->pid = p->pid;251 __entry->pid = p->pid;
255 __entry->prio = p->prio;252 __entry->prio = p->prio;
256 )253 ),
254
255 TP_printk("task %s:%d [%d]",
256 __entry->comm, __entry->pid, __entry->prio)
257);257);
258 258
259/*259/*
@@ -271,14 +271,14 @@ TRACE_EVENT(sched_process_wait, · 11 unmodified lines
271 __field( int, prio )271 __field( int, prio )
272 ),272 ),
273 273
274 TP_printk("task %s:%d [%d]",
275 __entry->comm, __entry->pid, __entry->prio),
276
277 TP_fast_assign(274 TP_fast_assign(
278 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);275 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
279 __entry->pid = pid_nr(pid);276 __entry->pid = pid_nr(pid);
280 __entry->prio = current->prio;277 __entry->prio = current->prio;
281 )278 ),
279
280 TP_printk("task %s:%d [%d]",
281 __entry->comm, __entry->pid, __entry->prio)
282);282);
283 283
284/*284/*
@@ -297,16 +297,16 @@ TRACE_EVENT(sched_process_fork, · 12 unmodified lines
297 __field( pid_t, child_pid )297 __field( pid_t, child_pid )
298 ),298 ),
299 299
300 TP_printk("parent %s:%d child %s:%d",
301 __entry->parent_comm, __entry->parent_pid,
302 __entry->child_comm, __entry->child_pid),
303
304 TP_fast_assign(300 TP_fast_assign(
305 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);301 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
306 __entry->parent_pid = parent->pid;302 __entry->parent_pid = parent->pid;
307 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);303 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
308 __entry->child_pid = child->pid;304 __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)
310);310);
311 311
312/*312/*
@@ -324,14 +324,14 @@ TRACE_EVENT(sched_signal_send, · 11 unmodified lines
324 __field( pid_t, pid )324 __field( pid_t, pid )
325 ),325 ),
326 326
327 TP_printk("sig: %d task %s:%d",
328 __entry->sig, __entry->comm, __entry->pid),
329
330 TP_fast_assign(327 TP_fast_assign(
331 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);328 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
332 __entry->pid = p->pid;329 __entry->pid = p->pid;
333 __entry->sig = sig;330 __entry->sig = sig;
334 )331 ),
332
333 TP_printk("sig: %d task %s:%d",
334 __entry->sig, __entry->comm, __entry->pid)
335);335);
336 336
337#undef TRACE_SYSTEM337#undef TRACE_SYSTEM
kernel/trace/trace_events_stage_1.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
27#define TP_STRUCT__entry(args...) args27#define TP_STRUCT__entry(args...) args
28 28
29#undef TRACE_EVENT29#undef TRACE_EVENT
30#define TRACE_EVENT(name, proto, args, tstruct, print, assign) \30#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
31 struct ftrace_raw_##name { \31 struct ftrace_raw_##name { \
32 struct trace_entry ent; \32 struct trace_entry ent; \
33 tstruct \33 tstruct \
kernel/trace/trace_events_stage_2.h+2−2
@@ -39,7 +39,7 @@ · 38 unmodified lines
39#define TP_printk(fmt, args...) fmt "\n", args39#define TP_printk(fmt, args...) fmt "\n", args
40 40
41#undef TRACE_EVENT41#undef TRACE_EVENT
42#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \42#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
43enum print_line_t \43enum print_line_t \
44ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \44ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
45{ \45{ \
@@ -115,7 +115,7 @@ ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \ · 69 unmodified lines
115#define TP_fast_assign(args...) args115#define TP_fast_assign(args...) args
116 116
117#undef TRACE_EVENT117#undef TRACE_EVENT
118#define TRACE_EVENT(call, proto, args, tstruct, print, func) \118#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
119static int \119static int \
120ftrace_format_##call(struct trace_seq *s) \120ftrace_format_##call(struct trace_seq *s) \
121{ \121{ \
kernel/trace/trace_events_stage_3.h+1−1
@@ -148,7 +148,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ · 147 unmodified lines
148#define __entry entry148#define __entry entry
149 149
150#undef TRACE_EVENT150#undef TRACE_EVENT
151#define TRACE_EVENT(call, proto, args, tstruct, print, assign) \151#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
152 \152 \
153static struct ftrace_event_call event_##call; \153static struct ftrace_event_call event_##call; \
154 \154 \

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