1 #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
4 #include <linux/sched.h>
5 #include <linux/tracepoint.h>
8 #define TRACE_SYSTEM sched
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 __array( char, next_comm, TASK_COMM_LEN )
160 __field( pid_t, next_pid )
161 __field( int, next_prio )
165 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
166 __entry->prev_pid = prev->pid;
167 __entry->prev_prio = prev->prio;
168 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
169 __entry->next_pid = next->pid;
170 __entry->next_prio = next->prio;
173 TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
174 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
175 __entry->next_comm, __entry->next_pid, __entry->next_prio)
179 * Tracepoint for a task being migrated:
181 TRACE_EVENT(sched_migrate_task,
183 TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
185 TP_ARGS(p, orig_cpu, dest_cpu),
188 __array( char, comm, TASK_COMM_LEN )
189 __field( pid_t, pid )
191 __field( int, orig_cpu )
192 __field( int, dest_cpu )
196 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
197 __entry->pid = p->pid;
198 __entry->prio = p->prio;
199 __entry->orig_cpu = orig_cpu;
200 __entry->dest_cpu = dest_cpu;
203 TP_printk("task %s:%d [%d] from: %d to: %d",
204 __entry->comm, __entry->pid, __entry->prio,
205 __entry->orig_cpu, __entry->dest_cpu)
209 * Tracepoint for freeing a task:
211 TRACE_EVENT(sched_process_free,
213 TP_PROTO(struct task_struct *p),
218 __array( char, comm, TASK_COMM_LEN )
219 __field( pid_t, pid )
224 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
225 __entry->pid = p->pid;
226 __entry->prio = p->prio;
229 TP_printk("task %s:%d [%d]",
230 __entry->comm, __entry->pid, __entry->prio)
234 * Tracepoint for a task exiting:
236 TRACE_EVENT(sched_process_exit,
238 TP_PROTO(struct task_struct *p),
243 __array( char, comm, TASK_COMM_LEN )
244 __field( pid_t, pid )
249 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
250 __entry->pid = p->pid;
251 __entry->prio = p->prio;
254 TP_printk("task %s:%d [%d]",
255 __entry->comm, __entry->pid, __entry->prio)
259 * Tracepoint for a waiting task:
261 TRACE_EVENT(sched_process_wait,
263 TP_PROTO(struct pid *pid),
268 __array( char, comm, TASK_COMM_LEN )
269 __field( pid_t, pid )
274 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
275 __entry->pid = pid_nr(pid);
276 __entry->prio = current->prio;
279 TP_printk("task %s:%d [%d]",
280 __entry->comm, __entry->pid, __entry->prio)
284 * Tracepoint for do_fork:
286 TRACE_EVENT(sched_process_fork,
288 TP_PROTO(struct task_struct *parent, struct task_struct *child),
290 TP_ARGS(parent, child),
293 __array( char, parent_comm, TASK_COMM_LEN )
294 __field( pid_t, parent_pid )
295 __array( char, child_comm, TASK_COMM_LEN )
296 __field( pid_t, child_pid )
300 memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
301 __entry->parent_pid = parent->pid;
302 memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
303 __entry->child_pid = child->pid;
306 TP_printk("parent %s:%d child %s:%d",
307 __entry->parent_comm, __entry->parent_pid,
308 __entry->child_comm, __entry->child_pid)
312 * Tracepoint for sending a signal:
314 TRACE_EVENT(sched_signal_send,
316 TP_PROTO(int sig, struct task_struct *p),
322 __array( char, comm, TASK_COMM_LEN )
323 __field( pid_t, pid )
327 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
328 __entry->pid = p->pid;
332 TP_printk("sig: %d task %s:%d",
333 __entry->sig, __entry->comm, __entry->pid)
336 #endif /* _TRACE_SCHED_H */
338 /* This part must be outside protection */
339 #include <trace/define_trace.h>