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