diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-10 17:55:31 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-10 17:55:31 -0400 |
commit | e2b8b2808538a91444e78c7db5a30519cadd09b2 (patch) | |
tree | 60c45581817db746bd61670f5c95b19c2661daa0 /include | |
parent | 4dd163a0512eb91bbcf4e66d2f65b8e4042561b3 (diff) | |
parent | ef18012b248b47ec9a12c3a83ca5e99782d39c5d (diff) |
Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tracepoint.h | 105 | ||||
-rw-r--r-- | include/trace/irq_event_types.h | 8 | ||||
-rw-r--r-- | include/trace/sched_event_types.h | 102 |
3 files changed, 159 insertions, 56 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 69b56988813d..d35a7ee7611f 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -157,7 +157,110 @@ static inline void tracepoint_synchronize_unregister(void) | |||
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 | |
161 | /* | ||
162 | * For use with the TRACE_EVENT macro: | ||
163 | * | ||
164 | * We define a tracepoint, its arguments, its printk format | ||
165 | * and its 'fast binay record' layout. | ||
166 | * | ||
167 | * Firstly, name your tracepoint via TRACE_EVENT(name : the | ||
168 | * 'subsystem_event' notation is fine. | ||
169 | * | ||
170 | * Think about this whole construct as the | ||
171 | * 'trace_sched_switch() function' from now on. | ||
172 | * | ||
173 | * | ||
174 | * TRACE_EVENT(sched_switch, | ||
175 | * | ||
176 | * * | ||
177 | * * A function has a regular function arguments | ||
178 | * * prototype, declare it via TP_PROTO(): | ||
179 | * * | ||
180 | * | ||
181 | * TP_PROTO(struct rq *rq, struct task_struct *prev, | ||
182 | * struct task_struct *next), | ||
183 | * | ||
184 | * * | ||
185 | * * Define the call signature of the 'function'. | ||
186 | * * (Design sidenote: we use this instead of a | ||
187 | * * TP_PROTO1/TP_PROTO2/TP_PROTO3 ugliness.) | ||
188 | * * | ||
189 | * | ||
190 | * TP_ARGS(rq, prev, next), | ||
191 | * | ||
192 | * * | ||
193 | * * Fast binary tracing: define the trace record via | ||
194 | * * TP_STRUCT__entry(). You can think about it like a | ||
195 | * * regular C structure local variable definition. | ||
196 | * * | ||
197 | * * This is how the trace record is structured and will | ||
198 | * * be saved into the ring buffer. These are the fields | ||
199 | * * that will be exposed to user-space in | ||
200 | * * /debug/tracing/events/<*>/format. | ||
201 | * * | ||
202 | * * The declared 'local variable' is called '__entry' | ||
203 | * * | ||
204 | * * __field(pid_t, prev_prid) is equivalent to a standard declariton: | ||
205 | * * | ||
206 | * * pid_t prev_pid; | ||
207 | * * | ||
208 | * * __array(char, prev_comm, TASK_COMM_LEN) is equivalent to: | ||
209 | * * | ||
210 | * * char prev_comm[TASK_COMM_LEN]; | ||
211 | * * | ||
212 | * | ||
213 | * TP_STRUCT__entry( | ||
214 | * __array( char, prev_comm, TASK_COMM_LEN ) | ||
215 | * __field( pid_t, prev_pid ) | ||
216 | * __field( int, prev_prio ) | ||
217 | * __array( char, next_comm, TASK_COMM_LEN ) | ||
218 | * __field( pid_t, next_pid ) | ||
219 | * __field( int, next_prio ) | ||
220 | * ), | ||
221 | * | ||
222 | * * | ||
223 | * * Assign the entry into the trace record, by embedding | ||
224 | * * a full C statement block into TP_fast_assign(). You | ||
225 | * * can refer to the trace record as '__entry' - | ||
226 | * * otherwise you can put arbitrary C code in here. | ||
227 | * * | ||
228 | * * Note: this C code will execute every time a trace event | ||
229 | * * happens, on an active tracepoint. | ||
230 | * * | ||
231 | * | ||
232 | * TP_fast_assign( | ||
233 | * memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); | ||
234 | * __entry->prev_pid = prev->pid; | ||
235 | * __entry->prev_prio = prev->prio; | ||
236 | * memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); | ||
237 | * __entry->next_pid = next->pid; | ||
238 | * __entry->next_prio = next->prio; | ||
239 | * ) | ||
240 | * | ||
241 | * * | ||
242 | * * Formatted output of a trace record via TP_printk(). | ||
243 | * * This is how the tracepoint will appear under ftrace | ||
244 | * * plugins that make use of this tracepoint. | ||
245 | * * | ||
246 | * * (raw-binary tracing wont actually perform this step.) | ||
247 | * * | ||
248 | * | ||
249 | * TP_printk("task %s:%d [%d] ==> %s:%d [%d]", | ||
250 | * __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, | ||
251 | * __entry->next_comm, __entry->next_pid, __entry->next_prio), | ||
252 | * | ||
253 | * ); | ||
254 | * | ||
255 | * This macro construct is thus used for the regular printk format | ||
256 | * tracing setup, it is used to construct a function pointer based | ||
257 | * tracepoint callback (this is used by programmatic plugins and | ||
258 | * can also by used by generic instrumentation like SystemTap), and | ||
259 | * it is also used to expose a structured trace record in | ||
260 | * /debug/tracing/events/. | ||
261 | */ | ||
262 | |||
263 | #define TRACE_EVENT(name, proto, args, struct, assign, print) \ | ||
161 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) | 264 | DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) |
162 | 265 | ||
163 | #endif | 266 | #endif |
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h index 43bcb74dd49f..214bb928fe9e 100644 --- a/include/trace/irq_event_types.h +++ b/include/trace/irq_event_types.h | |||
@@ -31,13 +31,13 @@ TRACE_EVENT(irq_handler_exit, | |||
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_SYSTEM | 43 | #undef TRACE_SYSTEM |
diff --git a/include/trace/sched_event_types.h b/include/trace/sched_event_types.h index fb37af672c88..63547dc1125f 100644 --- a/include/trace/sched_event_types.h +++ b/include/trace/sched_event_types.h | |||
@@ -22,12 +22,12 @@ TRACE_EVENT(sched_kthread_stop, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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, | |||
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_SYSTEM | 337 | #undef TRACE_SYSTEM |