Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
[pandora-kernel.git] / include / trace / events / sched.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM sched
3
4 #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SCHED_H
6
7 #include <linux/sched.h>
8 #include <linux/tracepoint.h>
9
10 /*
11  * Tracepoint for calling kthread_stop, performed to end a kthread:
12  */
13 TRACE_EVENT(sched_kthread_stop,
14
15         TP_PROTO(struct task_struct *t),
16
17         TP_ARGS(t),
18
19         TP_STRUCT__entry(
20                 __array(        char,   comm,   TASK_COMM_LEN   )
21                 __field(        pid_t,  pid                     )
22         ),
23
24         TP_fast_assign(
25                 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
26                 __entry->pid    = t->pid;
27         ),
28
29         TP_printk("task %s:%d", __entry->comm, __entry->pid)
30 );
31
32 /*
33  * Tracepoint for the return value of the kthread stopping:
34  */
35 TRACE_EVENT(sched_kthread_stop_ret,
36
37         TP_PROTO(int ret),
38
39         TP_ARGS(ret),
40
41         TP_STRUCT__entry(
42                 __field(        int,    ret     )
43         ),
44
45         TP_fast_assign(
46                 __entry->ret    = ret;
47         ),
48
49         TP_printk("ret %d", __entry->ret)
50 );
51
52 /*
53  * Tracepoint for waiting on task to unschedule:
54  *
55  * (NOTE: the 'rq' argument is not used by generic trace events,
56  *        but used by the latency tracer plugin. )
57  */
58 TRACE_EVENT(sched_wait_task,
59
60         TP_PROTO(struct rq *rq, struct task_struct *p),
61
62         TP_ARGS(rq, p),
63
64         TP_STRUCT__entry(
65                 __array(        char,   comm,   TASK_COMM_LEN   )
66                 __field(        pid_t,  pid                     )
67                 __field(        int,    prio                    )
68         ),
69
70         TP_fast_assign(
71                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
72                 __entry->pid    = p->pid;
73                 __entry->prio   = p->prio;
74         ),
75
76         TP_printk("task %s:%d [%d]",
77                   __entry->comm, __entry->pid, __entry->prio)
78 );
79
80 /*
81  * Tracepoint for waking up a task:
82  *
83  * (NOTE: the 'rq' argument is not used by generic trace events,
84  *        but used by the latency tracer plugin. )
85  */
86 TRACE_EVENT(sched_wakeup,
87
88         TP_PROTO(struct rq *rq, struct task_struct *p, int success),
89
90         TP_ARGS(rq, p, success),
91
92         TP_STRUCT__entry(
93                 __array(        char,   comm,   TASK_COMM_LEN   )
94                 __field(        pid_t,  pid                     )
95                 __field(        int,    prio                    )
96                 __field(        int,    success                 )
97         ),
98
99         TP_fast_assign(
100                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
101                 __entry->pid            = p->pid;
102                 __entry->prio           = p->prio;
103                 __entry->success        = success;
104         ),
105
106         TP_printk("task %s:%d [%d] success=%d",
107                   __entry->comm, __entry->pid, __entry->prio,
108                   __entry->success)
109 );
110
111 /*
112  * Tracepoint for waking up a new task:
113  *
114  * (NOTE: the 'rq' argument is not used by generic trace events,
115  *        but used by the latency tracer plugin. )
116  */
117 TRACE_EVENT(sched_wakeup_new,
118
119         TP_PROTO(struct rq *rq, struct task_struct *p, int success),
120
121         TP_ARGS(rq, p, success),
122
123         TP_STRUCT__entry(
124                 __array(        char,   comm,   TASK_COMM_LEN   )
125                 __field(        pid_t,  pid                     )
126                 __field(        int,    prio                    )
127                 __field(        int,    success                 )
128         ),
129
130         TP_fast_assign(
131                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
132                 __entry->pid            = p->pid;
133                 __entry->prio           = p->prio;
134                 __entry->success        = success;
135         ),
136
137         TP_printk("task %s:%d [%d] success=%d",
138                   __entry->comm, __entry->pid, __entry->prio,
139                   __entry->success)
140 );
141
142 /*
143  * Tracepoint for task switches, performed by the scheduler:
144  *
145  * (NOTE: the 'rq' argument is not used by generic trace events,
146  *        but used by the latency tracer plugin. )
147  */
148 TRACE_EVENT(sched_switch,
149
150         TP_PROTO(struct rq *rq, struct task_struct *prev,
151                  struct task_struct *next),
152
153         TP_ARGS(rq, prev, next),
154
155         TP_STRUCT__entry(
156                 __array(        char,   prev_comm,      TASK_COMM_LEN   )
157                 __field(        pid_t,  prev_pid                        )
158                 __field(        int,    prev_prio                       )
159                 __field(        long,   prev_state                      )
160                 __array(        char,   next_comm,      TASK_COMM_LEN   )
161                 __field(        pid_t,  next_pid                        )
162                 __field(        int,    next_prio                       )
163         ),
164
165         TP_fast_assign(
166                 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
167                 __entry->prev_pid       = prev->pid;
168                 __entry->prev_prio      = prev->prio;
169                 __entry->prev_state     = prev->state;
170                 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
171                 __entry->next_pid       = next->pid;
172                 __entry->next_prio      = next->prio;
173         ),
174
175         TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]",
176                 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
177                 __entry->prev_state ?
178                   __print_flags(__entry->prev_state, "|",
179                                 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
180                                 { 16, "Z" }, { 32, "X" }, { 64, "x" },
181                                 { 128, "W" }) : "R",
182                 __entry->next_comm, __entry->next_pid, __entry->next_prio)
183 );
184
185 /*
186  * Tracepoint for a task being migrated:
187  */
188 TRACE_EVENT(sched_migrate_task,
189
190         TP_PROTO(struct task_struct *p, int dest_cpu),
191
192         TP_ARGS(p, dest_cpu),
193
194         TP_STRUCT__entry(
195                 __array(        char,   comm,   TASK_COMM_LEN   )
196                 __field(        pid_t,  pid                     )
197                 __field(        int,    prio                    )
198                 __field(        int,    orig_cpu                )
199                 __field(        int,    dest_cpu                )
200         ),
201
202         TP_fast_assign(
203                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
204                 __entry->pid            = p->pid;
205                 __entry->prio           = p->prio;
206                 __entry->orig_cpu       = task_cpu(p);
207                 __entry->dest_cpu       = dest_cpu;
208         ),
209
210         TP_printk("task %s:%d [%d] from: %d  to: %d",
211                   __entry->comm, __entry->pid, __entry->prio,
212                   __entry->orig_cpu, __entry->dest_cpu)
213 );
214
215 /*
216  * Tracepoint for freeing a task:
217  */
218 TRACE_EVENT(sched_process_free,
219
220         TP_PROTO(struct task_struct *p),
221
222         TP_ARGS(p),
223
224         TP_STRUCT__entry(
225                 __array(        char,   comm,   TASK_COMM_LEN   )
226                 __field(        pid_t,  pid                     )
227                 __field(        int,    prio                    )
228         ),
229
230         TP_fast_assign(
231                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
232                 __entry->pid            = p->pid;
233                 __entry->prio           = p->prio;
234         ),
235
236         TP_printk("task %s:%d [%d]",
237                   __entry->comm, __entry->pid, __entry->prio)
238 );
239
240 /*
241  * Tracepoint for a task exiting:
242  */
243 TRACE_EVENT(sched_process_exit,
244
245         TP_PROTO(struct task_struct *p),
246
247         TP_ARGS(p),
248
249         TP_STRUCT__entry(
250                 __array(        char,   comm,   TASK_COMM_LEN   )
251                 __field(        pid_t,  pid                     )
252                 __field(        int,    prio                    )
253         ),
254
255         TP_fast_assign(
256                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
257                 __entry->pid            = p->pid;
258                 __entry->prio           = p->prio;
259         ),
260
261         TP_printk("task %s:%d [%d]",
262                   __entry->comm, __entry->pid, __entry->prio)
263 );
264
265 /*
266  * Tracepoint for a waiting task:
267  */
268 TRACE_EVENT(sched_process_wait,
269
270         TP_PROTO(struct pid *pid),
271
272         TP_ARGS(pid),
273
274         TP_STRUCT__entry(
275                 __array(        char,   comm,   TASK_COMM_LEN   )
276                 __field(        pid_t,  pid                     )
277                 __field(        int,    prio                    )
278         ),
279
280         TP_fast_assign(
281                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
282                 __entry->pid            = pid_nr(pid);
283                 __entry->prio           = current->prio;
284         ),
285
286         TP_printk("task %s:%d [%d]",
287                   __entry->comm, __entry->pid, __entry->prio)
288 );
289
290 /*
291  * Tracepoint for do_fork:
292  */
293 TRACE_EVENT(sched_process_fork,
294
295         TP_PROTO(struct task_struct *parent, struct task_struct *child),
296
297         TP_ARGS(parent, child),
298
299         TP_STRUCT__entry(
300                 __array(        char,   parent_comm,    TASK_COMM_LEN   )
301                 __field(        pid_t,  parent_pid                      )
302                 __array(        char,   child_comm,     TASK_COMM_LEN   )
303                 __field(        pid_t,  child_pid                       )
304         ),
305
306         TP_fast_assign(
307                 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
308                 __entry->parent_pid     = parent->pid;
309                 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
310                 __entry->child_pid      = child->pid;
311         ),
312
313         TP_printk("parent %s:%d  child %s:%d",
314                 __entry->parent_comm, __entry->parent_pid,
315                 __entry->child_comm, __entry->child_pid)
316 );
317
318 /*
319  * Tracepoint for sending a signal:
320  */
321 TRACE_EVENT(sched_signal_send,
322
323         TP_PROTO(int sig, struct task_struct *p),
324
325         TP_ARGS(sig, p),
326
327         TP_STRUCT__entry(
328                 __field(        int,    sig                     )
329                 __array(        char,   comm,   TASK_COMM_LEN   )
330                 __field(        pid_t,  pid                     )
331         ),
332
333         TP_fast_assign(
334                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
335                 __entry->pid    = p->pid;
336                 __entry->sig    = sig;
337         ),
338
339         TP_printk("sig: %d  task %s:%d",
340                   __entry->sig, __entry->comm, __entry->pid)
341 );
342
343 #endif /* _TRACE_SCHED_H */
344
345 /* This part must be outside protection */
346 #include <trace/define_trace.h>