9bb0a264ad7d26667e1982d691a157ac1f923eaf
[firefly-linux-kernel-4.4.55.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 #include <linux/binfmts.h>
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_fast_assign(
26                 memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
27                 __entry->pid    = t->pid;
28         ),
29
30         TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
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_fast_assign(
47                 __entry->ret    = ret;
48         ),
49
50         TP_printk("ret=%d", __entry->ret)
51 );
52
53 /*
54  * Tracepoint for waking up a task:
55  */
56 DECLARE_EVENT_CLASS(sched_wakeup_template,
57
58         TP_PROTO(struct task_struct *p),
59
60         TP_ARGS(__perf_task(p)),
61
62         TP_STRUCT__entry(
63                 __array(        char,   comm,   TASK_COMM_LEN   )
64                 __field(        pid_t,  pid                     )
65                 __field(        int,    prio                    )
66                 __field(        int,    success                 )
67                 __field(        int,    target_cpu              )
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                 __entry->success        = 1; /* rudiment, kill when possible */
75                 __entry->target_cpu     = task_cpu(p);
76         ),
77
78         TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d",
79                   __entry->comm, __entry->pid, __entry->prio,
80                   __entry->target_cpu)
81 );
82
83 /*
84  * Tracepoint called when waking a task; this tracepoint is guaranteed to be
85  * called from the waking context.
86  */
87 DEFINE_EVENT(sched_wakeup_template, sched_waking,
88              TP_PROTO(struct task_struct *p),
89              TP_ARGS(p));
90
91 /*
92  * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG.
93  * It it not always called from the waking context.
94  */
95 DEFINE_EVENT(sched_wakeup_template, sched_wakeup,
96              TP_PROTO(struct task_struct *p),
97              TP_ARGS(p));
98
99 /*
100  * Tracepoint for waking up a new task:
101  */
102 DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
103              TP_PROTO(struct task_struct *p),
104              TP_ARGS(p));
105
106 #ifdef CREATE_TRACE_POINTS
107 static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
108 {
109 #ifdef CONFIG_SCHED_DEBUG
110         BUG_ON(p != current);
111 #endif /* CONFIG_SCHED_DEBUG */
112
113         /*
114          * Preemption ignores task state, therefore preempted tasks are always
115          * RUNNING (we will not have dequeued if state != RUNNING).
116          */
117         return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state;
118 }
119 #endif /* CREATE_TRACE_POINTS */
120
121 /*
122  * Tracepoint for task switches, performed by the scheduler:
123  */
124 TRACE_EVENT(sched_switch,
125
126         TP_PROTO(bool preempt,
127                  struct task_struct *prev,
128                  struct task_struct *next),
129
130         TP_ARGS(preempt, prev, next),
131
132         TP_STRUCT__entry(
133                 __array(        char,   prev_comm,      TASK_COMM_LEN   )
134                 __field(        pid_t,  prev_pid                        )
135                 __field(        int,    prev_prio                       )
136                 __field(        long,   prev_state                      )
137                 __array(        char,   next_comm,      TASK_COMM_LEN   )
138                 __field(        pid_t,  next_pid                        )
139                 __field(        int,    next_prio                       )
140         ),
141
142         TP_fast_assign(
143                 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
144                 __entry->prev_pid       = prev->pid;
145                 __entry->prev_prio      = prev->prio;
146                 __entry->prev_state     = __trace_sched_switch_state(preempt, prev);
147                 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
148                 __entry->next_pid       = next->pid;
149                 __entry->next_prio      = next->prio;
150         ),
151
152         TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d",
153                 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
154                 __entry->prev_state & (TASK_STATE_MAX-1) ?
155                   __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|",
156                                 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
157                                 { 16, "Z" }, { 32, "X" }, { 64, "x" },
158                                 { 128, "K" }, { 256, "W" }, { 512, "P" },
159                                 { 1024, "N" }) : "R",
160                 __entry->prev_state & TASK_STATE_MAX ? "+" : "",
161                 __entry->next_comm, __entry->next_pid, __entry->next_prio)
162 );
163
164 /*
165  * Tracepoint for a task being migrated:
166  */
167 TRACE_EVENT(sched_migrate_task,
168
169         TP_PROTO(struct task_struct *p, int dest_cpu),
170
171         TP_ARGS(p, dest_cpu),
172
173         TP_STRUCT__entry(
174                 __array(        char,   comm,   TASK_COMM_LEN   )
175                 __field(        pid_t,  pid                     )
176                 __field(        int,    prio                    )
177                 __field(        int,    orig_cpu                )
178                 __field(        int,    dest_cpu                )
179         ),
180
181         TP_fast_assign(
182                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
183                 __entry->pid            = p->pid;
184                 __entry->prio           = p->prio;
185                 __entry->orig_cpu       = task_cpu(p);
186                 __entry->dest_cpu       = dest_cpu;
187         ),
188
189         TP_printk("comm=%s pid=%d prio=%d orig_cpu=%d dest_cpu=%d",
190                   __entry->comm, __entry->pid, __entry->prio,
191                   __entry->orig_cpu, __entry->dest_cpu)
192 );
193
194 /*
195  * Tracepoint for a CPU going offline/online:
196  */
197 TRACE_EVENT(sched_cpu_hotplug,
198
199         TP_PROTO(int affected_cpu, int error, int status),
200
201         TP_ARGS(affected_cpu, error, status),
202
203         TP_STRUCT__entry(
204                 __field(        int,    affected_cpu            )
205                 __field(        int,    error                   )
206                 __field(        int,    status                  )
207         ),
208
209         TP_fast_assign(
210                 __entry->affected_cpu   = affected_cpu;
211                 __entry->error          = error;
212                 __entry->status         = status;
213         ),
214
215         TP_printk("cpu %d %s error=%d", __entry->affected_cpu,
216                 __entry->status ? "online" : "offline", __entry->error)
217 );
218
219 DECLARE_EVENT_CLASS(sched_process_template,
220
221         TP_PROTO(struct task_struct *p),
222
223         TP_ARGS(p),
224
225         TP_STRUCT__entry(
226                 __array(        char,   comm,   TASK_COMM_LEN   )
227                 __field(        pid_t,  pid                     )
228                 __field(        int,    prio                    )
229         ),
230
231         TP_fast_assign(
232                 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
233                 __entry->pid            = p->pid;
234                 __entry->prio           = p->prio;
235         ),
236
237         TP_printk("comm=%s pid=%d prio=%d",
238                   __entry->comm, __entry->pid, __entry->prio)
239 );
240
241 /*
242  * Tracepoint for freeing a task:
243  */
244 DEFINE_EVENT(sched_process_template, sched_process_free,
245              TP_PROTO(struct task_struct *p),
246              TP_ARGS(p));
247
248
249 /*
250  * Tracepoint for a task exiting:
251  */
252 DEFINE_EVENT(sched_process_template, sched_process_exit,
253              TP_PROTO(struct task_struct *p),
254              TP_ARGS(p));
255
256 /*
257  * Tracepoint for waiting on task to unschedule:
258  */
259 DEFINE_EVENT(sched_process_template, sched_wait_task,
260         TP_PROTO(struct task_struct *p),
261         TP_ARGS(p));
262
263 /*
264  * Tracepoint for a waiting task:
265  */
266 TRACE_EVENT(sched_process_wait,
267
268         TP_PROTO(struct pid *pid),
269
270         TP_ARGS(pid),
271
272         TP_STRUCT__entry(
273                 __array(        char,   comm,   TASK_COMM_LEN   )
274                 __field(        pid_t,  pid                     )
275                 __field(        int,    prio                    )
276         ),
277
278         TP_fast_assign(
279                 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
280                 __entry->pid            = pid_nr(pid);
281                 __entry->prio           = current->prio;
282         ),
283
284         TP_printk("comm=%s pid=%d prio=%d",
285                   __entry->comm, __entry->pid, __entry->prio)
286 );
287
288 /*
289  * Tracepoint for do_fork:
290  */
291 TRACE_EVENT(sched_process_fork,
292
293         TP_PROTO(struct task_struct *parent, struct task_struct *child),
294
295         TP_ARGS(parent, child),
296
297         TP_STRUCT__entry(
298                 __array(        char,   parent_comm,    TASK_COMM_LEN   )
299                 __field(        pid_t,  parent_pid                      )
300                 __array(        char,   child_comm,     TASK_COMM_LEN   )
301                 __field(        pid_t,  child_pid                       )
302         ),
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         TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d",
312                 __entry->parent_comm, __entry->parent_pid,
313                 __entry->child_comm, __entry->child_pid)
314 );
315
316 /*
317  * Tracepoint for exec:
318  */
319 TRACE_EVENT(sched_process_exec,
320
321         TP_PROTO(struct task_struct *p, pid_t old_pid,
322                  struct linux_binprm *bprm),
323
324         TP_ARGS(p, old_pid, bprm),
325
326         TP_STRUCT__entry(
327                 __string(       filename,       bprm->filename  )
328                 __field(        pid_t,          pid             )
329                 __field(        pid_t,          old_pid         )
330         ),
331
332         TP_fast_assign(
333                 __assign_str(filename, bprm->filename);
334                 __entry->pid            = p->pid;
335                 __entry->old_pid        = old_pid;
336         ),
337
338         TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename),
339                   __entry->pid, __entry->old_pid)
340 );
341
342 /*
343  * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE
344  *     adding sched_stat support to SCHED_FIFO/RR would be welcome.
345  */
346 DECLARE_EVENT_CLASS(sched_stat_template,
347
348         TP_PROTO(struct task_struct *tsk, u64 delay),
349
350         TP_ARGS(__perf_task(tsk), __perf_count(delay)),
351
352         TP_STRUCT__entry(
353                 __array( char,  comm,   TASK_COMM_LEN   )
354                 __field( pid_t, pid                     )
355                 __field( u64,   delay                   )
356         ),
357
358         TP_fast_assign(
359                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
360                 __entry->pid    = tsk->pid;
361                 __entry->delay  = delay;
362         ),
363
364         TP_printk("comm=%s pid=%d delay=%Lu [ns]",
365                         __entry->comm, __entry->pid,
366                         (unsigned long long)__entry->delay)
367 );
368
369
370 /*
371  * Tracepoint for accounting wait time (time the task is runnable
372  * but not actually running due to scheduler contention).
373  */
374 DEFINE_EVENT(sched_stat_template, sched_stat_wait,
375              TP_PROTO(struct task_struct *tsk, u64 delay),
376              TP_ARGS(tsk, delay));
377
378 /*
379  * Tracepoint for accounting sleep time (time the task is not runnable,
380  * including iowait, see below).
381  */
382 DEFINE_EVENT(sched_stat_template, sched_stat_sleep,
383              TP_PROTO(struct task_struct *tsk, u64 delay),
384              TP_ARGS(tsk, delay));
385
386 /*
387  * Tracepoint for accounting iowait time (time the task is not runnable
388  * due to waiting on IO to complete).
389  */
390 DEFINE_EVENT(sched_stat_template, sched_stat_iowait,
391              TP_PROTO(struct task_struct *tsk, u64 delay),
392              TP_ARGS(tsk, delay));
393
394 /*
395  * Tracepoint for accounting blocked time (time the task is in uninterruptible).
396  */
397 DEFINE_EVENT(sched_stat_template, sched_stat_blocked,
398              TP_PROTO(struct task_struct *tsk, u64 delay),
399              TP_ARGS(tsk, delay));
400
401 /*
402  * Tracepoint for recording the cause of uninterruptible sleep.
403  */
404 TRACE_EVENT(sched_blocked_reason,
405
406         TP_PROTO(struct task_struct *tsk),
407
408         TP_ARGS(tsk),
409
410         TP_STRUCT__entry(
411                 __field( pid_t, pid     )
412                 __field( void*, caller  )
413                 __field( bool, io_wait  )
414         ),
415
416         TP_fast_assign(
417                 __entry->pid    = tsk->pid;
418                 __entry->caller = (void*)get_wchan(tsk);
419                 __entry->io_wait = tsk->in_iowait;
420         ),
421
422         TP_printk("pid=%d iowait=%d caller=%pS", __entry->pid, __entry->io_wait, __entry->caller)
423 );
424
425 /*
426  * Tracepoint for accounting runtime (time the task is executing
427  * on a CPU).
428  */
429 DECLARE_EVENT_CLASS(sched_stat_runtime,
430
431         TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
432
433         TP_ARGS(tsk, __perf_count(runtime), vruntime),
434
435         TP_STRUCT__entry(
436                 __array( char,  comm,   TASK_COMM_LEN   )
437                 __field( pid_t, pid                     )
438                 __field( u64,   runtime                 )
439                 __field( u64,   vruntime                        )
440         ),
441
442         TP_fast_assign(
443                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
444                 __entry->pid            = tsk->pid;
445                 __entry->runtime        = runtime;
446                 __entry->vruntime       = vruntime;
447         ),
448
449         TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]",
450                         __entry->comm, __entry->pid,
451                         (unsigned long long)__entry->runtime,
452                         (unsigned long long)__entry->vruntime)
453 );
454
455 DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime,
456              TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime),
457              TP_ARGS(tsk, runtime, vruntime));
458
459 /*
460  * Tracepoint for showing priority inheritance modifying a tasks
461  * priority.
462  */
463 TRACE_EVENT(sched_pi_setprio,
464
465         TP_PROTO(struct task_struct *tsk, int newprio),
466
467         TP_ARGS(tsk, newprio),
468
469         TP_STRUCT__entry(
470                 __array( char,  comm,   TASK_COMM_LEN   )
471                 __field( pid_t, pid                     )
472                 __field( int,   oldprio                 )
473                 __field( int,   newprio                 )
474         ),
475
476         TP_fast_assign(
477                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
478                 __entry->pid            = tsk->pid;
479                 __entry->oldprio        = tsk->prio;
480                 __entry->newprio        = newprio;
481         ),
482
483         TP_printk("comm=%s pid=%d oldprio=%d newprio=%d",
484                         __entry->comm, __entry->pid,
485                         __entry->oldprio, __entry->newprio)
486 );
487
488 #ifdef CONFIG_DETECT_HUNG_TASK
489 TRACE_EVENT(sched_process_hang,
490         TP_PROTO(struct task_struct *tsk),
491         TP_ARGS(tsk),
492
493         TP_STRUCT__entry(
494                 __array( char,  comm,   TASK_COMM_LEN   )
495                 __field( pid_t, pid                     )
496         ),
497
498         TP_fast_assign(
499                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
500                 __entry->pid = tsk->pid;
501         ),
502
503         TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid)
504 );
505 #endif /* CONFIG_DETECT_HUNG_TASK */
506
507 DECLARE_EVENT_CLASS(sched_move_task_template,
508
509         TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
510
511         TP_ARGS(tsk, src_cpu, dst_cpu),
512
513         TP_STRUCT__entry(
514                 __field( pid_t, pid                     )
515                 __field( pid_t, tgid                    )
516                 __field( pid_t, ngid                    )
517                 __field( int,   src_cpu                 )
518                 __field( int,   src_nid                 )
519                 __field( int,   dst_cpu                 )
520                 __field( int,   dst_nid                 )
521         ),
522
523         TP_fast_assign(
524                 __entry->pid            = task_pid_nr(tsk);
525                 __entry->tgid           = task_tgid_nr(tsk);
526                 __entry->ngid           = task_numa_group_id(tsk);
527                 __entry->src_cpu        = src_cpu;
528                 __entry->src_nid        = cpu_to_node(src_cpu);
529                 __entry->dst_cpu        = dst_cpu;
530                 __entry->dst_nid        = cpu_to_node(dst_cpu);
531         ),
532
533         TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d",
534                         __entry->pid, __entry->tgid, __entry->ngid,
535                         __entry->src_cpu, __entry->src_nid,
536                         __entry->dst_cpu, __entry->dst_nid)
537 );
538
539 /*
540  * Tracks migration of tasks from one runqueue to another. Can be used to
541  * detect if automatic NUMA balancing is bouncing between nodes
542  */
543 DEFINE_EVENT(sched_move_task_template, sched_move_numa,
544         TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
545
546         TP_ARGS(tsk, src_cpu, dst_cpu)
547 );
548
549 DEFINE_EVENT(sched_move_task_template, sched_stick_numa,
550         TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu),
551
552         TP_ARGS(tsk, src_cpu, dst_cpu)
553 );
554
555 TRACE_EVENT(sched_swap_numa,
556
557         TP_PROTO(struct task_struct *src_tsk, int src_cpu,
558                  struct task_struct *dst_tsk, int dst_cpu),
559
560         TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu),
561
562         TP_STRUCT__entry(
563                 __field( pid_t, src_pid                 )
564                 __field( pid_t, src_tgid                )
565                 __field( pid_t, src_ngid                )
566                 __field( int,   src_cpu                 )
567                 __field( int,   src_nid                 )
568                 __field( pid_t, dst_pid                 )
569                 __field( pid_t, dst_tgid                )
570                 __field( pid_t, dst_ngid                )
571                 __field( int,   dst_cpu                 )
572                 __field( int,   dst_nid                 )
573         ),
574
575         TP_fast_assign(
576                 __entry->src_pid        = task_pid_nr(src_tsk);
577                 __entry->src_tgid       = task_tgid_nr(src_tsk);
578                 __entry->src_ngid       = task_numa_group_id(src_tsk);
579                 __entry->src_cpu        = src_cpu;
580                 __entry->src_nid        = cpu_to_node(src_cpu);
581                 __entry->dst_pid        = task_pid_nr(dst_tsk);
582                 __entry->dst_tgid       = task_tgid_nr(dst_tsk);
583                 __entry->dst_ngid       = task_numa_group_id(dst_tsk);
584                 __entry->dst_cpu        = dst_cpu;
585                 __entry->dst_nid        = cpu_to_node(dst_cpu);
586         ),
587
588         TP_printk("src_pid=%d src_tgid=%d src_ngid=%d src_cpu=%d src_nid=%d dst_pid=%d dst_tgid=%d dst_ngid=%d dst_cpu=%d dst_nid=%d",
589                         __entry->src_pid, __entry->src_tgid, __entry->src_ngid,
590                         __entry->src_cpu, __entry->src_nid,
591                         __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid,
592                         __entry->dst_cpu, __entry->dst_nid)
593 );
594
595 /*
596  * Tracepoint for waking a polling cpu without an IPI.
597  */
598 TRACE_EVENT(sched_wake_idle_without_ipi,
599
600         TP_PROTO(int cpu),
601
602         TP_ARGS(cpu),
603
604         TP_STRUCT__entry(
605                 __field(        int,    cpu     )
606         ),
607
608         TP_fast_assign(
609                 __entry->cpu    = cpu;
610         ),
611
612         TP_printk("cpu=%d", __entry->cpu)
613 );
614
615 TRACE_EVENT(sched_contrib_scale_f,
616
617         TP_PROTO(int cpu, unsigned long freq_scale_factor,
618                  unsigned long cpu_scale_factor),
619
620         TP_ARGS(cpu, freq_scale_factor, cpu_scale_factor),
621
622         TP_STRUCT__entry(
623                 __field(int, cpu)
624                 __field(unsigned long, freq_scale_factor)
625                 __field(unsigned long, cpu_scale_factor)
626         ),
627
628         TP_fast_assign(
629                 __entry->cpu = cpu;
630                 __entry->freq_scale_factor = freq_scale_factor;
631                 __entry->cpu_scale_factor = cpu_scale_factor;
632         ),
633
634         TP_printk("cpu=%d freq_scale_factor=%lu cpu_scale_factor=%lu",
635                   __entry->cpu, __entry->freq_scale_factor,
636                   __entry->cpu_scale_factor)
637 );
638
639 /*
640  * Tracepoint for accounting sched averages for tasks.
641  */
642 TRACE_EVENT(sched_load_avg_task,
643
644         TP_PROTO(struct task_struct *tsk, struct sched_avg *avg),
645
646         TP_ARGS(tsk, avg),
647
648         TP_STRUCT__entry(
649                 __array( char,  comm,   TASK_COMM_LEN           )
650                 __field( pid_t, pid                             )
651                 __field( int,   cpu                             )
652                 __field( unsigned long, load_avg                )
653                 __field( unsigned long, util_avg                )
654                 __field( u64,           load_sum                )
655                 __field( u32,           util_sum                )
656                 __field( u32,           period_contrib          )
657         ),
658
659         TP_fast_assign(
660                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
661                 __entry->pid                    = tsk->pid;
662                 __entry->cpu                    = task_cpu(tsk);
663                 __entry->load_avg               = avg->load_avg;
664                 __entry->util_avg               = avg->util_avg;
665                 __entry->load_sum               = avg->load_sum;
666                 __entry->util_sum               = avg->util_sum;
667                 __entry->period_contrib         = avg->period_contrib;
668         ),
669
670         TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu load_sum=%llu"
671                   " util_sum=%u period_contrib=%u",
672                   __entry->comm,
673                   __entry->pid,
674                   __entry->cpu,
675                   __entry->load_avg,
676                   __entry->util_avg,
677                   (u64)__entry->load_sum,
678                   (u32)__entry->util_sum,
679                   (u32)__entry->period_contrib)
680 );
681
682 /*
683  * Tracepoint for accounting sched averages for cpus.
684  */
685 TRACE_EVENT(sched_load_avg_cpu,
686
687         TP_PROTO(int cpu, struct cfs_rq *cfs_rq),
688
689         TP_ARGS(cpu, cfs_rq),
690
691         TP_STRUCT__entry(
692                 __field( int,   cpu                             )
693                 __field( unsigned long, load_avg                )
694                 __field( unsigned long, util_avg                )
695         ),
696
697         TP_fast_assign(
698                 __entry->cpu                    = cpu;
699                 __entry->load_avg               = cfs_rq->avg.load_avg;
700                 __entry->util_avg               = cfs_rq->avg.util_avg;
701         ),
702
703         TP_printk("cpu=%d load_avg=%lu util_avg=%lu",
704                   __entry->cpu, __entry->load_avg, __entry->util_avg)
705 );
706
707 /*
708  * Tracepoint for sched_tune_config settings
709  */
710 TRACE_EVENT(sched_tune_config,
711
712         TP_PROTO(int boost),
713
714         TP_ARGS(boost),
715
716         TP_STRUCT__entry(
717                 __field( int,   boost           )
718         ),
719
720         TP_fast_assign(
721                 __entry->boost  = boost;
722         ),
723
724         TP_printk("boost=%d ", __entry->boost)
725 );
726
727 /*
728  * Tracepoint for accounting CPU  boosted utilization
729  */
730 TRACE_EVENT(sched_boost_cpu,
731
732         TP_PROTO(int cpu, unsigned long util, unsigned long margin),
733
734         TP_ARGS(cpu, util, margin),
735
736         TP_STRUCT__entry(
737                 __field( int,           cpu                     )
738                 __field( unsigned long, util                    )
739                 __field( unsigned long, margin                  )
740         ),
741
742         TP_fast_assign(
743                 __entry->cpu    = cpu;
744                 __entry->util   = util;
745                 __entry->margin = margin;
746         ),
747
748         TP_printk("cpu=%d util=%lu margin=%lu",
749                   __entry->cpu,
750                   __entry->util,
751                   __entry->margin)
752 );
753
754 /*
755  * Tracepoint for schedtune_tasks_update
756  */
757 TRACE_EVENT(sched_tune_tasks_update,
758
759         TP_PROTO(struct task_struct *tsk, int cpu, int tasks, int idx,
760                 unsigned int boost, unsigned int max_boost),
761
762         TP_ARGS(tsk, cpu, tasks, idx, boost, max_boost),
763
764         TP_STRUCT__entry(
765                 __array( char,  comm,   TASK_COMM_LEN   )
766                 __field( pid_t,         pid             )
767                 __field( int,           cpu             )
768                 __field( int,           tasks           )
769                 __field( int,           idx             )
770                 __field( unsigned int,  boost           )
771                 __field( unsigned int,  max_boost       )
772         ),
773
774         TP_fast_assign(
775                 memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
776                 __entry->pid            = tsk->pid;
777                 __entry->cpu            = cpu;
778                 __entry->tasks          = tasks;
779                 __entry->idx            = idx;
780                 __entry->boost          = boost;
781                 __entry->max_boost      = max_boost;
782         ),
783
784         TP_printk("pid=%d comm=%s "
785                         "cpu=%d tasks=%d idx=%d boost=%u max_boost=%u",
786                 __entry->pid, __entry->comm,
787                 __entry->cpu, __entry->tasks, __entry->idx,
788                 __entry->boost, __entry->max_boost)
789 );
790
791 /*
792  * Tracepoint for schedtune_boostgroup_update
793  */
794 TRACE_EVENT(sched_tune_boostgroup_update,
795
796         TP_PROTO(int cpu, int variation, int max_boost),
797
798         TP_ARGS(cpu, variation, max_boost),
799
800         TP_STRUCT__entry(
801                 __field( int,   cpu             )
802                 __field( int,   variation       )
803                 __field( int,   max_boost       )
804         ),
805
806         TP_fast_assign(
807                 __entry->cpu            = cpu;
808                 __entry->variation      = variation;
809                 __entry->max_boost      = max_boost;
810         ),
811
812         TP_printk("cpu=%d variation=%d max_boost=%d",
813                 __entry->cpu, __entry->variation, __entry->max_boost)
814 );
815
816 #endif /* _TRACE_SCHED_H */
817
818 /* This part must be outside protection */
819 #include <trace/define_trace.h>