Li Zefan | d0b6e04 | 2009-07-13 10:33:21 +0800 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM sched |
| 3 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 4 | #if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ) |
Mathieu Desnoyers | 0a16b60 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 5 | #define _TRACE_SCHED_H |
| 6 | |
| 7 | #include <linux/sched.h> |
| 8 | #include <linux/tracepoint.h> |
David Smith | 4ff16c2 | 2012-02-07 10:11:05 -0600 | [diff] [blame] | 9 | #include <linux/binfmts.h> |
Mathieu Desnoyers | 0a16b60 | 2008-07-18 12:16:17 -0400 | [diff] [blame] | 10 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 11 | struct rq; |
| 12 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 13 | /* |
| 14 | * Tracepoint for calling kthread_stop, performed to end a kthread: |
| 15 | */ |
| 16 | TRACE_EVENT(sched_kthread_stop, |
| 17 | |
| 18 | TP_PROTO(struct task_struct *t), |
| 19 | |
| 20 | TP_ARGS(t), |
| 21 | |
| 22 | TP_STRUCT__entry( |
| 23 | __array( char, comm, TASK_COMM_LEN ) |
| 24 | __field( pid_t, pid ) |
| 25 | ), |
| 26 | |
| 27 | TP_fast_assign( |
| 28 | memcpy(__entry->comm, t->comm, TASK_COMM_LEN); |
| 29 | __entry->pid = t->pid; |
| 30 | ), |
| 31 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 32 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 33 | ); |
| 34 | |
| 35 | /* |
| 36 | * Tracepoint for the return value of the kthread stopping: |
| 37 | */ |
| 38 | TRACE_EVENT(sched_kthread_stop_ret, |
| 39 | |
| 40 | TP_PROTO(int ret), |
| 41 | |
| 42 | TP_ARGS(ret), |
| 43 | |
| 44 | TP_STRUCT__entry( |
| 45 | __field( int, ret ) |
| 46 | ), |
| 47 | |
| 48 | TP_fast_assign( |
| 49 | __entry->ret = ret; |
| 50 | ), |
| 51 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 52 | TP_printk("ret=%d", __entry->ret) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 53 | ); |
| 54 | |
| 55 | /* |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 56 | * Tracepoint for task enqueue/dequeue: |
| 57 | */ |
| 58 | TRACE_EVENT(sched_enq_deq_task, |
| 59 | |
| 60 | TP_PROTO(struct task_struct *p, bool enqueue, unsigned int cpus_allowed), |
| 61 | |
| 62 | TP_ARGS(p, enqueue, cpus_allowed), |
| 63 | |
| 64 | TP_STRUCT__entry( |
| 65 | __array( char, comm, TASK_COMM_LEN ) |
| 66 | __field( pid_t, pid ) |
| 67 | __field( int, prio ) |
| 68 | __field( int, cpu ) |
| 69 | __field( bool, enqueue ) |
| 70 | __field(unsigned int, nr_running ) |
| 71 | __field(unsigned long, cpu_load ) |
| 72 | __field(unsigned int, rt_nr_running ) |
| 73 | __field(unsigned int, cpus_allowed ) |
| 74 | #ifdef CONFIG_SCHED_HMP |
| 75 | __field(unsigned int, demand ) |
| 76 | __field(unsigned int, pred_demand ) |
| 77 | #endif |
| 78 | ), |
| 79 | |
| 80 | TP_fast_assign( |
| 81 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 82 | __entry->pid = p->pid; |
| 83 | __entry->prio = p->prio; |
| 84 | __entry->cpu = task_cpu(p); |
| 85 | __entry->enqueue = enqueue; |
| 86 | __entry->nr_running = task_rq(p)->nr_running; |
| 87 | __entry->cpu_load = task_rq(p)->cpu_load[0]; |
| 88 | __entry->rt_nr_running = task_rq(p)->rt.rt_nr_running; |
| 89 | __entry->cpus_allowed = cpus_allowed; |
| 90 | #ifdef CONFIG_SCHED_HMP |
| 91 | __entry->demand = p->ravg.demand; |
| 92 | __entry->pred_demand = p->ravg.pred_demand; |
| 93 | #endif |
| 94 | ), |
| 95 | |
| 96 | TP_printk("cpu=%d %s comm=%s pid=%d prio=%d nr_running=%u cpu_load=%lu rt_nr_running=%u affine=%x" |
| 97 | #ifdef CONFIG_SCHED_HMP |
| 98 | " demand=%u pred_demand=%u" |
| 99 | #endif |
| 100 | , __entry->cpu, |
| 101 | __entry->enqueue ? "enqueue" : "dequeue", |
| 102 | __entry->comm, __entry->pid, |
| 103 | __entry->prio, __entry->nr_running, |
| 104 | __entry->cpu_load, __entry->rt_nr_running, __entry->cpus_allowed |
| 105 | #ifdef CONFIG_SCHED_HMP |
| 106 | , __entry->demand, __entry->pred_demand |
| 107 | #endif |
| 108 | ) |
| 109 | ); |
| 110 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 111 | #ifdef CONFIG_SCHED_WALT |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 112 | struct group_cpu_time; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 113 | extern const char *task_event_names[]; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 114 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 115 | #if defined(CREATE_TRACE_POINTS) && defined(CONFIG_SCHED_WALT) |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 116 | static inline void __window_data(u32 *dst, u32 *src) |
| 117 | { |
| 118 | if (src) |
| 119 | memcpy(dst, src, nr_cpu_ids * sizeof(u32)); |
| 120 | else |
| 121 | memset(dst, 0, nr_cpu_ids * sizeof(u32)); |
| 122 | } |
| 123 | |
| 124 | struct trace_seq; |
| 125 | const char *__window_print(struct trace_seq *p, const u32 *buf, int buf_len) |
| 126 | { |
| 127 | int i; |
| 128 | const char *ret = p->buffer + seq_buf_used(&p->seq); |
| 129 | |
| 130 | for (i = 0; i < buf_len; i++) |
| 131 | trace_seq_printf(p, "%u ", buf[i]); |
| 132 | |
| 133 | trace_seq_putc(p, 0); |
| 134 | |
| 135 | return ret; |
| 136 | } |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 137 | |
| 138 | static inline s64 __rq_update_sum(struct rq *rq, bool curr, bool new) |
| 139 | { |
| 140 | if (curr) |
| 141 | if (new) |
| 142 | return rq->nt_curr_runnable_sum; |
| 143 | else |
| 144 | return rq->curr_runnable_sum; |
| 145 | else |
| 146 | if (new) |
| 147 | return rq->nt_prev_runnable_sum; |
| 148 | else |
| 149 | return rq->prev_runnable_sum; |
| 150 | } |
| 151 | |
| 152 | static inline s64 __grp_update_sum(struct rq *rq, bool curr, bool new) |
| 153 | { |
| 154 | if (curr) |
| 155 | if (new) |
| 156 | return rq->grp_time.nt_curr_runnable_sum; |
| 157 | else |
| 158 | return rq->grp_time.curr_runnable_sum; |
| 159 | else |
| 160 | if (new) |
| 161 | return rq->grp_time.nt_prev_runnable_sum; |
| 162 | else |
| 163 | return rq->grp_time.prev_runnable_sum; |
| 164 | } |
| 165 | |
| 166 | static inline s64 |
| 167 | __get_update_sum(struct rq *rq, enum migrate_types migrate_type, |
| 168 | bool src, bool new, bool curr) |
| 169 | { |
| 170 | switch (migrate_type) { |
| 171 | case RQ_TO_GROUP: |
| 172 | if (src) |
| 173 | return __rq_update_sum(rq, curr, new); |
| 174 | else |
| 175 | return __grp_update_sum(rq, curr, new); |
| 176 | case GROUP_TO_RQ: |
| 177 | if (src) |
| 178 | return __grp_update_sum(rq, curr, new); |
| 179 | else |
| 180 | return __rq_update_sum(rq, curr, new); |
| 181 | default: |
| 182 | WARN_ON_ONCE(1); |
| 183 | return -1; |
| 184 | } |
| 185 | } |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 186 | #endif |
| 187 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 188 | TRACE_EVENT(sched_update_pred_demand, |
| 189 | |
| 190 | TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int pct, |
| 191 | unsigned int pred_demand), |
| 192 | |
| 193 | TP_ARGS(rq, p, runtime, pct, pred_demand), |
| 194 | |
| 195 | TP_STRUCT__entry( |
| 196 | __array( char, comm, TASK_COMM_LEN ) |
| 197 | __field( pid_t, pid ) |
| 198 | __field(unsigned int, runtime ) |
| 199 | __field( int, pct ) |
| 200 | __field(unsigned int, pred_demand ) |
| 201 | __array( u8, bucket, NUM_BUSY_BUCKETS) |
| 202 | __field( int, cpu ) |
| 203 | ), |
| 204 | |
| 205 | TP_fast_assign( |
| 206 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 207 | __entry->pid = p->pid; |
| 208 | __entry->runtime = runtime; |
| 209 | __entry->pct = pct; |
| 210 | __entry->pred_demand = pred_demand; |
| 211 | memcpy(__entry->bucket, p->ravg.busy_buckets, |
| 212 | NUM_BUSY_BUCKETS * sizeof(u8)); |
| 213 | __entry->cpu = rq->cpu; |
| 214 | ), |
| 215 | |
| 216 | TP_printk("%d (%s): runtime %u pct %d cpu %d pred_demand %u (buckets: %u %u %u %u %u %u %u %u %u %u)", |
| 217 | __entry->pid, __entry->comm, |
| 218 | __entry->runtime, __entry->pct, __entry->cpu, |
| 219 | __entry->pred_demand, __entry->bucket[0], __entry->bucket[1], |
| 220 | __entry->bucket[2], __entry->bucket[3],__entry->bucket[4], |
| 221 | __entry->bucket[5], __entry->bucket[6], __entry->bucket[7], |
| 222 | __entry->bucket[8], __entry->bucket[9]) |
| 223 | ); |
| 224 | |
| 225 | TRACE_EVENT(sched_update_history, |
| 226 | |
| 227 | TP_PROTO(struct rq *rq, struct task_struct *p, u32 runtime, int samples, |
| 228 | enum task_event evt), |
| 229 | |
| 230 | TP_ARGS(rq, p, runtime, samples, evt), |
| 231 | |
| 232 | TP_STRUCT__entry( |
| 233 | __array( char, comm, TASK_COMM_LEN ) |
| 234 | __field( pid_t, pid ) |
| 235 | __field(unsigned int, runtime ) |
| 236 | __field( int, samples ) |
| 237 | __field(enum task_event, evt ) |
| 238 | __field(unsigned int, demand ) |
| 239 | __field(unsigned int, pred_demand ) |
| 240 | __array( u32, hist, RAVG_HIST_SIZE_MAX) |
| 241 | __field(unsigned int, nr_big_tasks ) |
| 242 | __field( int, cpu ) |
| 243 | ), |
| 244 | |
| 245 | TP_fast_assign( |
| 246 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 247 | __entry->pid = p->pid; |
| 248 | __entry->runtime = runtime; |
| 249 | __entry->samples = samples; |
| 250 | __entry->evt = evt; |
| 251 | __entry->demand = p->ravg.demand; |
| 252 | __entry->pred_demand = p->ravg.pred_demand; |
| 253 | memcpy(__entry->hist, p->ravg.sum_history, |
| 254 | RAVG_HIST_SIZE_MAX * sizeof(u32)); |
| 255 | __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks; |
| 256 | __entry->cpu = rq->cpu; |
| 257 | ), |
| 258 | |
| 259 | TP_printk("%d (%s): runtime %u samples %d event %s demand %u pred_demand %u" |
| 260 | " (hist: %u %u %u %u %u) cpu %d nr_big %u", |
| 261 | __entry->pid, __entry->comm, |
| 262 | __entry->runtime, __entry->samples, |
| 263 | task_event_names[__entry->evt], |
| 264 | __entry->demand, __entry->pred_demand, |
| 265 | __entry->hist[0], __entry->hist[1], |
| 266 | __entry->hist[2], __entry->hist[3], |
| 267 | __entry->hist[4], __entry->cpu, __entry->nr_big_tasks) |
| 268 | ); |
| 269 | |
| 270 | TRACE_EVENT(sched_get_task_cpu_cycles, |
| 271 | |
| 272 | TP_PROTO(int cpu, int event, u64 cycles, u64 exec_time), |
| 273 | |
| 274 | TP_ARGS(cpu, event, cycles, exec_time), |
| 275 | |
| 276 | TP_STRUCT__entry( |
| 277 | __field(int, cpu ) |
| 278 | __field(int, event ) |
| 279 | __field(u64, cycles ) |
| 280 | __field(u64, exec_time ) |
| 281 | __field(u32, freq ) |
| 282 | __field(u32, legacy_freq ) |
| 283 | ), |
| 284 | |
| 285 | TP_fast_assign( |
| 286 | __entry->cpu = cpu; |
| 287 | __entry->event = event; |
| 288 | __entry->cycles = cycles; |
| 289 | __entry->exec_time = exec_time; |
| 290 | __entry->freq = cpu_cycles_to_freq(cycles, exec_time); |
| 291 | __entry->legacy_freq = cpu_cur_freq(cpu); |
| 292 | ), |
| 293 | |
| 294 | TP_printk("cpu=%d event=%d cycles=%llu exec_time=%llu freq=%u legacy_freq=%u", |
| 295 | __entry->cpu, __entry->event, __entry->cycles, |
| 296 | __entry->exec_time, __entry->freq, __entry->legacy_freq) |
| 297 | ); |
| 298 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 299 | TRACE_EVENT(sched_update_task_ravg, |
| 300 | |
| 301 | TP_PROTO(struct task_struct *p, struct rq *rq, enum task_event evt, |
| 302 | u64 wallclock, u64 irqtime, u64 cycles, u64 exec_time, |
| 303 | struct group_cpu_time *cpu_time), |
| 304 | |
| 305 | TP_ARGS(p, rq, evt, wallclock, irqtime, cycles, exec_time, cpu_time), |
| 306 | |
| 307 | TP_STRUCT__entry( |
| 308 | __array( char, comm, TASK_COMM_LEN ) |
| 309 | __field( pid_t, pid ) |
| 310 | __field( pid_t, cur_pid ) |
| 311 | __field(unsigned int, cur_freq ) |
| 312 | __field( u64, wallclock ) |
| 313 | __field( u64, mark_start ) |
| 314 | __field( u64, delta_m ) |
| 315 | __field( u64, win_start ) |
| 316 | __field( u64, delta ) |
| 317 | __field( u64, irqtime ) |
| 318 | __field(enum task_event, evt ) |
| 319 | __field(unsigned int, demand ) |
| 320 | __field(unsigned int, sum ) |
| 321 | __field( int, cpu ) |
| 322 | __field(unsigned int, pred_demand ) |
| 323 | __field( u64, rq_cs ) |
| 324 | __field( u64, rq_ps ) |
| 325 | __field( u64, grp_cs ) |
| 326 | __field( u64, grp_ps ) |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 327 | __field( u64, grp_nt_cs ) |
| 328 | __field( u64, grp_nt_ps ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 329 | __field( u32, curr_window ) |
| 330 | __field( u32, prev_window ) |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 331 | __dynamic_array(u32, curr_sum, nr_cpu_ids ) |
| 332 | __dynamic_array(u32, prev_sum, nr_cpu_ids ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 333 | __field( u64, nt_cs ) |
| 334 | __field( u64, nt_ps ) |
| 335 | __field( u32, active_windows ) |
Syed Rameez Mustafa | 59b5fb7 | 2016-05-31 16:40:45 -0700 | [diff] [blame] | 336 | __field( u8, curr_top ) |
| 337 | __field( u8, prev_top ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 338 | ), |
| 339 | |
| 340 | TP_fast_assign( |
| 341 | __entry->wallclock = wallclock; |
| 342 | __entry->win_start = rq->window_start; |
| 343 | __entry->delta = (wallclock - rq->window_start); |
| 344 | __entry->evt = evt; |
| 345 | __entry->cpu = rq->cpu; |
| 346 | __entry->cur_pid = rq->curr->pid; |
| 347 | __entry->cur_freq = cpu_cycles_to_freq(cycles, exec_time); |
| 348 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 349 | __entry->pid = p->pid; |
| 350 | __entry->mark_start = p->ravg.mark_start; |
| 351 | __entry->delta_m = (wallclock - p->ravg.mark_start); |
| 352 | __entry->demand = p->ravg.demand; |
| 353 | __entry->sum = p->ravg.sum; |
| 354 | __entry->irqtime = irqtime; |
| 355 | __entry->pred_demand = p->ravg.pred_demand; |
| 356 | __entry->rq_cs = rq->curr_runnable_sum; |
| 357 | __entry->rq_ps = rq->prev_runnable_sum; |
| 358 | __entry->grp_cs = cpu_time ? cpu_time->curr_runnable_sum : 0; |
| 359 | __entry->grp_ps = cpu_time ? cpu_time->prev_runnable_sum : 0; |
| 360 | __entry->grp_nt_cs = cpu_time ? cpu_time->nt_curr_runnable_sum : 0; |
| 361 | __entry->grp_nt_ps = cpu_time ? cpu_time->nt_prev_runnable_sum : 0; |
| 362 | __entry->curr_window = p->ravg.curr_window; |
| 363 | __entry->prev_window = p->ravg.prev_window; |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 364 | __window_data(__get_dynamic_array(curr_sum), p->ravg.curr_window_cpu); |
| 365 | __window_data(__get_dynamic_array(prev_sum), p->ravg.prev_window_cpu); |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 366 | __entry->nt_cs = rq->nt_curr_runnable_sum; |
| 367 | __entry->nt_ps = rq->nt_prev_runnable_sum; |
| 368 | __entry->active_windows = p->ravg.active_windows; |
Syed Rameez Mustafa | 59b5fb7 | 2016-05-31 16:40:45 -0700 | [diff] [blame] | 369 | __entry->curr_top = rq->curr_top; |
| 370 | __entry->prev_top = rq->prev_top; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 371 | ), |
| 372 | |
Syed Rameez Mustafa | 59b5fb7 | 2016-05-31 16:40:45 -0700 | [diff] [blame] | 373 | TP_printk("wc %llu ws %llu delta %llu event %s cpu %d cur_freq %u cur_pid %d task %d (%s) ms %llu delta %llu demand %u sum %u irqtime %llu pred_demand %u rq_cs %llu rq_ps %llu cur_window %u (%s) prev_window %u (%s) nt_cs %llu nt_ps %llu active_wins %u grp_cs %lld grp_ps %lld, grp_nt_cs %llu, grp_nt_ps: %llu curr_top %u prev_top %u", |
| 374 | __entry->wallclock, __entry->win_start, __entry->delta, |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 375 | task_event_names[__entry->evt], __entry->cpu, |
| 376 | __entry->cur_freq, __entry->cur_pid, |
| 377 | __entry->pid, __entry->comm, __entry->mark_start, |
| 378 | __entry->delta_m, __entry->demand, |
| 379 | __entry->sum, __entry->irqtime, __entry->pred_demand, |
| 380 | __entry->rq_cs, __entry->rq_ps, __entry->curr_window, |
Syed Rameez Mustafa | 60cef21 | 2016-05-09 16:28:07 -0700 | [diff] [blame] | 381 | __window_print(p, __get_dynamic_array(curr_sum), nr_cpu_ids), |
| 382 | __entry->prev_window, |
| 383 | __window_print(p, __get_dynamic_array(prev_sum), nr_cpu_ids), |
| 384 | __entry->nt_cs, __entry->nt_ps, |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 385 | __entry->active_windows, __entry->grp_cs, |
Syed Rameez Mustafa | 59b5fb7 | 2016-05-31 16:40:45 -0700 | [diff] [blame] | 386 | __entry->grp_ps, __entry->grp_nt_cs, __entry->grp_nt_ps, |
| 387 | __entry->curr_top, __entry->prev_top) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 388 | ); |
| 389 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 390 | struct migration_sum_data; |
| 391 | extern const char *migrate_type_names[]; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 392 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 393 | TRACE_EVENT(sched_set_preferred_cluster, |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 394 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 395 | TP_PROTO(struct related_thread_group *grp, u64 total_demand), |
| 396 | |
| 397 | TP_ARGS(grp, total_demand), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 398 | |
| 399 | TP_STRUCT__entry( |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 400 | __field( int, id ) |
| 401 | __field( u64, demand ) |
| 402 | __field( int, cluster_first_cpu ) |
| 403 | __array( char, comm, TASK_COMM_LEN ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 404 | __field( pid_t, pid ) |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 405 | __field(unsigned int, task_demand ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 406 | ), |
| 407 | |
| 408 | TP_fast_assign( |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 409 | __entry->id = grp->id; |
| 410 | __entry->demand = total_demand; |
| 411 | __entry->cluster_first_cpu = grp->preferred_cluster ? |
| 412 | cluster_first_cpu(grp->preferred_cluster) |
| 413 | : -1; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 414 | ), |
| 415 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 416 | TP_printk("group_id %d total_demand %llu preferred_cluster_first_cpu %d", |
| 417 | __entry->id, __entry->demand, |
| 418 | __entry->cluster_first_cpu) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 419 | ); |
| 420 | |
| 421 | TRACE_EVENT(sched_migration_update_sum, |
| 422 | |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 423 | TP_PROTO(struct task_struct *p, enum migrate_types migrate_type, struct rq *rq), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 424 | |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 425 | TP_ARGS(p, migrate_type, rq), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 426 | |
| 427 | TP_STRUCT__entry( |
| 428 | __field(int, tcpu ) |
| 429 | __field(int, pid ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 430 | __field(enum migrate_types, migrate_type ) |
| 431 | __field( s64, src_cs ) |
| 432 | __field( s64, src_ps ) |
| 433 | __field( s64, dst_cs ) |
| 434 | __field( s64, dst_ps ) |
| 435 | __field( s64, src_nt_cs ) |
| 436 | __field( s64, src_nt_ps ) |
| 437 | __field( s64, dst_nt_cs ) |
| 438 | __field( s64, dst_nt_ps ) |
| 439 | ), |
| 440 | |
| 441 | TP_fast_assign( |
| 442 | __entry->tcpu = task_cpu(p); |
| 443 | __entry->pid = p->pid; |
| 444 | __entry->migrate_type = migrate_type; |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 445 | __entry->src_cs = __get_update_sum(rq, migrate_type, |
| 446 | true, false, true); |
| 447 | __entry->src_ps = __get_update_sum(rq, migrate_type, |
| 448 | true, false, false); |
| 449 | __entry->dst_cs = __get_update_sum(rq, migrate_type, |
| 450 | false, false, true); |
| 451 | __entry->dst_ps = __get_update_sum(rq, migrate_type, |
| 452 | false, false, false); |
| 453 | __entry->src_nt_cs = __get_update_sum(rq, migrate_type, |
| 454 | true, true, true); |
| 455 | __entry->src_nt_ps = __get_update_sum(rq, migrate_type, |
| 456 | true, true, false); |
| 457 | __entry->dst_nt_cs = __get_update_sum(rq, migrate_type, |
| 458 | false, true, true); |
| 459 | __entry->dst_nt_ps = __get_update_sum(rq, migrate_type, |
| 460 | false, true, false); |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 461 | ), |
| 462 | |
| 463 | TP_printk("pid %d task_cpu %d migrate_type %s src_cs %llu src_ps %llu dst_cs %lld dst_ps %lld src_nt_cs %llu src_nt_ps %llu dst_nt_cs %lld dst_nt_ps %lld", |
| 464 | __entry->pid, __entry->tcpu, migrate_type_names[__entry->migrate_type], |
| 465 | __entry->src_cs, __entry->src_ps, __entry->dst_cs, __entry->dst_ps, |
| 466 | __entry->src_nt_cs, __entry->src_nt_ps, __entry->dst_nt_cs, __entry->dst_nt_ps) |
| 467 | ); |
| 468 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 469 | #endif |
| 470 | |
| 471 | #ifdef CONFIG_SCHED_WALT |
| 472 | DECLARE_EVENT_CLASS(sched_cpu_load, |
| 473 | |
| 474 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 475 | |
| 476 | TP_ARGS(rq, idle, irqload, power_cost, temp), |
| 477 | |
| 478 | TP_STRUCT__entry( |
| 479 | __field(unsigned int, cpu ) |
| 480 | __field(unsigned int, idle ) |
| 481 | __field(unsigned int, nr_running ) |
| 482 | __field(unsigned int, nr_big_tasks ) |
| 483 | __field(unsigned int, load_scale_factor ) |
| 484 | __field(unsigned int, capacity ) |
| 485 | __field( u64, cumulative_runnable_avg ) |
| 486 | __field( u64, irqload ) |
| 487 | __field(unsigned int, max_freq ) |
| 488 | __field(unsigned int, power_cost ) |
| 489 | __field( int, cstate ) |
| 490 | __field( int, dstate ) |
| 491 | __field( int, temp ) |
| 492 | ), |
| 493 | |
| 494 | TP_fast_assign( |
| 495 | __entry->cpu = rq->cpu; |
| 496 | __entry->idle = idle; |
| 497 | __entry->nr_running = rq->nr_running; |
| 498 | __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks; |
| 499 | __entry->load_scale_factor = cpu_load_scale_factor(rq->cpu); |
| 500 | __entry->capacity = cpu_capacity(rq->cpu); |
| 501 | __entry->cumulative_runnable_avg = rq->hmp_stats.cumulative_runnable_avg; |
| 502 | __entry->irqload = irqload; |
| 503 | __entry->max_freq = cpu_max_freq(rq->cpu); |
| 504 | __entry->power_cost = power_cost; |
| 505 | __entry->cstate = rq->cstate; |
| 506 | __entry->dstate = rq->cluster->dstate; |
| 507 | __entry->temp = temp; |
| 508 | ), |
| 509 | |
| 510 | TP_printk("cpu %u idle %d nr_run %u nr_big %u lsf %u capacity %u cr_avg %llu irqload %llu fmax %u power_cost %u cstate %d dstate %d temp %d", |
| 511 | __entry->cpu, __entry->idle, __entry->nr_running, __entry->nr_big_tasks, |
| 512 | __entry->load_scale_factor, __entry->capacity, |
| 513 | __entry->cumulative_runnable_avg, __entry->irqload, |
| 514 | __entry->max_freq, __entry->power_cost, __entry->cstate, |
| 515 | __entry->dstate, __entry->temp) |
| 516 | ); |
| 517 | |
| 518 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_lb, |
| 519 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 520 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 521 | ); |
| 522 | #endif |
| 523 | |
| 524 | #ifdef CONFIG_SCHED_HMP |
| 525 | |
| 526 | TRACE_EVENT(sched_task_load, |
| 527 | |
| 528 | TP_PROTO(struct task_struct *p, bool boost, int reason, |
| 529 | bool sync, bool need_idle, u32 flags, int best_cpu), |
| 530 | |
| 531 | TP_ARGS(p, boost, reason, sync, need_idle, flags, best_cpu), |
| 532 | |
| 533 | TP_STRUCT__entry( |
| 534 | __array( char, comm, TASK_COMM_LEN ) |
| 535 | __field( pid_t, pid ) |
| 536 | __field(unsigned int, demand ) |
| 537 | __field( bool, boost ) |
| 538 | __field( int, reason ) |
| 539 | __field( bool, sync ) |
| 540 | __field( bool, need_idle ) |
| 541 | __field( u32, flags ) |
| 542 | __field( int, best_cpu ) |
| 543 | __field( u64, latency ) |
| 544 | __field( int, grp_id ) |
| 545 | __field( u64, avg_burst ) |
| 546 | __field( u64, avg_sleep ) |
| 547 | ), |
| 548 | |
| 549 | TP_fast_assign( |
| 550 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 551 | __entry->pid = p->pid; |
| 552 | __entry->demand = p->ravg.demand; |
| 553 | __entry->boost = boost; |
| 554 | __entry->reason = reason; |
| 555 | __entry->sync = sync; |
| 556 | __entry->need_idle = need_idle; |
| 557 | __entry->flags = flags; |
| 558 | __entry->best_cpu = best_cpu; |
| 559 | __entry->latency = p->state == TASK_WAKING ? |
| 560 | sched_ktime_clock() - |
| 561 | p->ravg.mark_start : 0; |
| 562 | __entry->grp_id = p->grp ? p->grp->id : 0; |
| 563 | __entry->avg_burst = p->ravg.avg_burst; |
| 564 | __entry->avg_sleep = p->ravg.avg_sleep_time; |
| 565 | ), |
| 566 | |
| 567 | TP_printk("%d (%s): demand=%u boost=%d reason=%d sync=%d need_idle=%d flags=%x grp=%d best_cpu=%d latency=%llu avg_burst=%llu avg_sleep=%llu", |
| 568 | __entry->pid, __entry->comm, __entry->demand, |
| 569 | __entry->boost, __entry->reason, __entry->sync, |
| 570 | __entry->need_idle, __entry->flags, __entry->grp_id, |
| 571 | __entry->best_cpu, __entry->latency, __entry->avg_burst, |
| 572 | __entry->avg_sleep) |
| 573 | ); |
| 574 | |
| 575 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_wakeup, |
| 576 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 577 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 578 | ); |
| 579 | |
| 580 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_cgroup, |
| 581 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 582 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 583 | ); |
| 584 | |
| 585 | TRACE_EVENT(sched_set_boost, |
| 586 | |
| 587 | TP_PROTO(int type), |
| 588 | |
| 589 | TP_ARGS(type), |
| 590 | |
| 591 | TP_STRUCT__entry( |
| 592 | __field(int, type ) |
| 593 | ), |
| 594 | |
| 595 | TP_fast_assign( |
| 596 | __entry->type = type; |
| 597 | ), |
| 598 | |
| 599 | TP_printk("type %d", __entry->type) |
| 600 | ); |
| 601 | |
| 602 | TRACE_EVENT(sched_reset_all_window_stats, |
| 603 | |
| 604 | TP_PROTO(u64 window_start, u64 window_size, u64 time_taken, |
| 605 | int reason, unsigned int old_val, unsigned int new_val), |
| 606 | |
| 607 | TP_ARGS(window_start, window_size, time_taken, |
| 608 | reason, old_val, new_val), |
| 609 | |
| 610 | TP_STRUCT__entry( |
| 611 | __field( u64, window_start ) |
| 612 | __field( u64, window_size ) |
| 613 | __field( u64, time_taken ) |
| 614 | __field( int, reason ) |
| 615 | __field(unsigned int, old_val ) |
| 616 | __field(unsigned int, new_val ) |
| 617 | ), |
| 618 | |
| 619 | TP_fast_assign( |
| 620 | __entry->window_start = window_start; |
| 621 | __entry->window_size = window_size; |
| 622 | __entry->time_taken = time_taken; |
| 623 | __entry->reason = reason; |
| 624 | __entry->old_val = old_val; |
| 625 | __entry->new_val = new_val; |
| 626 | ), |
| 627 | |
| 628 | TP_printk("time_taken %llu window_start %llu window_size %llu reason %s old_val %u new_val %u", |
| 629 | __entry->time_taken, __entry->window_start, |
| 630 | __entry->window_size, |
| 631 | sched_window_reset_reasons[__entry->reason], |
| 632 | __entry->old_val, __entry->new_val) |
| 633 | ); |
| 634 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 635 | TRACE_EVENT(sched_get_busy, |
| 636 | |
| 637 | TP_PROTO(int cpu, u64 load, u64 nload, u64 pload, int early), |
| 638 | |
| 639 | TP_ARGS(cpu, load, nload, pload, early), |
| 640 | |
| 641 | TP_STRUCT__entry( |
| 642 | __field( int, cpu ) |
| 643 | __field( u64, load ) |
| 644 | __field( u64, nload ) |
| 645 | __field( u64, pload ) |
| 646 | __field( int, early ) |
| 647 | ), |
| 648 | |
| 649 | TP_fast_assign( |
| 650 | __entry->cpu = cpu; |
| 651 | __entry->load = load; |
| 652 | __entry->nload = nload; |
| 653 | __entry->pload = pload; |
| 654 | __entry->early = early; |
| 655 | ), |
| 656 | |
| 657 | TP_printk("cpu %d load %lld new_task_load %lld predicted_load %lld early %d", |
| 658 | __entry->cpu, __entry->load, __entry->nload, |
| 659 | __entry->pload, __entry->early) |
| 660 | ); |
| 661 | |
| 662 | TRACE_EVENT(sched_freq_alert, |
| 663 | |
| 664 | TP_PROTO(int cpu, int pd_notif, int check_groups, struct rq *rq, |
| 665 | u64 new_load), |
| 666 | |
| 667 | TP_ARGS(cpu, pd_notif, check_groups, rq, new_load), |
| 668 | |
| 669 | TP_STRUCT__entry( |
| 670 | __field( int, cpu ) |
| 671 | __field( int, pd_notif ) |
| 672 | __field( int, check_groups ) |
| 673 | __field( u64, old_busy_time ) |
| 674 | __field( u64, ps ) |
| 675 | __field( u64, new_load ) |
| 676 | __field( u64, old_pred ) |
| 677 | __field( u64, new_pred ) |
| 678 | ), |
| 679 | |
| 680 | TP_fast_assign( |
| 681 | __entry->cpu = cpu; |
| 682 | __entry->pd_notif = pd_notif; |
| 683 | __entry->check_groups = check_groups; |
| 684 | __entry->old_busy_time = rq->old_busy_time; |
| 685 | __entry->ps = rq->prev_runnable_sum; |
| 686 | __entry->new_load = new_load; |
| 687 | __entry->old_pred = rq->old_estimated_time; |
| 688 | __entry->new_pred = rq->hmp_stats.pred_demands_sum; |
| 689 | ), |
| 690 | |
| 691 | TP_printk("cpu %d pd_notif=%d check_groups %d old_busy_time=%llu prev_sum=%lld new_load=%llu old_pred=%llu new_pred=%llu", |
| 692 | __entry->cpu, __entry->pd_notif, __entry->check_groups, |
| 693 | __entry->old_busy_time, __entry->ps, __entry->new_load, |
| 694 | __entry->old_pred, __entry->new_pred) |
| 695 | ); |
| 696 | |
| 697 | #endif /* CONFIG_SCHED_HMP */ |
| 698 | |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame^] | 699 | #ifdef CONFIG_SMP |
| 700 | TRACE_EVENT(sched_cpu_util, |
| 701 | |
| 702 | TP_PROTO(struct task_struct *p, int cpu, int task_util, long spare_cap, int sync), |
| 703 | |
| 704 | TP_ARGS(p, cpu, task_util, spare_cap, sync), |
| 705 | |
| 706 | TP_STRUCT__entry( |
| 707 | __array(char, comm, TASK_COMM_LEN ) |
| 708 | __field(int, pid ) |
| 709 | __field(unsigned int, cpu ) |
| 710 | __field(int, task_util ) |
| 711 | __field(unsigned int, nr_running ) |
| 712 | __field(long, cpu_util ) |
| 713 | __field(unsigned int, capacity_curr ) |
| 714 | __field(unsigned int, capacity ) |
| 715 | __field(long, spare_cap ) |
| 716 | __field(int, sync ) |
| 717 | __field(int, idle_state ) |
| 718 | ), |
| 719 | |
| 720 | TP_fast_assign( |
| 721 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 722 | __entry->pid = p->pid; |
| 723 | __entry->cpu = cpu; |
| 724 | __entry->task_util = task_util; |
| 725 | __entry->nr_running = cpu_rq(cpu)->nr_running; |
| 726 | __entry->cpu_util = cpu_util(cpu); |
| 727 | __entry->capacity_curr = capacity_curr_of(cpu); |
| 728 | __entry->capacity = capacity_of(cpu); |
| 729 | __entry->spare_cap = spare_cap; |
| 730 | __entry->sync = sync; |
| 731 | __entry->idle_state = idle_get_state_idx(cpu_rq(cpu)); |
| 732 | ), |
| 733 | |
| 734 | TP_printk("comm=%s pid=%d cpu=%d task_util=%d nr_running=%d cpu_util=%ld capacity_curr=%u capacity=%u spare_capacity=%ld sync=%d idle_state=%d", |
| 735 | __entry->comm, __entry->pid, __entry->cpu, __entry->task_util, __entry->nr_running, __entry->cpu_util, __entry->capacity_curr, __entry->capacity, __entry->spare_cap, __entry->sync, __entry->idle_state) |
| 736 | ); |
| 737 | |
| 738 | DECLARE_EVENT_CLASS(sched_task_util, |
| 739 | |
| 740 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff), |
| 741 | |
| 742 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff), |
| 743 | |
| 744 | TP_STRUCT__entry( |
| 745 | __array(char, comm, TASK_COMM_LEN ) |
| 746 | __field(int, pid ) |
| 747 | __field(int, task_cpu ) |
| 748 | __field(unsigned long, task_util ) |
| 749 | __field(unsigned long, cpu_util_freq ) |
| 750 | __field(int, nominated_cpu ) |
| 751 | __field(int, target_cpu ) |
| 752 | __field(int, ediff ) |
| 753 | ), |
| 754 | |
| 755 | TP_fast_assign( |
| 756 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 757 | __entry->pid = p->pid; |
| 758 | __entry->task_cpu = task_cpu; |
| 759 | __entry->task_util = task_util; |
| 760 | __entry->cpu_util_freq = cpu_util_freq(target_cpu, NULL); |
| 761 | __entry->nominated_cpu = nominated_cpu; |
| 762 | __entry->target_cpu = target_cpu; |
| 763 | __entry->ediff = ediff; |
| 764 | ), |
| 765 | |
| 766 | TP_printk("comm=%s pid=%d task_cpu=%d task_util=%lu nominated_cpu=%d target_cpu=%d energy_diff=%d", |
| 767 | __entry->comm, __entry->pid, __entry->task_cpu, __entry->task_util, __entry->nominated_cpu, __entry->target_cpu, __entry->ediff) |
| 768 | ); |
| 769 | |
| 770 | DEFINE_EVENT(sched_task_util, sched_task_util_overutilzed, |
| 771 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff), |
| 772 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, task_cpu, ediff) |
| 773 | ); |
| 774 | |
| 775 | DEFINE_EVENT(sched_task_util, sched_task_util_energy_diff, |
| 776 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff), |
| 777 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, task_cpu, ediff) |
| 778 | ); |
| 779 | |
| 780 | DEFINE_EVENT(sched_task_util, sched_task_util_energy_aware, |
| 781 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff), |
| 782 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, task_cpu, ediff) |
| 783 | ); |
| 784 | #endif |
| 785 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 786 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 787 | * Tracepoint for waking up a task: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 788 | */ |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 789 | DECLARE_EVENT_CLASS(sched_wakeup_template, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 790 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 791 | TP_PROTO(struct task_struct *p), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 792 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 793 | TP_ARGS(__perf_task(p)), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 794 | |
| 795 | TP_STRUCT__entry( |
| 796 | __array( char, comm, TASK_COMM_LEN ) |
| 797 | __field( pid_t, pid ) |
| 798 | __field( int, prio ) |
| 799 | __field( int, success ) |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 800 | __field( int, target_cpu ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 801 | ), |
| 802 | |
| 803 | TP_fast_assign( |
| 804 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 805 | __entry->pid = p->pid; |
| 806 | __entry->prio = p->prio; |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 807 | __entry->success = 1; /* rudiment, kill when possible */ |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 808 | __entry->target_cpu = task_cpu(p); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 809 | ), |
| 810 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 811 | TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 812 | __entry->comm, __entry->pid, __entry->prio, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 813 | __entry->target_cpu) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 814 | ); |
| 815 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 816 | /* |
| 817 | * Tracepoint called when waking a task; this tracepoint is guaranteed to be |
| 818 | * called from the waking context. |
| 819 | */ |
| 820 | DEFINE_EVENT(sched_wakeup_template, sched_waking, |
| 821 | TP_PROTO(struct task_struct *p), |
| 822 | TP_ARGS(p)); |
| 823 | |
| 824 | /* |
| 825 | * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG. |
| 826 | * It it not always called from the waking context. |
| 827 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 828 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 829 | TP_PROTO(struct task_struct *p), |
| 830 | TP_ARGS(p)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 831 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 832 | /* |
| 833 | * Tracepoint for waking up a new task: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 834 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 835 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 836 | TP_PROTO(struct task_struct *p), |
| 837 | TP_ARGS(p)); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 838 | |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 839 | #ifdef CREATE_TRACE_POINTS |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 840 | static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p) |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 841 | { |
Oleg Nesterov | 8f9fbf0 | 2014-10-07 21:51:08 +0200 | [diff] [blame] | 842 | #ifdef CONFIG_SCHED_DEBUG |
| 843 | BUG_ON(p != current); |
| 844 | #endif /* CONFIG_SCHED_DEBUG */ |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 845 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 846 | /* |
| 847 | * Preemption ignores task state, therefore preempted tasks are always |
| 848 | * RUNNING (we will not have dequeued if state != RUNNING). |
| 849 | */ |
| 850 | return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state; |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 851 | } |
Oleg Nesterov | 8f9fbf0 | 2014-10-07 21:51:08 +0200 | [diff] [blame] | 852 | #endif /* CREATE_TRACE_POINTS */ |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 853 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 854 | /* |
| 855 | * Tracepoint for task switches, performed by the scheduler: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 856 | */ |
| 857 | TRACE_EVENT(sched_switch, |
| 858 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 859 | TP_PROTO(bool preempt, |
| 860 | struct task_struct *prev, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 861 | struct task_struct *next), |
| 862 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 863 | TP_ARGS(preempt, prev, next), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 864 | |
| 865 | TP_STRUCT__entry( |
| 866 | __array( char, prev_comm, TASK_COMM_LEN ) |
| 867 | __field( pid_t, prev_pid ) |
| 868 | __field( int, prev_prio ) |
Steven Rostedt | 937cdb9 | 2009-05-15 10:51:13 -0400 | [diff] [blame] | 869 | __field( long, prev_state ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 870 | __array( char, next_comm, TASK_COMM_LEN ) |
| 871 | __field( pid_t, next_pid ) |
| 872 | __field( int, next_prio ) |
| 873 | ), |
| 874 | |
| 875 | TP_fast_assign( |
| 876 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); |
| 877 | __entry->prev_pid = prev->pid; |
| 878 | __entry->prev_prio = prev->prio; |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 879 | __entry->prev_state = __trace_sched_switch_state(preempt, prev); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 880 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
| 881 | __entry->next_pid = next->pid; |
| 882 | __entry->next_prio = next->prio; |
| 883 | ), |
| 884 | |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 885 | TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 886 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 887 | __entry->prev_state & (TASK_STATE_MAX-1) ? |
| 888 | __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", |
Steven Rostedt | 937cdb9 | 2009-05-15 10:51:13 -0400 | [diff] [blame] | 889 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, |
| 890 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, |
Peter Zijlstra | 80ed87c | 2015-05-08 14:23:45 +0200 | [diff] [blame] | 891 | { 128, "K" }, { 256, "W" }, { 512, "P" }, |
| 892 | { 1024, "N" }) : "R", |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 893 | __entry->prev_state & TASK_STATE_MAX ? "+" : "", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 894 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
| 895 | ); |
| 896 | |
| 897 | /* |
| 898 | * Tracepoint for a task being migrated: |
| 899 | */ |
| 900 | TRACE_EVENT(sched_migrate_task, |
| 901 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 902 | TP_PROTO(struct task_struct *p, int dest_cpu, unsigned int load), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 903 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 904 | TP_ARGS(p, dest_cpu, load), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 905 | |
| 906 | TP_STRUCT__entry( |
| 907 | __array( char, comm, TASK_COMM_LEN ) |
| 908 | __field( pid_t, pid ) |
| 909 | __field( int, prio ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 910 | __field(unsigned int, load ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 911 | __field( int, orig_cpu ) |
| 912 | __field( int, dest_cpu ) |
| 913 | ), |
| 914 | |
| 915 | TP_fast_assign( |
| 916 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 917 | __entry->pid = p->pid; |
| 918 | __entry->prio = p->prio; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 919 | __entry->load = load; |
Mathieu Desnoyers | de1d728 | 2009-05-05 16:49:59 +0800 | [diff] [blame] | 920 | __entry->orig_cpu = task_cpu(p); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 921 | __entry->dest_cpu = dest_cpu; |
| 922 | ), |
| 923 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 924 | TP_printk("comm=%s pid=%d prio=%d load=%d orig_cpu=%d dest_cpu=%d", |
| 925 | __entry->comm, __entry->pid, __entry->prio, __entry->load, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 926 | __entry->orig_cpu, __entry->dest_cpu) |
| 927 | ); |
| 928 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 929 | /* |
| 930 | * Tracepoint for a CPU going offline/online: |
| 931 | */ |
| 932 | TRACE_EVENT(sched_cpu_hotplug, |
| 933 | |
| 934 | TP_PROTO(int affected_cpu, int error, int status), |
| 935 | |
| 936 | TP_ARGS(affected_cpu, error, status), |
| 937 | |
| 938 | TP_STRUCT__entry( |
| 939 | __field( int, affected_cpu ) |
| 940 | __field( int, error ) |
| 941 | __field( int, status ) |
| 942 | ), |
| 943 | |
| 944 | TP_fast_assign( |
| 945 | __entry->affected_cpu = affected_cpu; |
| 946 | __entry->error = error; |
| 947 | __entry->status = status; |
| 948 | ), |
| 949 | |
| 950 | TP_printk("cpu %d %s error=%d", __entry->affected_cpu, |
| 951 | __entry->status ? "online" : "offline", __entry->error) |
| 952 | ); |
| 953 | |
| 954 | /* |
| 955 | * Tracepoint for load balancing: |
| 956 | */ |
| 957 | #if NR_CPUS > 32 |
| 958 | #error "Unsupported NR_CPUS for lb tracepoint." |
| 959 | #endif |
| 960 | TRACE_EVENT(sched_load_balance, |
| 961 | |
| 962 | TP_PROTO(int cpu, enum cpu_idle_type idle, int balance, |
| 963 | unsigned long group_mask, int busiest_nr_running, |
| 964 | unsigned long imbalance, unsigned int env_flags, int ld_moved, |
| 965 | unsigned int balance_interval), |
| 966 | |
| 967 | TP_ARGS(cpu, idle, balance, group_mask, busiest_nr_running, |
| 968 | imbalance, env_flags, ld_moved, balance_interval), |
| 969 | |
| 970 | TP_STRUCT__entry( |
| 971 | __field( int, cpu) |
| 972 | __field( enum cpu_idle_type, idle) |
| 973 | __field( int, balance) |
| 974 | __field( unsigned long, group_mask) |
| 975 | __field( int, busiest_nr_running) |
| 976 | __field( unsigned long, imbalance) |
| 977 | __field( unsigned int, env_flags) |
| 978 | __field( int, ld_moved) |
| 979 | __field( unsigned int, balance_interval) |
| 980 | ), |
| 981 | |
| 982 | TP_fast_assign( |
| 983 | __entry->cpu = cpu; |
| 984 | __entry->idle = idle; |
| 985 | __entry->balance = balance; |
| 986 | __entry->group_mask = group_mask; |
| 987 | __entry->busiest_nr_running = busiest_nr_running; |
| 988 | __entry->imbalance = imbalance; |
| 989 | __entry->env_flags = env_flags; |
| 990 | __entry->ld_moved = ld_moved; |
| 991 | __entry->balance_interval = balance_interval; |
| 992 | ), |
| 993 | |
| 994 | TP_printk("cpu=%d state=%s balance=%d group=%#lx busy_nr=%d imbalance=%ld flags=%#x ld_moved=%d bal_int=%d", |
| 995 | __entry->cpu, |
| 996 | __entry->idle == CPU_IDLE ? "idle" : |
| 997 | (__entry->idle == CPU_NEWLY_IDLE ? "newly_idle" : "busy"), |
| 998 | __entry->balance, |
| 999 | __entry->group_mask, __entry->busiest_nr_running, |
| 1000 | __entry->imbalance, __entry->env_flags, __entry->ld_moved, |
| 1001 | __entry->balance_interval) |
| 1002 | ); |
| 1003 | |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 1004 | DECLARE_EVENT_CLASS(sched_process_template, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1005 | |
| 1006 | TP_PROTO(struct task_struct *p), |
| 1007 | |
| 1008 | TP_ARGS(p), |
| 1009 | |
| 1010 | TP_STRUCT__entry( |
| 1011 | __array( char, comm, TASK_COMM_LEN ) |
| 1012 | __field( pid_t, pid ) |
| 1013 | __field( int, prio ) |
| 1014 | ), |
| 1015 | |
| 1016 | TP_fast_assign( |
| 1017 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 1018 | __entry->pid = p->pid; |
| 1019 | __entry->prio = p->prio; |
| 1020 | ), |
| 1021 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1022 | TP_printk("comm=%s pid=%d prio=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1023 | __entry->comm, __entry->pid, __entry->prio) |
| 1024 | ); |
| 1025 | |
| 1026 | /* |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1027 | * Tracepoint for freeing a task: |
| 1028 | */ |
| 1029 | DEFINE_EVENT(sched_process_template, sched_process_free, |
| 1030 | TP_PROTO(struct task_struct *p), |
| 1031 | TP_ARGS(p)); |
Riley Andrews | 9de15b4 | 2015-10-02 00:39:53 -0700 | [diff] [blame] | 1032 | |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1033 | |
| 1034 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1035 | * Tracepoint for a task exiting: |
| 1036 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1037 | DEFINE_EVENT(sched_process_template, sched_process_exit, |
| 1038 | TP_PROTO(struct task_struct *p), |
| 1039 | TP_ARGS(p)); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1040 | |
| 1041 | /* |
Li Zefan | 210f766 | 2010-05-24 16:23:35 +0800 | [diff] [blame] | 1042 | * Tracepoint for waiting on task to unschedule: |
| 1043 | */ |
| 1044 | DEFINE_EVENT(sched_process_template, sched_wait_task, |
| 1045 | TP_PROTO(struct task_struct *p), |
| 1046 | TP_ARGS(p)); |
| 1047 | |
| 1048 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1049 | * Tracepoint for a waiting task: |
| 1050 | */ |
| 1051 | TRACE_EVENT(sched_process_wait, |
| 1052 | |
| 1053 | TP_PROTO(struct pid *pid), |
| 1054 | |
| 1055 | TP_ARGS(pid), |
| 1056 | |
| 1057 | TP_STRUCT__entry( |
| 1058 | __array( char, comm, TASK_COMM_LEN ) |
| 1059 | __field( pid_t, pid ) |
| 1060 | __field( int, prio ) |
| 1061 | ), |
| 1062 | |
| 1063 | TP_fast_assign( |
| 1064 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
| 1065 | __entry->pid = pid_nr(pid); |
| 1066 | __entry->prio = current->prio; |
| 1067 | ), |
| 1068 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1069 | TP_printk("comm=%s pid=%d prio=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1070 | __entry->comm, __entry->pid, __entry->prio) |
| 1071 | ); |
| 1072 | |
| 1073 | /* |
| 1074 | * Tracepoint for do_fork: |
| 1075 | */ |
| 1076 | TRACE_EVENT(sched_process_fork, |
| 1077 | |
| 1078 | TP_PROTO(struct task_struct *parent, struct task_struct *child), |
| 1079 | |
| 1080 | TP_ARGS(parent, child), |
| 1081 | |
| 1082 | TP_STRUCT__entry( |
| 1083 | __array( char, parent_comm, TASK_COMM_LEN ) |
| 1084 | __field( pid_t, parent_pid ) |
| 1085 | __array( char, child_comm, TASK_COMM_LEN ) |
| 1086 | __field( pid_t, child_pid ) |
| 1087 | ), |
| 1088 | |
| 1089 | TP_fast_assign( |
| 1090 | memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); |
| 1091 | __entry->parent_pid = parent->pid; |
| 1092 | memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); |
| 1093 | __entry->child_pid = child->pid; |
| 1094 | ), |
| 1095 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1096 | TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1097 | __entry->parent_comm, __entry->parent_pid, |
| 1098 | __entry->child_comm, __entry->child_pid) |
| 1099 | ); |
| 1100 | |
| 1101 | /* |
David Smith | 4ff16c2 | 2012-02-07 10:11:05 -0600 | [diff] [blame] | 1102 | * Tracepoint for exec: |
| 1103 | */ |
| 1104 | TRACE_EVENT(sched_process_exec, |
| 1105 | |
| 1106 | TP_PROTO(struct task_struct *p, pid_t old_pid, |
| 1107 | struct linux_binprm *bprm), |
| 1108 | |
| 1109 | TP_ARGS(p, old_pid, bprm), |
| 1110 | |
| 1111 | TP_STRUCT__entry( |
| 1112 | __string( filename, bprm->filename ) |
| 1113 | __field( pid_t, pid ) |
| 1114 | __field( pid_t, old_pid ) |
| 1115 | ), |
| 1116 | |
| 1117 | TP_fast_assign( |
| 1118 | __assign_str(filename, bprm->filename); |
| 1119 | __entry->pid = p->pid; |
Oleg Nesterov | 6308191 | 2012-03-30 18:26:36 +0200 | [diff] [blame] | 1120 | __entry->old_pid = old_pid; |
David Smith | 4ff16c2 | 2012-02-07 10:11:05 -0600 | [diff] [blame] | 1121 | ), |
| 1122 | |
| 1123 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), |
| 1124 | __entry->pid, __entry->old_pid) |
| 1125 | ); |
| 1126 | |
| 1127 | /* |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1128 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
| 1129 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
| 1130 | */ |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 1131 | DECLARE_EVENT_CLASS(sched_stat_template, |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1132 | |
| 1133 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1134 | |
Oleg Nesterov | 1247396 | 2013-08-06 18:08:44 +0200 | [diff] [blame] | 1135 | TP_ARGS(__perf_task(tsk), __perf_count(delay)), |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1136 | |
| 1137 | TP_STRUCT__entry( |
| 1138 | __array( char, comm, TASK_COMM_LEN ) |
| 1139 | __field( pid_t, pid ) |
| 1140 | __field( u64, delay ) |
| 1141 | ), |
| 1142 | |
| 1143 | TP_fast_assign( |
| 1144 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1145 | __entry->pid = tsk->pid; |
| 1146 | __entry->delay = delay; |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1147 | ), |
| 1148 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1149 | TP_printk("comm=%s pid=%d delay=%Lu [ns]", |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1150 | __entry->comm, __entry->pid, |
| 1151 | (unsigned long long)__entry->delay) |
| 1152 | ); |
| 1153 | |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1154 | |
| 1155 | /* |
| 1156 | * Tracepoint for accounting wait time (time the task is runnable |
| 1157 | * but not actually running due to scheduler contention). |
| 1158 | */ |
| 1159 | DEFINE_EVENT(sched_stat_template, sched_stat_wait, |
| 1160 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1161 | TP_ARGS(tsk, delay)); |
| 1162 | |
| 1163 | /* |
| 1164 | * Tracepoint for accounting sleep time (time the task is not runnable, |
| 1165 | * including iowait, see below). |
| 1166 | */ |
Li Zefan | 470dda74 | 2009-11-26 15:08:01 +0800 | [diff] [blame] | 1167 | DEFINE_EVENT(sched_stat_template, sched_stat_sleep, |
| 1168 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1169 | TP_ARGS(tsk, delay)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1170 | |
| 1171 | /* |
| 1172 | * Tracepoint for accounting iowait time (time the task is not runnable |
| 1173 | * due to waiting on IO to complete). |
| 1174 | */ |
Li Zefan | 470dda74 | 2009-11-26 15:08:01 +0800 | [diff] [blame] | 1175 | DEFINE_EVENT(sched_stat_template, sched_stat_iowait, |
| 1176 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1177 | TP_ARGS(tsk, delay)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1178 | |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1179 | /* |
Andrew Vagin | b781a60 | 2011-11-28 12:03:35 +0300 | [diff] [blame] | 1180 | * Tracepoint for accounting blocked time (time the task is in uninterruptible). |
| 1181 | */ |
| 1182 | DEFINE_EVENT(sched_stat_template, sched_stat_blocked, |
| 1183 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1184 | TP_ARGS(tsk, delay)); |
| 1185 | |
| 1186 | /* |
Riley Andrews | 9de15b4 | 2015-10-02 00:39:53 -0700 | [diff] [blame] | 1187 | * Tracepoint for recording the cause of uninterruptible sleep. |
| 1188 | */ |
| 1189 | TRACE_EVENT(sched_blocked_reason, |
| 1190 | |
| 1191 | TP_PROTO(struct task_struct *tsk), |
| 1192 | |
| 1193 | TP_ARGS(tsk), |
| 1194 | |
| 1195 | TP_STRUCT__entry( |
| 1196 | __field( pid_t, pid ) |
| 1197 | __field( void*, caller ) |
| 1198 | __field( bool, io_wait ) |
| 1199 | ), |
| 1200 | |
| 1201 | TP_fast_assign( |
| 1202 | __entry->pid = tsk->pid; |
| 1203 | __entry->caller = (void*)get_wchan(tsk); |
| 1204 | __entry->io_wait = tsk->in_iowait; |
| 1205 | ), |
| 1206 | |
| 1207 | TP_printk("pid=%d iowait=%d caller=%pS", __entry->pid, __entry->io_wait, __entry->caller) |
| 1208 | ); |
| 1209 | |
| 1210 | /* |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1211 | * Tracepoint for accounting runtime (time the task is executing |
| 1212 | * on a CPU). |
| 1213 | */ |
Oleg Nesterov | 36009d07 | 2013-08-06 18:08:41 +0200 | [diff] [blame] | 1214 | DECLARE_EVENT_CLASS(sched_stat_runtime, |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1215 | |
| 1216 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), |
| 1217 | |
Oleg Nesterov | 1247396 | 2013-08-06 18:08:44 +0200 | [diff] [blame] | 1218 | TP_ARGS(tsk, __perf_count(runtime), vruntime), |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1219 | |
| 1220 | TP_STRUCT__entry( |
| 1221 | __array( char, comm, TASK_COMM_LEN ) |
| 1222 | __field( pid_t, pid ) |
| 1223 | __field( u64, runtime ) |
| 1224 | __field( u64, vruntime ) |
| 1225 | ), |
| 1226 | |
| 1227 | TP_fast_assign( |
| 1228 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1229 | __entry->pid = tsk->pid; |
| 1230 | __entry->runtime = runtime; |
| 1231 | __entry->vruntime = vruntime; |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1232 | ), |
| 1233 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1234 | TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1235 | __entry->comm, __entry->pid, |
| 1236 | (unsigned long long)__entry->runtime, |
| 1237 | (unsigned long long)__entry->vruntime) |
| 1238 | ); |
| 1239 | |
Oleg Nesterov | 36009d07 | 2013-08-06 18:08:41 +0200 | [diff] [blame] | 1240 | DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, |
| 1241 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), |
| 1242 | TP_ARGS(tsk, runtime, vruntime)); |
| 1243 | |
Steven Rostedt | a802707 | 2010-09-20 15:13:34 -0400 | [diff] [blame] | 1244 | /* |
| 1245 | * Tracepoint for showing priority inheritance modifying a tasks |
| 1246 | * priority. |
| 1247 | */ |
| 1248 | TRACE_EVENT(sched_pi_setprio, |
| 1249 | |
| 1250 | TP_PROTO(struct task_struct *tsk, int newprio), |
| 1251 | |
| 1252 | TP_ARGS(tsk, newprio), |
| 1253 | |
| 1254 | TP_STRUCT__entry( |
| 1255 | __array( char, comm, TASK_COMM_LEN ) |
| 1256 | __field( pid_t, pid ) |
| 1257 | __field( int, oldprio ) |
| 1258 | __field( int, newprio ) |
| 1259 | ), |
| 1260 | |
| 1261 | TP_fast_assign( |
| 1262 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1263 | __entry->pid = tsk->pid; |
| 1264 | __entry->oldprio = tsk->prio; |
| 1265 | __entry->newprio = newprio; |
| 1266 | ), |
| 1267 | |
| 1268 | TP_printk("comm=%s pid=%d oldprio=%d newprio=%d", |
| 1269 | __entry->comm, __entry->pid, |
| 1270 | __entry->oldprio, __entry->newprio) |
| 1271 | ); |
| 1272 | |
Oleg Nesterov | 6a716c9 | 2013-10-19 18:18:28 +0200 | [diff] [blame] | 1273 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 1274 | TRACE_EVENT(sched_process_hang, |
| 1275 | TP_PROTO(struct task_struct *tsk), |
| 1276 | TP_ARGS(tsk), |
| 1277 | |
| 1278 | TP_STRUCT__entry( |
| 1279 | __array( char, comm, TASK_COMM_LEN ) |
| 1280 | __field( pid_t, pid ) |
| 1281 | ), |
| 1282 | |
| 1283 | TP_fast_assign( |
| 1284 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1285 | __entry->pid = tsk->pid; |
| 1286 | ), |
| 1287 | |
| 1288 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) |
| 1289 | ); |
| 1290 | #endif /* CONFIG_DETECT_HUNG_TASK */ |
| 1291 | |
Mel Gorman | 286549d | 2014-01-21 15:51:03 -0800 | [diff] [blame] | 1292 | DECLARE_EVENT_CLASS(sched_move_task_template, |
| 1293 | |
| 1294 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1295 | |
| 1296 | TP_ARGS(tsk, src_cpu, dst_cpu), |
| 1297 | |
| 1298 | TP_STRUCT__entry( |
| 1299 | __field( pid_t, pid ) |
| 1300 | __field( pid_t, tgid ) |
| 1301 | __field( pid_t, ngid ) |
| 1302 | __field( int, src_cpu ) |
| 1303 | __field( int, src_nid ) |
| 1304 | __field( int, dst_cpu ) |
| 1305 | __field( int, dst_nid ) |
| 1306 | ), |
| 1307 | |
| 1308 | TP_fast_assign( |
| 1309 | __entry->pid = task_pid_nr(tsk); |
| 1310 | __entry->tgid = task_tgid_nr(tsk); |
| 1311 | __entry->ngid = task_numa_group_id(tsk); |
| 1312 | __entry->src_cpu = src_cpu; |
| 1313 | __entry->src_nid = cpu_to_node(src_cpu); |
| 1314 | __entry->dst_cpu = dst_cpu; |
| 1315 | __entry->dst_nid = cpu_to_node(dst_cpu); |
| 1316 | ), |
| 1317 | |
| 1318 | TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", |
| 1319 | __entry->pid, __entry->tgid, __entry->ngid, |
| 1320 | __entry->src_cpu, __entry->src_nid, |
| 1321 | __entry->dst_cpu, __entry->dst_nid) |
| 1322 | ); |
| 1323 | |
| 1324 | /* |
| 1325 | * Tracks migration of tasks from one runqueue to another. Can be used to |
| 1326 | * detect if automatic NUMA balancing is bouncing between nodes |
| 1327 | */ |
| 1328 | DEFINE_EVENT(sched_move_task_template, sched_move_numa, |
| 1329 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1330 | |
| 1331 | TP_ARGS(tsk, src_cpu, dst_cpu) |
| 1332 | ); |
| 1333 | |
| 1334 | DEFINE_EVENT(sched_move_task_template, sched_stick_numa, |
| 1335 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1336 | |
| 1337 | TP_ARGS(tsk, src_cpu, dst_cpu) |
| 1338 | ); |
| 1339 | |
| 1340 | TRACE_EVENT(sched_swap_numa, |
| 1341 | |
| 1342 | TP_PROTO(struct task_struct *src_tsk, int src_cpu, |
| 1343 | struct task_struct *dst_tsk, int dst_cpu), |
| 1344 | |
| 1345 | TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu), |
| 1346 | |
| 1347 | TP_STRUCT__entry( |
| 1348 | __field( pid_t, src_pid ) |
| 1349 | __field( pid_t, src_tgid ) |
| 1350 | __field( pid_t, src_ngid ) |
| 1351 | __field( int, src_cpu ) |
| 1352 | __field( int, src_nid ) |
| 1353 | __field( pid_t, dst_pid ) |
| 1354 | __field( pid_t, dst_tgid ) |
| 1355 | __field( pid_t, dst_ngid ) |
| 1356 | __field( int, dst_cpu ) |
| 1357 | __field( int, dst_nid ) |
| 1358 | ), |
| 1359 | |
| 1360 | TP_fast_assign( |
| 1361 | __entry->src_pid = task_pid_nr(src_tsk); |
| 1362 | __entry->src_tgid = task_tgid_nr(src_tsk); |
| 1363 | __entry->src_ngid = task_numa_group_id(src_tsk); |
| 1364 | __entry->src_cpu = src_cpu; |
| 1365 | __entry->src_nid = cpu_to_node(src_cpu); |
| 1366 | __entry->dst_pid = task_pid_nr(dst_tsk); |
| 1367 | __entry->dst_tgid = task_tgid_nr(dst_tsk); |
| 1368 | __entry->dst_ngid = task_numa_group_id(dst_tsk); |
| 1369 | __entry->dst_cpu = dst_cpu; |
| 1370 | __entry->dst_nid = cpu_to_node(dst_cpu); |
| 1371 | ), |
| 1372 | |
| 1373 | 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", |
| 1374 | __entry->src_pid, __entry->src_tgid, __entry->src_ngid, |
| 1375 | __entry->src_cpu, __entry->src_nid, |
| 1376 | __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, |
| 1377 | __entry->dst_cpu, __entry->dst_nid) |
| 1378 | ); |
Andy Lutomirski | dfc68f2 | 2014-06-04 10:31:15 -0700 | [diff] [blame] | 1379 | |
| 1380 | /* |
| 1381 | * Tracepoint for waking a polling cpu without an IPI. |
| 1382 | */ |
| 1383 | TRACE_EVENT(sched_wake_idle_without_ipi, |
| 1384 | |
| 1385 | TP_PROTO(int cpu), |
| 1386 | |
| 1387 | TP_ARGS(cpu), |
| 1388 | |
| 1389 | TP_STRUCT__entry( |
| 1390 | __field( int, cpu ) |
| 1391 | ), |
| 1392 | |
| 1393 | TP_fast_assign( |
| 1394 | __entry->cpu = cpu; |
| 1395 | ), |
| 1396 | |
| 1397 | TP_printk("cpu=%d", __entry->cpu) |
| 1398 | ); |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1399 | |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1400 | TRACE_EVENT(sched_contrib_scale_f, |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1401 | TP_PROTO(int cpu, unsigned long freq_scale_factor, |
| 1402 | unsigned long cpu_scale_factor), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1403 | TP_ARGS(cpu, freq_scale_factor, cpu_scale_factor), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1404 | TP_STRUCT__entry( |
| 1405 | __field(int, cpu) |
| 1406 | __field(unsigned long, freq_scale_factor) |
| 1407 | __field(unsigned long, cpu_scale_factor) |
| 1408 | ), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1409 | TP_fast_assign( |
| 1410 | __entry->cpu = cpu; |
| 1411 | __entry->freq_scale_factor = freq_scale_factor; |
| 1412 | __entry->cpu_scale_factor = cpu_scale_factor; |
| 1413 | ), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1414 | TP_printk("cpu=%d freq_scale_factor=%lu cpu_scale_factor=%lu", |
| 1415 | __entry->cpu, __entry->freq_scale_factor, |
| 1416 | __entry->cpu_scale_factor) |
| 1417 | ); |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1418 | |
Jeevan Shriram | 49f575e | 2017-03-02 16:52:44 -0800 | [diff] [blame] | 1419 | #ifdef CONFIG_SMP |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1420 | /* |
| 1421 | * Tracepoint for accounting sched averages for tasks. |
| 1422 | */ |
| 1423 | TRACE_EVENT(sched_load_avg_task, |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1424 | TP_PROTO(struct task_struct *tsk, struct sched_avg *avg), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1425 | TP_ARGS(tsk, avg), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1426 | TP_STRUCT__entry( |
| 1427 | __array( char, comm, TASK_COMM_LEN ) |
| 1428 | __field( pid_t, pid ) |
| 1429 | __field( int, cpu ) |
| 1430 | __field( unsigned long, load_avg ) |
| 1431 | __field( unsigned long, util_avg ) |
| 1432 | __field( u64, load_sum ) |
| 1433 | __field( u32, util_sum ) |
| 1434 | __field( u32, period_contrib ) |
| 1435 | ), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1436 | TP_fast_assign( |
| 1437 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1438 | __entry->pid = tsk->pid; |
| 1439 | __entry->cpu = task_cpu(tsk); |
| 1440 | __entry->load_avg = avg->load_avg; |
| 1441 | __entry->util_avg = avg->util_avg; |
| 1442 | __entry->load_sum = avg->load_sum; |
| 1443 | __entry->util_sum = avg->util_sum; |
| 1444 | __entry->period_contrib = avg->period_contrib; |
| 1445 | ), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1446 | TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu load_sum=%llu" |
| 1447 | " util_sum=%u period_contrib=%u", |
| 1448 | __entry->comm, |
| 1449 | __entry->pid, |
| 1450 | __entry->cpu, |
| 1451 | __entry->load_avg, |
| 1452 | __entry->util_avg, |
| 1453 | (u64)__entry->load_sum, |
| 1454 | (u32)__entry->util_sum, |
| 1455 | (u32)__entry->period_contrib) |
| 1456 | ); |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1457 | /* |
| 1458 | * Tracepoint for accounting sched averages for cpus. |
| 1459 | */ |
| 1460 | TRACE_EVENT(sched_load_avg_cpu, |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1461 | TP_PROTO(int cpu, struct cfs_rq *cfs_rq), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1462 | TP_ARGS(cpu, cfs_rq), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1463 | TP_STRUCT__entry( |
| 1464 | __field( int, cpu ) |
| 1465 | __field( unsigned long, load_avg ) |
| 1466 | __field( unsigned long, util_avg ) |
| 1467 | ), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1468 | TP_fast_assign( |
| 1469 | __entry->cpu = cpu; |
| 1470 | __entry->load_avg = cfs_rq->avg.load_avg; |
| 1471 | __entry->util_avg = cfs_rq->avg.util_avg; |
| 1472 | ), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1473 | TP_printk("cpu=%d load_avg=%lu util_avg=%lu", |
| 1474 | __entry->cpu, __entry->load_avg, __entry->util_avg) |
| 1475 | ); |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1476 | /* |
| 1477 | * Tracepoint for sched_tune_config settings |
| 1478 | */ |
| 1479 | TRACE_EVENT(sched_tune_config, |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1480 | TP_PROTO(int boost), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1481 | TP_ARGS(boost), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1482 | TP_STRUCT__entry( |
| 1483 | __field( int, boost ) |
| 1484 | ), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1485 | TP_fast_assign( |
| 1486 | __entry->boost = boost; |
| 1487 | ), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1488 | TP_printk("boost=%d ", __entry->boost) |
| 1489 | ); |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1490 | /* |
| 1491 | * Tracepoint for accounting CPU boosted utilization |
| 1492 | */ |
| 1493 | TRACE_EVENT(sched_boost_cpu, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1494 | TP_PROTO(int cpu, unsigned long util, long margin), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1495 | TP_ARGS(cpu, util, margin), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1496 | TP_STRUCT__entry( |
| 1497 | __field( int, cpu ) |
| 1498 | __field( unsigned long, util ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1499 | __field(long, margin ) |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1500 | ), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1501 | TP_fast_assign( |
| 1502 | __entry->cpu = cpu; |
| 1503 | __entry->util = util; |
| 1504 | __entry->margin = margin; |
| 1505 | ), |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1506 | TP_printk("cpu=%d util=%lu margin=%ld", |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1507 | __entry->cpu, |
| 1508 | __entry->util, |
| 1509 | __entry->margin) |
| 1510 | ); |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1511 | /* |
| 1512 | * Tracepoint for schedtune_tasks_update |
| 1513 | */ |
| 1514 | TRACE_EVENT(sched_tune_tasks_update, |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1515 | TP_PROTO(struct task_struct *tsk, int cpu, int tasks, int idx, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1516 | int boost, int max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1517 | TP_ARGS(tsk, cpu, tasks, idx, boost, max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1518 | TP_STRUCT__entry( |
| 1519 | __array( char, comm, TASK_COMM_LEN ) |
| 1520 | __field( pid_t, pid ) |
| 1521 | __field( int, cpu ) |
| 1522 | __field( int, tasks ) |
| 1523 | __field( int, idx ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1524 | __field( int, boost ) |
| 1525 | __field( int, max_boost ) |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1526 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1527 | TP_fast_assign( |
| 1528 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1529 | __entry->pid = tsk->pid; |
| 1530 | __entry->cpu = cpu; |
| 1531 | __entry->tasks = tasks; |
| 1532 | __entry->idx = idx; |
| 1533 | __entry->boost = boost; |
| 1534 | __entry->max_boost = max_boost; |
| 1535 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1536 | TP_printk("pid=%d comm=%s " |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1537 | "cpu=%d tasks=%d idx=%d boost=%d max_boost=%d", |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1538 | __entry->pid, __entry->comm, |
| 1539 | __entry->cpu, __entry->tasks, __entry->idx, |
| 1540 | __entry->boost, __entry->max_boost) |
| 1541 | ); |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1542 | /* |
| 1543 | * Tracepoint for schedtune_boostgroup_update |
| 1544 | */ |
| 1545 | TRACE_EVENT(sched_tune_boostgroup_update, |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1546 | TP_PROTO(int cpu, int variation, int max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1547 | TP_ARGS(cpu, variation, max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1548 | TP_STRUCT__entry( |
| 1549 | __field( int, cpu ) |
| 1550 | __field( int, variation ) |
| 1551 | __field( int, max_boost ) |
| 1552 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1553 | TP_fast_assign( |
| 1554 | __entry->cpu = cpu; |
| 1555 | __entry->variation = variation; |
| 1556 | __entry->max_boost = max_boost; |
| 1557 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1558 | TP_printk("cpu=%d variation=%d max_boost=%d", |
| 1559 | __entry->cpu, __entry->variation, __entry->max_boost) |
| 1560 | ); |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1561 | /* |
| 1562 | * Tracepoint for accounting task boosted utilization |
| 1563 | */ |
| 1564 | TRACE_EVENT(sched_boost_task, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1565 | TP_PROTO(struct task_struct *tsk, unsigned long util, long margin), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1566 | TP_ARGS(tsk, util, margin), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1567 | TP_STRUCT__entry( |
| 1568 | __array( char, comm, TASK_COMM_LEN ) |
| 1569 | __field( pid_t, pid ) |
| 1570 | __field( unsigned long, util ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1571 | __field( long, margin ) |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1572 | ), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1573 | TP_fast_assign( |
| 1574 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1575 | __entry->pid = tsk->pid; |
| 1576 | __entry->util = util; |
| 1577 | __entry->margin = margin; |
| 1578 | ), |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1579 | TP_printk("comm=%s pid=%d util=%lu margin=%ld", |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1580 | __entry->comm, __entry->pid, |
| 1581 | __entry->util, |
| 1582 | __entry->margin) |
| 1583 | ); |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1584 | /* |
| 1585 | * Tracepoint for accounting sched group energy |
| 1586 | */ |
| 1587 | TRACE_EVENT(sched_energy_diff, |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1588 | TP_PROTO(struct task_struct *tsk, int scpu, int dcpu, int udelta, |
| 1589 | int nrgb, int nrga, int nrgd, int capb, int capa, int capd, |
| 1590 | int nrgn, int nrgp), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1591 | TP_ARGS(tsk, scpu, dcpu, udelta, |
| 1592 | nrgb, nrga, nrgd, capb, capa, capd, |
| 1593 | nrgn, nrgp), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1594 | TP_STRUCT__entry( |
| 1595 | __array( char, comm, TASK_COMM_LEN ) |
| 1596 | __field( pid_t, pid ) |
| 1597 | __field( int, scpu ) |
| 1598 | __field( int, dcpu ) |
| 1599 | __field( int, udelta ) |
| 1600 | __field( int, nrgb ) |
| 1601 | __field( int, nrga ) |
| 1602 | __field( int, nrgd ) |
| 1603 | __field( int, capb ) |
| 1604 | __field( int, capa ) |
| 1605 | __field( int, capd ) |
| 1606 | __field( int, nrgn ) |
| 1607 | __field( int, nrgp ) |
| 1608 | ), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1609 | TP_fast_assign( |
| 1610 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1611 | __entry->pid = tsk->pid; |
| 1612 | __entry->scpu = scpu; |
| 1613 | __entry->dcpu = dcpu; |
| 1614 | __entry->udelta = udelta; |
| 1615 | __entry->nrgb = nrgb; |
| 1616 | __entry->nrga = nrga; |
| 1617 | __entry->nrgd = nrgd; |
| 1618 | __entry->capb = capb; |
| 1619 | __entry->capa = capa; |
| 1620 | __entry->capd = capd; |
| 1621 | __entry->nrgn = nrgn; |
| 1622 | __entry->nrgp = nrgp; |
| 1623 | ), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1624 | TP_printk("pid=%d comm=%s " |
| 1625 | "src_cpu=%d dst_cpu=%d usage_delta=%d " |
| 1626 | "nrg_before=%d nrg_after=%d nrg_diff=%d " |
| 1627 | "cap_before=%d cap_after=%d cap_delta=%d " |
| 1628 | "nrg_delta=%d nrg_payoff=%d", |
| 1629 | __entry->pid, __entry->comm, |
| 1630 | __entry->scpu, __entry->dcpu, __entry->udelta, |
| 1631 | __entry->nrgb, __entry->nrga, __entry->nrgd, |
| 1632 | __entry->capb, __entry->capa, __entry->capd, |
| 1633 | __entry->nrgn, __entry->nrgp) |
| 1634 | ); |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1635 | /* |
| 1636 | * Tracepoint for schedtune_tasks_update |
| 1637 | */ |
| 1638 | TRACE_EVENT(sched_tune_filter, |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1639 | TP_PROTO(int nrg_delta, int cap_delta, |
| 1640 | int nrg_gain, int cap_gain, |
| 1641 | int payoff, int region), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1642 | TP_ARGS(nrg_delta, cap_delta, nrg_gain, cap_gain, payoff, region), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1643 | TP_STRUCT__entry( |
| 1644 | __field( int, nrg_delta ) |
| 1645 | __field( int, cap_delta ) |
| 1646 | __field( int, nrg_gain ) |
| 1647 | __field( int, cap_gain ) |
| 1648 | __field( int, payoff ) |
| 1649 | __field( int, region ) |
| 1650 | ), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1651 | TP_fast_assign( |
| 1652 | __entry->nrg_delta = nrg_delta; |
| 1653 | __entry->cap_delta = cap_delta; |
| 1654 | __entry->nrg_gain = nrg_gain; |
| 1655 | __entry->cap_gain = cap_gain; |
| 1656 | __entry->payoff = payoff; |
| 1657 | __entry->region = region; |
| 1658 | ), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1659 | TP_printk("nrg_delta=%d cap_delta=%d nrg_gain=%d cap_gain=%d payoff=%d region=%d", |
| 1660 | __entry->nrg_delta, __entry->cap_delta, |
| 1661 | __entry->nrg_gain, __entry->cap_gain, |
| 1662 | __entry->payoff, __entry->region) |
| 1663 | ); |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1664 | /* |
| 1665 | * Tracepoint for system overutilized flag |
| 1666 | */ |
| 1667 | TRACE_EVENT(sched_overutilized, |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1668 | TP_PROTO(bool overutilized), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1669 | TP_ARGS(overutilized), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1670 | TP_STRUCT__entry( |
| 1671 | __field( bool, overutilized ) |
| 1672 | ), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1673 | TP_fast_assign( |
| 1674 | __entry->overutilized = overutilized; |
| 1675 | ), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1676 | TP_printk("overutilized=%d", |
| 1677 | __entry->overutilized ? 1 : 0) |
| 1678 | ); |
Jeevan Shriram | 49f575e | 2017-03-02 16:52:44 -0800 | [diff] [blame] | 1679 | #endif |
Srivatsa Vaddagiri | 26c2154 | 2016-05-31 09:08:38 -0700 | [diff] [blame] | 1680 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1681 | TRACE_EVENT(sched_get_nr_running_avg, |
| 1682 | |
| 1683 | TP_PROTO(int avg, int big_avg, int iowait_avg), |
| 1684 | |
| 1685 | TP_ARGS(avg, big_avg, iowait_avg), |
| 1686 | |
| 1687 | TP_STRUCT__entry( |
| 1688 | __field( int, avg ) |
| 1689 | __field( int, big_avg ) |
| 1690 | __field( int, iowait_avg ) |
| 1691 | ), |
| 1692 | |
| 1693 | TP_fast_assign( |
| 1694 | __entry->avg = avg; |
| 1695 | __entry->big_avg = big_avg; |
| 1696 | __entry->iowait_avg = iowait_avg; |
| 1697 | ), |
| 1698 | |
| 1699 | TP_printk("avg=%d big_avg=%d iowait_avg=%d", |
| 1700 | __entry->avg, __entry->big_avg, __entry->iowait_avg) |
| 1701 | ); |
Olav Haugan | 39432ea | 2016-06-12 13:57:05 -0700 | [diff] [blame] | 1702 | |
Olav Haugan | 09bcc68 | 2016-09-02 17:12:20 -0700 | [diff] [blame] | 1703 | TRACE_EVENT(core_ctl_eval_need, |
| 1704 | |
| 1705 | TP_PROTO(unsigned int cpu, unsigned int old_need, |
| 1706 | unsigned int new_need, unsigned int updated), |
| 1707 | TP_ARGS(cpu, old_need, new_need, updated), |
| 1708 | TP_STRUCT__entry( |
| 1709 | __field(u32, cpu) |
| 1710 | __field(u32, old_need) |
| 1711 | __field(u32, new_need) |
| 1712 | __field(u32, updated) |
| 1713 | ), |
| 1714 | TP_fast_assign( |
| 1715 | __entry->cpu = cpu; |
| 1716 | __entry->old_need = old_need; |
| 1717 | __entry->new_need = new_need; |
| 1718 | __entry->updated = updated; |
| 1719 | ), |
| 1720 | TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, |
| 1721 | __entry->old_need, __entry->new_need, __entry->updated) |
| 1722 | ); |
| 1723 | |
| 1724 | TRACE_EVENT(core_ctl_set_busy, |
| 1725 | |
| 1726 | TP_PROTO(unsigned int cpu, unsigned int busy, |
| 1727 | unsigned int old_is_busy, unsigned int is_busy), |
| 1728 | TP_ARGS(cpu, busy, old_is_busy, is_busy), |
| 1729 | TP_STRUCT__entry( |
| 1730 | __field(u32, cpu) |
| 1731 | __field(u32, busy) |
| 1732 | __field(u32, old_is_busy) |
| 1733 | __field(u32, is_busy) |
| 1734 | ), |
| 1735 | TP_fast_assign( |
| 1736 | __entry->cpu = cpu; |
| 1737 | __entry->busy = busy; |
| 1738 | __entry->old_is_busy = old_is_busy; |
| 1739 | __entry->is_busy = is_busy; |
| 1740 | ), |
| 1741 | TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", |
| 1742 | __entry->cpu, __entry->busy, __entry->old_is_busy, |
| 1743 | __entry->is_busy) |
| 1744 | ); |
| 1745 | |
Olav Haugan | a024f47 | 2016-10-13 10:34:11 -0700 | [diff] [blame] | 1746 | TRACE_EVENT(core_ctl_set_boost, |
| 1747 | |
| 1748 | TP_PROTO(u32 refcount, s32 ret), |
| 1749 | TP_ARGS(refcount, ret), |
| 1750 | TP_STRUCT__entry( |
| 1751 | __field(u32, refcount) |
| 1752 | __field(s32, ret) |
| 1753 | ), |
| 1754 | TP_fast_assign( |
| 1755 | __entry->refcount = refcount; |
| 1756 | __entry->ret = ret; |
| 1757 | ), |
| 1758 | TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret) |
| 1759 | ); |
| 1760 | |
Olav Haugan | 39432ea | 2016-06-12 13:57:05 -0700 | [diff] [blame] | 1761 | /* |
| 1762 | * sched_isolate - called when cores are isolated/unisolated |
| 1763 | * |
| 1764 | * @acutal_mask: mask of cores actually isolated/unisolated |
| 1765 | * @req_mask: mask of cores requested isolated/unisolated |
| 1766 | * @online_mask: cpu online mask |
| 1767 | * @time: amount of time in us it took to isolate/unisolate |
| 1768 | * @isolate: 1 if isolating, 0 if unisolating |
| 1769 | * |
| 1770 | */ |
| 1771 | TRACE_EVENT(sched_isolate, |
| 1772 | |
| 1773 | TP_PROTO(unsigned int requested_cpu, unsigned int isolated_cpus, |
| 1774 | u64 start_time, unsigned char isolate), |
| 1775 | |
| 1776 | TP_ARGS(requested_cpu, isolated_cpus, start_time, isolate), |
| 1777 | |
| 1778 | TP_STRUCT__entry( |
| 1779 | __field(u32, requested_cpu) |
| 1780 | __field(u32, isolated_cpus) |
| 1781 | __field(u32, time) |
| 1782 | __field(unsigned char, isolate) |
| 1783 | ), |
| 1784 | |
| 1785 | TP_fast_assign( |
| 1786 | __entry->requested_cpu = requested_cpu; |
| 1787 | __entry->isolated_cpus = isolated_cpus; |
| 1788 | __entry->time = div64_u64(sched_clock() - start_time, 1000); |
| 1789 | __entry->isolate = isolate; |
| 1790 | ), |
| 1791 | |
| 1792 | TP_printk("iso cpu=%u cpus=0x%x time=%u us isolated=%d", |
| 1793 | __entry->requested_cpu, __entry->isolated_cpus, |
| 1794 | __entry->time, __entry->isolate) |
| 1795 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1796 | #endif /* _TRACE_SCHED_H */ |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 1797 | |
| 1798 | /* This part must be outside protection */ |
| 1799 | #include <trace/define_trace.h> |