2 #define TRACE_SYSTEM sched
4 #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/sched.h>
8 #include <linux/tracepoint.h>
11 * Tracepoint for calling kthread_stop, performed to end a kthread:
13 TRACE_EVENT(sched_kthread_stop,
15 TP_PROTO(struct task_struct *t),
20 __array( char, comm, TASK_COMM_LEN )
25 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
26 __entry->pid = t->pid;
29 TP_printk("task %s:%d", __entry->comm, __entry->pid)
33 * Tracepoint for the return value of the kthread stopping:
35 TRACE_EVENT(sched_kthread_stop_ret,
49 TP_printk("ret %d", __entry->ret)
53 * Tracepoint for waiting on task to unschedule:
55 * (NOTE: the 'rq' argument is not used by generic trace events,
56 * but used by the latency tracer plugin. )
58 TRACE_EVENT(sched_wait_task,
60 TP_PROTO(struct rq *rq, struct task_struct *p),
65 __array( char, comm, TASK_COMM_LEN )
71 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
72 __entry->pid = p->pid;
73 __entry->prio = p->prio;
76 TP_printk("task %s:%d [%d]",
77 __entry->comm, __entry->pid, __entry->prio)
81 * Tracepoint for waking up a task:
83 * (NOTE: the 'rq' argument is not used by generic trace events,
84 * but used by the latency tracer plugin. )
86 TRACE_EVENT(sched_wakeup,
88 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
90 TP_ARGS(rq, p, success),
93 __array( char, comm, TASK_COMM_LEN )
96 __field( int, success )
100 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
101 __entry->pid = p->pid;
102 __entry->prio = p->prio;
103 __entry->success = success;
106 TP_printk("task %s:%d [%d] success=%d",
107 __entry->comm, __entry->pid, __entry->prio,
112 * Tracepoint for waking up a new task:
114 * (NOTE: the 'rq' argument is not used by generic trace events,
115 * but used by the latency tracer plugin. )
117 TRACE_EVENT(sched_wakeup_new,
119 TP_PROTO(struct rq *rq, struct task_struct *p, int success),
121 TP_ARGS(rq, p, success),
124 __array( char, comm, TASK_COMM_LEN )
125 __field( pid_t, pid )
127 __field( int, success )
131 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
132 __entry->pid = p->pid;
133 __entry->prio = p->prio;
134 __entry->success = success;
137 TP_printk("task %s:%d [%d] success=%d",
138 __entry->comm, __entry->pid, __entry->prio,
143 * Tracepoint for task switches, performed by the scheduler:
145 * (NOTE: the 'rq' argument is not used by generic trace events,
146 * but used by the latency tracer plugin. )
148 TRACE_EVENT(sched_switch,
150 TP_PROTO(struct rq *rq, struct task_struct *prev,
151 struct task_struct *next),
153 TP_ARGS(rq, prev, next),
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 )
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;
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" },
182 __entry->next_comm, __entry->next_pid, __entry->next_prio)
186 * Tracepoint for a task being migrated:
188 TRACE_EVENT(sched_migrate_task,
190 TP_PROTO(struct task_struct *p, int dest_cpu),
192 TP_ARGS(p, dest_cpu),
195 __array( char, comm, TASK_COMM_LEN )
196 __field( pid_t, pid )
198 __field( int, orig_cpu )
199 __field( int, dest_cpu )
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;
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)
216 * Tracepoint for freeing a task:
218 TRACE_EVENT(sched_process_free,
220 TP_PROTO(struct task_struct *p),
225 __array( char, comm, TASK_COMM_LEN )
226 __field( pid_t, pid )
231 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
232 __entry->pid = p->pid;
233 __entry->prio = p->prio;
236 TP_printk("task %s:%d [%d]",
237 __entry->comm, __entry->pid, __entry->prio)
241 * Tracepoint for a task exiting:
243 TRACE_EVENT(sched_process_exit,
245 TP_PROTO(struct task_struct *p),
250 __array( char, comm, TASK_COMM_LEN )
251 __field( pid_t, pid )
256 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
257 __entry->pid = p->pid;
258 __entry->prio = p->prio;
261 TP_printk("task %s:%d [%d]",
262 __entry->comm, __entry->pid, __entry->prio)
266 * Tracepoint for a waiting task:
268 TRACE_EVENT(sched_process_wait,
270 TP_PROTO(struct pid *pid),
275 __array( char, comm, TASK_COMM_LEN )
276 __field( pid_t, pid )
281 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
282 __entry->pid = pid_nr(pid);
283 __entry->prio = current->prio;
286 TP_printk("task %s:%d [%d]",
287 __entry->comm, __entry->pid, __entry->prio)
291 * Tracepoint for do_fork:
293 TRACE_EVENT(sched_process_fork,
295 TP_PROTO(struct task_struct *parent, struct task_struct *child),
297 TP_ARGS(parent, child),
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 )
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;
313 TP_printk("parent %s:%d child %s:%d",
314 __entry->parent_comm, __entry->parent_pid,
315 __entry->child_comm, __entry->child_pid)
319 * Tracepoint for sending a signal:
321 TRACE_EVENT(sched_signal_send,
323 TP_PROTO(int sig, struct task_struct *p),
329 __array( char, comm, TASK_COMM_LEN )
330 __field( pid_t, pid )
334 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
335 __entry->pid = p->pid;
339 TP_printk("sig: %d task %s:%d",
340 __entry->sig, __entry->comm, __entry->pid)
343 #endif /* _TRACE_SCHED_H */
345 /* This part must be outside protection */
346 #include <trace/define_trace.h>