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 | |
Vikram Mulukutla | 0b06290 | 2017-03-20 16:27:04 -0700 | [diff] [blame] | 390 | TRACE_EVENT(sched_update_task_ravg_mini, |
| 391 | |
| 392 | TP_PROTO(struct task_struct *p, struct rq *rq, enum task_event evt, |
| 393 | u64 wallclock, u64 irqtime, u64 cycles, u64 exec_time, |
| 394 | struct group_cpu_time *cpu_time), |
| 395 | |
| 396 | TP_ARGS(p, rq, evt, wallclock, irqtime, cycles, exec_time, cpu_time), |
| 397 | |
| 398 | TP_STRUCT__entry( |
| 399 | __array( char, comm, TASK_COMM_LEN ) |
| 400 | __field( pid_t, pid ) |
| 401 | __field( u64, wallclock ) |
| 402 | __field( u64, mark_start ) |
| 403 | __field( u64, delta_m ) |
| 404 | __field( u64, win_start ) |
| 405 | __field( u64, delta ) |
| 406 | __field(enum task_event, evt ) |
| 407 | __field(unsigned int, demand ) |
| 408 | __field( int, cpu ) |
| 409 | __field( u64, rq_cs ) |
| 410 | __field( u64, rq_ps ) |
| 411 | __field( u64, grp_cs ) |
| 412 | __field( u64, grp_ps ) |
| 413 | __field( u32, curr_window ) |
| 414 | __field( u32, prev_window ) |
| 415 | ), |
| 416 | |
| 417 | TP_fast_assign( |
| 418 | __entry->wallclock = wallclock; |
| 419 | __entry->win_start = rq->window_start; |
| 420 | __entry->delta = (wallclock - rq->window_start); |
| 421 | __entry->evt = evt; |
| 422 | __entry->cpu = rq->cpu; |
| 423 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 424 | __entry->pid = p->pid; |
| 425 | __entry->mark_start = p->ravg.mark_start; |
| 426 | __entry->delta_m = (wallclock - p->ravg.mark_start); |
| 427 | __entry->demand = p->ravg.demand; |
| 428 | __entry->rq_cs = rq->curr_runnable_sum; |
| 429 | __entry->rq_ps = rq->prev_runnable_sum; |
| 430 | __entry->grp_cs = cpu_time ? cpu_time->curr_runnable_sum : 0; |
| 431 | __entry->grp_ps = cpu_time ? cpu_time->prev_runnable_sum : 0; |
| 432 | __entry->curr_window = p->ravg.curr_window; |
| 433 | __entry->prev_window = p->ravg.prev_window; |
| 434 | ), |
| 435 | |
| 436 | TP_printk("wc %llu ws %llu delta %llu event %s cpu %d task %d (%s) ms %llu delta %llu demand %u rq_cs %llu rq_ps %llu cur_window %u prev_window %u grp_cs %lld grp_ps %lld", |
| 437 | __entry->wallclock, __entry->win_start, __entry->delta, |
| 438 | task_event_names[__entry->evt], __entry->cpu, |
| 439 | __entry->pid, __entry->comm, __entry->mark_start, |
| 440 | __entry->delta_m, __entry->demand, |
| 441 | __entry->rq_cs, __entry->rq_ps, __entry->curr_window, |
| 442 | __entry->prev_window, |
| 443 | __entry->grp_cs, |
| 444 | __entry->grp_ps) |
| 445 | ); |
| 446 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 447 | struct migration_sum_data; |
| 448 | extern const char *migrate_type_names[]; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 449 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 450 | TRACE_EVENT(sched_set_preferred_cluster, |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 451 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 452 | TP_PROTO(struct related_thread_group *grp, u64 total_demand), |
| 453 | |
| 454 | TP_ARGS(grp, total_demand), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 455 | |
| 456 | TP_STRUCT__entry( |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 457 | __field( int, id ) |
| 458 | __field( u64, demand ) |
| 459 | __field( int, cluster_first_cpu ) |
| 460 | __array( char, comm, TASK_COMM_LEN ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 461 | __field( pid_t, pid ) |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 462 | __field(unsigned int, task_demand ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 463 | ), |
| 464 | |
| 465 | TP_fast_assign( |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 466 | __entry->id = grp->id; |
| 467 | __entry->demand = total_demand; |
| 468 | __entry->cluster_first_cpu = grp->preferred_cluster ? |
| 469 | cluster_first_cpu(grp->preferred_cluster) |
| 470 | : -1; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 471 | ), |
| 472 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 473 | TP_printk("group_id %d total_demand %llu preferred_cluster_first_cpu %d", |
| 474 | __entry->id, __entry->demand, |
| 475 | __entry->cluster_first_cpu) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 476 | ); |
| 477 | |
| 478 | TRACE_EVENT(sched_migration_update_sum, |
| 479 | |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 480 | 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] | 481 | |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 482 | TP_ARGS(p, migrate_type, rq), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 483 | |
| 484 | TP_STRUCT__entry( |
| 485 | __field(int, tcpu ) |
| 486 | __field(int, pid ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 487 | __field(enum migrate_types, migrate_type ) |
| 488 | __field( s64, src_cs ) |
| 489 | __field( s64, src_ps ) |
| 490 | __field( s64, dst_cs ) |
| 491 | __field( s64, dst_ps ) |
| 492 | __field( s64, src_nt_cs ) |
| 493 | __field( s64, src_nt_ps ) |
| 494 | __field( s64, dst_nt_cs ) |
| 495 | __field( s64, dst_nt_ps ) |
| 496 | ), |
| 497 | |
| 498 | TP_fast_assign( |
| 499 | __entry->tcpu = task_cpu(p); |
| 500 | __entry->pid = p->pid; |
| 501 | __entry->migrate_type = migrate_type; |
Pavankumar Kondeti | 6deb2c4 | 2017-01-09 13:56:33 +0530 | [diff] [blame] | 502 | __entry->src_cs = __get_update_sum(rq, migrate_type, |
| 503 | true, false, true); |
| 504 | __entry->src_ps = __get_update_sum(rq, migrate_type, |
| 505 | true, false, false); |
| 506 | __entry->dst_cs = __get_update_sum(rq, migrate_type, |
| 507 | false, false, true); |
| 508 | __entry->dst_ps = __get_update_sum(rq, migrate_type, |
| 509 | false, false, false); |
| 510 | __entry->src_nt_cs = __get_update_sum(rq, migrate_type, |
| 511 | true, true, true); |
| 512 | __entry->src_nt_ps = __get_update_sum(rq, migrate_type, |
| 513 | true, true, false); |
| 514 | __entry->dst_nt_cs = __get_update_sum(rq, migrate_type, |
| 515 | false, true, true); |
| 516 | __entry->dst_nt_ps = __get_update_sum(rq, migrate_type, |
| 517 | false, true, false); |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 518 | ), |
| 519 | |
| 520 | 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", |
| 521 | __entry->pid, __entry->tcpu, migrate_type_names[__entry->migrate_type], |
| 522 | __entry->src_cs, __entry->src_ps, __entry->dst_cs, __entry->dst_ps, |
| 523 | __entry->src_nt_cs, __entry->src_nt_ps, __entry->dst_nt_cs, __entry->dst_nt_ps) |
| 524 | ); |
| 525 | |
Syed Rameez Mustafa | 20acfe7 | 2017-01-30 09:35:46 +0530 | [diff] [blame] | 526 | TRACE_EVENT(sched_set_boost, |
| 527 | |
| 528 | TP_PROTO(int type), |
| 529 | |
| 530 | TP_ARGS(type), |
| 531 | |
| 532 | TP_STRUCT__entry( |
| 533 | __field(int, type ) |
| 534 | ), |
| 535 | |
| 536 | TP_fast_assign( |
| 537 | __entry->type = type; |
| 538 | ), |
| 539 | |
| 540 | TP_printk("type %d", __entry->type) |
| 541 | ); |
| 542 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 543 | #endif |
| 544 | |
| 545 | #ifdef CONFIG_SCHED_WALT |
| 546 | DECLARE_EVENT_CLASS(sched_cpu_load, |
| 547 | |
| 548 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 549 | |
| 550 | TP_ARGS(rq, idle, irqload, power_cost, temp), |
| 551 | |
| 552 | TP_STRUCT__entry( |
| 553 | __field(unsigned int, cpu ) |
| 554 | __field(unsigned int, idle ) |
| 555 | __field(unsigned int, nr_running ) |
| 556 | __field(unsigned int, nr_big_tasks ) |
| 557 | __field(unsigned int, load_scale_factor ) |
| 558 | __field(unsigned int, capacity ) |
| 559 | __field( u64, cumulative_runnable_avg ) |
| 560 | __field( u64, irqload ) |
| 561 | __field(unsigned int, max_freq ) |
| 562 | __field(unsigned int, power_cost ) |
| 563 | __field( int, cstate ) |
| 564 | __field( int, dstate ) |
| 565 | __field( int, temp ) |
| 566 | ), |
| 567 | |
| 568 | TP_fast_assign( |
| 569 | __entry->cpu = rq->cpu; |
| 570 | __entry->idle = idle; |
| 571 | __entry->nr_running = rq->nr_running; |
| 572 | __entry->nr_big_tasks = rq->hmp_stats.nr_big_tasks; |
| 573 | __entry->load_scale_factor = cpu_load_scale_factor(rq->cpu); |
| 574 | __entry->capacity = cpu_capacity(rq->cpu); |
| 575 | __entry->cumulative_runnable_avg = rq->hmp_stats.cumulative_runnable_avg; |
| 576 | __entry->irqload = irqload; |
| 577 | __entry->max_freq = cpu_max_freq(rq->cpu); |
| 578 | __entry->power_cost = power_cost; |
| 579 | __entry->cstate = rq->cstate; |
| 580 | __entry->dstate = rq->cluster->dstate; |
| 581 | __entry->temp = temp; |
| 582 | ), |
| 583 | |
| 584 | 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", |
| 585 | __entry->cpu, __entry->idle, __entry->nr_running, __entry->nr_big_tasks, |
| 586 | __entry->load_scale_factor, __entry->capacity, |
| 587 | __entry->cumulative_runnable_avg, __entry->irqload, |
| 588 | __entry->max_freq, __entry->power_cost, __entry->cstate, |
| 589 | __entry->dstate, __entry->temp) |
| 590 | ); |
| 591 | |
| 592 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_lb, |
| 593 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 594 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 595 | ); |
| 596 | #endif |
| 597 | |
| 598 | #ifdef CONFIG_SCHED_HMP |
| 599 | |
| 600 | TRACE_EVENT(sched_task_load, |
| 601 | |
| 602 | TP_PROTO(struct task_struct *p, bool boost, int reason, |
| 603 | bool sync, bool need_idle, u32 flags, int best_cpu), |
| 604 | |
| 605 | TP_ARGS(p, boost, reason, sync, need_idle, flags, best_cpu), |
| 606 | |
| 607 | TP_STRUCT__entry( |
| 608 | __array( char, comm, TASK_COMM_LEN ) |
| 609 | __field( pid_t, pid ) |
| 610 | __field(unsigned int, demand ) |
| 611 | __field( bool, boost ) |
| 612 | __field( int, reason ) |
| 613 | __field( bool, sync ) |
| 614 | __field( bool, need_idle ) |
| 615 | __field( u32, flags ) |
| 616 | __field( int, best_cpu ) |
| 617 | __field( u64, latency ) |
| 618 | __field( int, grp_id ) |
| 619 | __field( u64, avg_burst ) |
| 620 | __field( u64, avg_sleep ) |
| 621 | ), |
| 622 | |
| 623 | TP_fast_assign( |
| 624 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 625 | __entry->pid = p->pid; |
| 626 | __entry->demand = p->ravg.demand; |
| 627 | __entry->boost = boost; |
| 628 | __entry->reason = reason; |
| 629 | __entry->sync = sync; |
| 630 | __entry->need_idle = need_idle; |
| 631 | __entry->flags = flags; |
| 632 | __entry->best_cpu = best_cpu; |
| 633 | __entry->latency = p->state == TASK_WAKING ? |
| 634 | sched_ktime_clock() - |
| 635 | p->ravg.mark_start : 0; |
| 636 | __entry->grp_id = p->grp ? p->grp->id : 0; |
| 637 | __entry->avg_burst = p->ravg.avg_burst; |
| 638 | __entry->avg_sleep = p->ravg.avg_sleep_time; |
| 639 | ), |
| 640 | |
| 641 | 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", |
| 642 | __entry->pid, __entry->comm, __entry->demand, |
| 643 | __entry->boost, __entry->reason, __entry->sync, |
| 644 | __entry->need_idle, __entry->flags, __entry->grp_id, |
| 645 | __entry->best_cpu, __entry->latency, __entry->avg_burst, |
| 646 | __entry->avg_sleep) |
| 647 | ); |
| 648 | |
| 649 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_wakeup, |
| 650 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 651 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 652 | ); |
| 653 | |
| 654 | DEFINE_EVENT(sched_cpu_load, sched_cpu_load_cgroup, |
| 655 | TP_PROTO(struct rq *rq, int idle, u64 irqload, unsigned int power_cost, int temp), |
| 656 | TP_ARGS(rq, idle, irqload, power_cost, temp) |
| 657 | ); |
| 658 | |
Joonwoo Park | f7d6cd4 | 2017-01-17 15:19:43 -0800 | [diff] [blame] | 659 | TRACE_EVENT(sched_reset_all_window_stats, |
| 660 | |
| 661 | TP_PROTO(u64 window_start, u64 window_size, u64 time_taken, |
| 662 | int reason, unsigned int old_val, unsigned int new_val), |
| 663 | |
| 664 | TP_ARGS(window_start, window_size, time_taken, |
| 665 | reason, old_val, new_val), |
| 666 | |
| 667 | TP_STRUCT__entry( |
| 668 | __field( u64, window_start ) |
| 669 | __field( u64, window_size ) |
| 670 | __field( u64, time_taken ) |
| 671 | __field( int, reason ) |
| 672 | __field(unsigned int, old_val ) |
| 673 | __field(unsigned int, new_val ) |
| 674 | ), |
| 675 | |
| 676 | TP_fast_assign( |
| 677 | __entry->window_start = window_start; |
| 678 | __entry->window_size = window_size; |
| 679 | __entry->time_taken = time_taken; |
| 680 | __entry->reason = reason; |
| 681 | __entry->old_val = old_val; |
| 682 | __entry->new_val = new_val; |
| 683 | ), |
| 684 | |
| 685 | TP_printk("time_taken %llu window_start %llu window_size %llu reason %s old_val %u new_val %u", |
| 686 | __entry->time_taken, __entry->window_start, |
| 687 | __entry->window_size, |
| 688 | sched_window_reset_reasons[__entry->reason], |
| 689 | __entry->old_val, __entry->new_val) |
| 690 | ); |
| 691 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 692 | TRACE_EVENT(sched_get_busy, |
| 693 | |
| 694 | TP_PROTO(int cpu, u64 load, u64 nload, u64 pload, int early), |
| 695 | |
| 696 | TP_ARGS(cpu, load, nload, pload, early), |
| 697 | |
| 698 | TP_STRUCT__entry( |
| 699 | __field( int, cpu ) |
| 700 | __field( u64, load ) |
| 701 | __field( u64, nload ) |
| 702 | __field( u64, pload ) |
| 703 | __field( int, early ) |
| 704 | ), |
| 705 | |
| 706 | TP_fast_assign( |
| 707 | __entry->cpu = cpu; |
| 708 | __entry->load = load; |
| 709 | __entry->nload = nload; |
| 710 | __entry->pload = pload; |
| 711 | __entry->early = early; |
| 712 | ), |
| 713 | |
| 714 | TP_printk("cpu %d load %lld new_task_load %lld predicted_load %lld early %d", |
| 715 | __entry->cpu, __entry->load, __entry->nload, |
| 716 | __entry->pload, __entry->early) |
| 717 | ); |
| 718 | |
| 719 | TRACE_EVENT(sched_freq_alert, |
| 720 | |
| 721 | TP_PROTO(int cpu, int pd_notif, int check_groups, struct rq *rq, |
| 722 | u64 new_load), |
| 723 | |
| 724 | TP_ARGS(cpu, pd_notif, check_groups, rq, new_load), |
| 725 | |
| 726 | TP_STRUCT__entry( |
| 727 | __field( int, cpu ) |
| 728 | __field( int, pd_notif ) |
| 729 | __field( int, check_groups ) |
| 730 | __field( u64, old_busy_time ) |
| 731 | __field( u64, ps ) |
| 732 | __field( u64, new_load ) |
| 733 | __field( u64, old_pred ) |
| 734 | __field( u64, new_pred ) |
| 735 | ), |
| 736 | |
| 737 | TP_fast_assign( |
| 738 | __entry->cpu = cpu; |
| 739 | __entry->pd_notif = pd_notif; |
| 740 | __entry->check_groups = check_groups; |
| 741 | __entry->old_busy_time = rq->old_busy_time; |
| 742 | __entry->ps = rq->prev_runnable_sum; |
| 743 | __entry->new_load = new_load; |
| 744 | __entry->old_pred = rq->old_estimated_time; |
| 745 | __entry->new_pred = rq->hmp_stats.pred_demands_sum; |
| 746 | ), |
| 747 | |
| 748 | 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", |
| 749 | __entry->cpu, __entry->pd_notif, __entry->check_groups, |
| 750 | __entry->old_busy_time, __entry->ps, __entry->new_load, |
| 751 | __entry->old_pred, __entry->new_pred) |
| 752 | ); |
| 753 | |
| 754 | #endif /* CONFIG_SCHED_HMP */ |
| 755 | |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 756 | #ifdef CONFIG_SMP |
| 757 | TRACE_EVENT(sched_cpu_util, |
| 758 | |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 759 | TP_PROTO(struct task_struct *p, int cpu, int task_util, unsigned long curr_util, unsigned long new_cum_util, int sync), |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 760 | |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 761 | TP_ARGS(p, cpu, task_util, curr_util, new_cum_util, sync), |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 762 | |
| 763 | TP_STRUCT__entry( |
| 764 | __array(char, comm, TASK_COMM_LEN ) |
| 765 | __field(int, pid ) |
| 766 | __field(unsigned int, cpu ) |
| 767 | __field(int, task_util ) |
| 768 | __field(unsigned int, nr_running ) |
| 769 | __field(long, cpu_util ) |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 770 | __field(long, cpu_util_cum ) |
| 771 | __field(long, new_cum_util ) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 772 | __field(unsigned int, capacity_curr ) |
| 773 | __field(unsigned int, capacity ) |
Joonwoo Park | 449182f | 2017-01-30 21:04:36 -0800 | [diff] [blame] | 774 | __field(unsigned long, curr_util ) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 775 | __field(int, sync ) |
| 776 | __field(int, idle_state ) |
Joonwoo Park | 7b211a4 | 2017-01-31 18:26:42 -0800 | [diff] [blame] | 777 | __field(unsigned int, irqload ) |
| 778 | __field(int, high_irqload ) |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 779 | __field(int, task_in_cum_demand ) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 780 | ), |
| 781 | |
| 782 | TP_fast_assign( |
| 783 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 784 | __entry->pid = p->pid; |
| 785 | __entry->cpu = cpu; |
| 786 | __entry->task_util = task_util; |
| 787 | __entry->nr_running = cpu_rq(cpu)->nr_running; |
| 788 | __entry->cpu_util = cpu_util(cpu); |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 789 | __entry->cpu_util_cum = cpu_util_cum(cpu, 0); |
| 790 | __entry->new_cum_util = new_cum_util; |
| 791 | __entry->task_in_cum_demand = task_in_cum_window_demand(cpu_rq(cpu), p); |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 792 | __entry->capacity_curr = capacity_curr_of(cpu); |
| 793 | __entry->capacity = capacity_of(cpu); |
Joonwoo Park | 449182f | 2017-01-30 21:04:36 -0800 | [diff] [blame] | 794 | __entry->curr_util = curr_util; |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 795 | __entry->sync = sync; |
| 796 | __entry->idle_state = idle_get_state_idx(cpu_rq(cpu)); |
Joonwoo Park | 7b211a4 | 2017-01-31 18:26:42 -0800 | [diff] [blame] | 797 | __entry->irqload = sched_irqload(cpu); |
| 798 | __entry->high_irqload = sched_cpu_high_irqload(cpu); |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 799 | ), |
| 800 | |
Joonwoo Park | e19cd6f | 2017-02-03 14:32:49 -0800 | [diff] [blame] | 801 | TP_printk("comm=%s pid=%d cpu=%d task_util=%d nr_running=%d cpu_util=%ld cpu_util_cum=%ld new_cum_util=%ld task_in_cum=%d capacity_curr=%u capacity=%u curr_util=%ld sync=%d idle_state=%d irqload=%u high_irqload=%u", |
| 802 | __entry->comm, __entry->pid, __entry->cpu, __entry->task_util, __entry->nr_running, __entry->cpu_util, __entry->cpu_util_cum, __entry->new_cum_util, __entry->task_in_cum_demand, __entry->capacity_curr, __entry->capacity, __entry->curr_util, __entry->sync, __entry->idle_state, __entry->irqload, __entry->high_irqload) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 803 | ); |
| 804 | |
Joonwoo Park | 6939ca6 | 2017-02-17 22:17:51 -0800 | [diff] [blame] | 805 | TRACE_EVENT(sched_energy_diff_packing, |
| 806 | |
| 807 | TP_PROTO(struct task_struct *p, unsigned long task_util, |
| 808 | int targeted_cpus, int nrg_pack, int nrg_spread), |
| 809 | |
| 810 | TP_ARGS(p, task_util, targeted_cpus, nrg_pack, nrg_spread), |
| 811 | |
| 812 | TP_STRUCT__entry( |
| 813 | __array(char, comm, TASK_COMM_LEN ) |
| 814 | __field(int, pid ) |
| 815 | __field(unsigned long, task_util ) |
| 816 | __field(int, targeted_cpus ) |
| 817 | __field(int, nrg_pack ) |
| 818 | __field(int, nrg_spread ) |
| 819 | ), |
| 820 | |
| 821 | TP_fast_assign( |
| 822 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 823 | __entry->pid = p->pid; |
| 824 | __entry->task_util = task_util; |
| 825 | __entry->targeted_cpus = targeted_cpus; |
| 826 | __entry->nrg_pack = nrg_pack; |
| 827 | __entry->nrg_spread = nrg_spread; |
| 828 | ), |
| 829 | |
| 830 | TP_printk("comm=%s pid=%d task_util=%lu targeted_cpus=%d nrg_pack=%d nrg_spread=%d nrg_diff=%d", |
| 831 | __entry->comm, __entry->pid, __entry->task_util, |
| 832 | __entry->targeted_cpus, __entry->nrg_pack, |
| 833 | __entry->nrg_spread, __entry->nrg_pack - __entry->nrg_spread) |
| 834 | ); |
| 835 | |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 836 | DECLARE_EVENT_CLASS(sched_task_util, |
| 837 | |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 838 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 839 | |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 840 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle), |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 841 | |
| 842 | TP_STRUCT__entry( |
| 843 | __array(char, comm, TASK_COMM_LEN ) |
| 844 | __field(int, pid ) |
| 845 | __field(int, task_cpu ) |
| 846 | __field(unsigned long, task_util ) |
| 847 | __field(unsigned long, cpu_util_freq ) |
| 848 | __field(int, nominated_cpu ) |
| 849 | __field(int, target_cpu ) |
| 850 | __field(int, ediff ) |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 851 | __field(bool, need_idle ) |
Syed Rameez Mustafa | e2ccaa2 | 2017-04-05 12:35:25 -0700 | [diff] [blame] | 852 | __field(u64, latency ) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 853 | ), |
| 854 | |
| 855 | TP_fast_assign( |
| 856 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 857 | __entry->pid = p->pid; |
| 858 | __entry->task_cpu = task_cpu; |
| 859 | __entry->task_util = task_util; |
| 860 | __entry->cpu_util_freq = cpu_util_freq(target_cpu, NULL); |
| 861 | __entry->nominated_cpu = nominated_cpu; |
| 862 | __entry->target_cpu = target_cpu; |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 863 | __entry->ediff = ediff; |
| 864 | __entry->need_idle = need_idle; |
Joonwoo Park | 8fc9131 | 2017-06-07 15:10:58 -0700 | [diff] [blame] | 865 | __entry->latency = p->ravg.mark_start ? |
| 866 | sched_ktime_clock() - |
| 867 | p->ravg.mark_start : 0; |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 868 | ), |
| 869 | |
Syed Rameez Mustafa | e2ccaa2 | 2017-04-05 12:35:25 -0700 | [diff] [blame] | 870 | TP_printk("comm=%s pid=%d task_cpu=%d task_util=%lu nominated_cpu=%d target_cpu=%d energy_diff=%d need_idle=%d latency=%llu", |
| 871 | __entry->comm, __entry->pid, __entry->task_cpu, __entry->task_util, __entry->nominated_cpu, __entry->target_cpu, __entry->ediff, __entry->need_idle, __entry->latency) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 872 | ); |
| 873 | |
Syed Rameez Mustafa | 20acfe7 | 2017-01-30 09:35:46 +0530 | [diff] [blame] | 874 | DEFINE_EVENT(sched_task_util, sched_task_util_bias_to_waker, |
| 875 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 876 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
| 877 | ); |
| 878 | |
| 879 | DEFINE_EVENT(sched_task_util, sched_task_util_colocated, |
| 880 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 881 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
| 882 | ); |
| 883 | |
Pavankumar Kondeti | eb486cc | 2017-06-19 15:28:50 +0530 | [diff] [blame] | 884 | DEFINE_EVENT(sched_task_util, sched_task_util_boosted, |
| 885 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 886 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
| 887 | ); |
| 888 | |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 889 | DEFINE_EVENT(sched_task_util, sched_task_util_overutilzed, |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 890 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 891 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 892 | ); |
| 893 | |
| 894 | DEFINE_EVENT(sched_task_util, sched_task_util_energy_diff, |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 895 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 896 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 897 | ); |
| 898 | |
| 899 | DEFINE_EVENT(sched_task_util, sched_task_util_energy_aware, |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 900 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 901 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 902 | ); |
Joonwoo Park | 12084a1 | 2017-02-16 16:46:27 -0800 | [diff] [blame] | 903 | |
| 904 | DEFINE_EVENT(sched_task_util, sched_task_util_imbalance, |
Joonwoo Park | 4fdf00d | 2017-02-17 11:42:44 -0800 | [diff] [blame] | 905 | TP_PROTO(struct task_struct *p, int task_cpu, unsigned long task_util, int nominated_cpu, int target_cpu, int ediff, bool need_idle), |
| 906 | TP_ARGS(p, task_cpu, task_util, nominated_cpu, target_cpu, ediff, need_idle) |
Joonwoo Park | 12084a1 | 2017-02-16 16:46:27 -0800 | [diff] [blame] | 907 | ); |
Joonwoo Park | cc7d127 | 2017-01-26 14:47:00 -0800 | [diff] [blame] | 908 | #endif |
| 909 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 910 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 911 | * Tracepoint for waking up a task: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 912 | */ |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 913 | DECLARE_EVENT_CLASS(sched_wakeup_template, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 914 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 915 | TP_PROTO(struct task_struct *p), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 916 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 917 | TP_ARGS(__perf_task(p)), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 918 | |
| 919 | TP_STRUCT__entry( |
| 920 | __array( char, comm, TASK_COMM_LEN ) |
| 921 | __field( pid_t, pid ) |
| 922 | __field( int, prio ) |
| 923 | __field( int, success ) |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 924 | __field( int, target_cpu ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 925 | ), |
| 926 | |
| 927 | TP_fast_assign( |
| 928 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 929 | __entry->pid = p->pid; |
| 930 | __entry->prio = p->prio; |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 931 | __entry->success = 1; /* rudiment, kill when possible */ |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 932 | __entry->target_cpu = task_cpu(p); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 933 | ), |
| 934 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 935 | TP_printk("comm=%s pid=%d prio=%d target_cpu=%03d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 936 | __entry->comm, __entry->pid, __entry->prio, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 937 | __entry->target_cpu) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 938 | ); |
| 939 | |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 940 | /* |
| 941 | * Tracepoint called when waking a task; this tracepoint is guaranteed to be |
| 942 | * called from the waking context. |
| 943 | */ |
| 944 | DEFINE_EVENT(sched_wakeup_template, sched_waking, |
| 945 | TP_PROTO(struct task_struct *p), |
| 946 | TP_ARGS(p)); |
| 947 | |
| 948 | /* |
| 949 | * Tracepoint called when the task is actually woken; p->state == TASK_RUNNNG. |
| 950 | * It it not always called from the waking context. |
| 951 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 952 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 953 | TP_PROTO(struct task_struct *p), |
| 954 | TP_ARGS(p)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 955 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 956 | /* |
| 957 | * Tracepoint for waking up a new task: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 958 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 959 | DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new, |
Peter Zijlstra | fbd705a | 2015-06-09 11:13:36 +0200 | [diff] [blame] | 960 | TP_PROTO(struct task_struct *p), |
| 961 | TP_ARGS(p)); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 962 | |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 963 | #ifdef CREATE_TRACE_POINTS |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 964 | 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] | 965 | { |
Oleg Nesterov | 8f9fbf0 | 2014-10-07 21:51:08 +0200 | [diff] [blame] | 966 | #ifdef CONFIG_SCHED_DEBUG |
| 967 | BUG_ON(p != current); |
| 968 | #endif /* CONFIG_SCHED_DEBUG */ |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 969 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 970 | /* |
| 971 | * Preemption ignores task state, therefore preempted tasks are always |
| 972 | * RUNNING (we will not have dequeued if state != RUNNING). |
| 973 | */ |
| 974 | return preempt ? TASK_RUNNING | TASK_STATE_MAX : p->state; |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 975 | } |
Oleg Nesterov | 8f9fbf0 | 2014-10-07 21:51:08 +0200 | [diff] [blame] | 976 | #endif /* CREATE_TRACE_POINTS */ |
Peter Zijlstra | 02f7269 | 2010-05-31 18:13:25 +0200 | [diff] [blame] | 977 | |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 978 | /* |
| 979 | * Tracepoint for task switches, performed by the scheduler: |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 980 | */ |
| 981 | TRACE_EVENT(sched_switch, |
| 982 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 983 | TP_PROTO(bool preempt, |
| 984 | struct task_struct *prev, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 985 | struct task_struct *next), |
| 986 | |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 987 | TP_ARGS(preempt, prev, next), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 988 | |
| 989 | TP_STRUCT__entry( |
| 990 | __array( char, prev_comm, TASK_COMM_LEN ) |
| 991 | __field( pid_t, prev_pid ) |
| 992 | __field( int, prev_prio ) |
Steven Rostedt | 937cdb9 | 2009-05-15 10:51:13 -0400 | [diff] [blame] | 993 | __field( long, prev_state ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 994 | __array( char, next_comm, TASK_COMM_LEN ) |
| 995 | __field( pid_t, next_pid ) |
| 996 | __field( int, next_prio ) |
| 997 | ), |
| 998 | |
| 999 | TP_fast_assign( |
| 1000 | memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); |
| 1001 | __entry->prev_pid = prev->pid; |
| 1002 | __entry->prev_prio = prev->prio; |
Peter Zijlstra | c73464b | 2015-09-28 18:06:56 +0200 | [diff] [blame] | 1003 | __entry->prev_state = __trace_sched_switch_state(preempt, prev); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1004 | memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); |
| 1005 | __entry->next_pid = next->pid; |
| 1006 | __entry->next_prio = next->prio; |
| 1007 | ), |
| 1008 | |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 1009 | 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] | 1010 | __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 1011 | __entry->prev_state & (TASK_STATE_MAX-1) ? |
| 1012 | __print_flags(__entry->prev_state & (TASK_STATE_MAX-1), "|", |
Steven Rostedt | 937cdb9 | 2009-05-15 10:51:13 -0400 | [diff] [blame] | 1013 | { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" }, |
| 1014 | { 16, "Z" }, { 32, "X" }, { 64, "x" }, |
Peter Zijlstra | 80ed87c | 2015-05-08 14:23:45 +0200 | [diff] [blame] | 1015 | { 128, "K" }, { 256, "W" }, { 512, "P" }, |
| 1016 | { 1024, "N" }) : "R", |
Peter Zijlstra | 557ab42 | 2011-09-16 11:16:43 +0200 | [diff] [blame] | 1017 | __entry->prev_state & TASK_STATE_MAX ? "+" : "", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1018 | __entry->next_comm, __entry->next_pid, __entry->next_prio) |
| 1019 | ); |
| 1020 | |
| 1021 | /* |
| 1022 | * Tracepoint for a task being migrated: |
| 1023 | */ |
| 1024 | TRACE_EVENT(sched_migrate_task, |
| 1025 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1026 | TP_PROTO(struct task_struct *p, int dest_cpu, unsigned int load), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1027 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1028 | TP_ARGS(p, dest_cpu, load), |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1029 | |
| 1030 | TP_STRUCT__entry( |
| 1031 | __array( char, comm, TASK_COMM_LEN ) |
| 1032 | __field( pid_t, pid ) |
| 1033 | __field( int, prio ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1034 | __field(unsigned int, load ) |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1035 | __field( int, orig_cpu ) |
| 1036 | __field( int, dest_cpu ) |
| 1037 | ), |
| 1038 | |
| 1039 | TP_fast_assign( |
| 1040 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 1041 | __entry->pid = p->pid; |
| 1042 | __entry->prio = p->prio; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1043 | __entry->load = load; |
Mathieu Desnoyers | de1d728 | 2009-05-05 16:49:59 +0800 | [diff] [blame] | 1044 | __entry->orig_cpu = task_cpu(p); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1045 | __entry->dest_cpu = dest_cpu; |
| 1046 | ), |
| 1047 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1048 | TP_printk("comm=%s pid=%d prio=%d load=%d orig_cpu=%d dest_cpu=%d", |
| 1049 | __entry->comm, __entry->pid, __entry->prio, __entry->load, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1050 | __entry->orig_cpu, __entry->dest_cpu) |
| 1051 | ); |
| 1052 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1053 | /* |
| 1054 | * Tracepoint for a CPU going offline/online: |
| 1055 | */ |
| 1056 | TRACE_EVENT(sched_cpu_hotplug, |
| 1057 | |
| 1058 | TP_PROTO(int affected_cpu, int error, int status), |
| 1059 | |
| 1060 | TP_ARGS(affected_cpu, error, status), |
| 1061 | |
| 1062 | TP_STRUCT__entry( |
| 1063 | __field( int, affected_cpu ) |
| 1064 | __field( int, error ) |
| 1065 | __field( int, status ) |
| 1066 | ), |
| 1067 | |
| 1068 | TP_fast_assign( |
| 1069 | __entry->affected_cpu = affected_cpu; |
| 1070 | __entry->error = error; |
| 1071 | __entry->status = status; |
| 1072 | ), |
| 1073 | |
| 1074 | TP_printk("cpu %d %s error=%d", __entry->affected_cpu, |
| 1075 | __entry->status ? "online" : "offline", __entry->error) |
| 1076 | ); |
| 1077 | |
| 1078 | /* |
| 1079 | * Tracepoint for load balancing: |
| 1080 | */ |
| 1081 | #if NR_CPUS > 32 |
| 1082 | #error "Unsupported NR_CPUS for lb tracepoint." |
| 1083 | #endif |
| 1084 | TRACE_EVENT(sched_load_balance, |
| 1085 | |
| 1086 | TP_PROTO(int cpu, enum cpu_idle_type idle, int balance, |
| 1087 | unsigned long group_mask, int busiest_nr_running, |
| 1088 | unsigned long imbalance, unsigned int env_flags, int ld_moved, |
| 1089 | unsigned int balance_interval), |
| 1090 | |
| 1091 | TP_ARGS(cpu, idle, balance, group_mask, busiest_nr_running, |
| 1092 | imbalance, env_flags, ld_moved, balance_interval), |
| 1093 | |
| 1094 | TP_STRUCT__entry( |
| 1095 | __field( int, cpu) |
| 1096 | __field( enum cpu_idle_type, idle) |
| 1097 | __field( int, balance) |
| 1098 | __field( unsigned long, group_mask) |
| 1099 | __field( int, busiest_nr_running) |
| 1100 | __field( unsigned long, imbalance) |
| 1101 | __field( unsigned int, env_flags) |
| 1102 | __field( int, ld_moved) |
| 1103 | __field( unsigned int, balance_interval) |
| 1104 | ), |
| 1105 | |
| 1106 | TP_fast_assign( |
| 1107 | __entry->cpu = cpu; |
| 1108 | __entry->idle = idle; |
| 1109 | __entry->balance = balance; |
| 1110 | __entry->group_mask = group_mask; |
| 1111 | __entry->busiest_nr_running = busiest_nr_running; |
| 1112 | __entry->imbalance = imbalance; |
| 1113 | __entry->env_flags = env_flags; |
| 1114 | __entry->ld_moved = ld_moved; |
| 1115 | __entry->balance_interval = balance_interval; |
| 1116 | ), |
| 1117 | |
| 1118 | TP_printk("cpu=%d state=%s balance=%d group=%#lx busy_nr=%d imbalance=%ld flags=%#x ld_moved=%d bal_int=%d", |
| 1119 | __entry->cpu, |
| 1120 | __entry->idle == CPU_IDLE ? "idle" : |
| 1121 | (__entry->idle == CPU_NEWLY_IDLE ? "newly_idle" : "busy"), |
| 1122 | __entry->balance, |
| 1123 | __entry->group_mask, __entry->busiest_nr_running, |
| 1124 | __entry->imbalance, __entry->env_flags, __entry->ld_moved, |
| 1125 | __entry->balance_interval) |
| 1126 | ); |
| 1127 | |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 1128 | DECLARE_EVENT_CLASS(sched_process_template, |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1129 | |
| 1130 | TP_PROTO(struct task_struct *p), |
| 1131 | |
| 1132 | TP_ARGS(p), |
| 1133 | |
| 1134 | TP_STRUCT__entry( |
| 1135 | __array( char, comm, TASK_COMM_LEN ) |
| 1136 | __field( pid_t, pid ) |
| 1137 | __field( int, prio ) |
| 1138 | ), |
| 1139 | |
| 1140 | TP_fast_assign( |
| 1141 | memcpy(__entry->comm, p->comm, TASK_COMM_LEN); |
| 1142 | __entry->pid = p->pid; |
| 1143 | __entry->prio = p->prio; |
| 1144 | ), |
| 1145 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1146 | TP_printk("comm=%s pid=%d prio=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1147 | __entry->comm, __entry->pid, __entry->prio) |
| 1148 | ); |
| 1149 | |
| 1150 | /* |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1151 | * Tracepoint for freeing a task: |
| 1152 | */ |
| 1153 | DEFINE_EVENT(sched_process_template, sched_process_free, |
| 1154 | TP_PROTO(struct task_struct *p), |
| 1155 | TP_ARGS(p)); |
Riley Andrews | 9de15b4 | 2015-10-02 00:39:53 -0700 | [diff] [blame] | 1156 | |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1157 | |
| 1158 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1159 | * Tracepoint for a task exiting: |
| 1160 | */ |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1161 | DEFINE_EVENT(sched_process_template, sched_process_exit, |
| 1162 | TP_PROTO(struct task_struct *p), |
| 1163 | TP_ARGS(p)); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1164 | |
| 1165 | /* |
Li Zefan | 210f766 | 2010-05-24 16:23:35 +0800 | [diff] [blame] | 1166 | * Tracepoint for waiting on task to unschedule: |
| 1167 | */ |
| 1168 | DEFINE_EVENT(sched_process_template, sched_wait_task, |
| 1169 | TP_PROTO(struct task_struct *p), |
| 1170 | TP_ARGS(p)); |
| 1171 | |
| 1172 | /* |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1173 | * Tracepoint for a waiting task: |
| 1174 | */ |
| 1175 | TRACE_EVENT(sched_process_wait, |
| 1176 | |
| 1177 | TP_PROTO(struct pid *pid), |
| 1178 | |
| 1179 | TP_ARGS(pid), |
| 1180 | |
| 1181 | TP_STRUCT__entry( |
| 1182 | __array( char, comm, TASK_COMM_LEN ) |
| 1183 | __field( pid_t, pid ) |
| 1184 | __field( int, prio ) |
| 1185 | ), |
| 1186 | |
| 1187 | TP_fast_assign( |
| 1188 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
| 1189 | __entry->pid = pid_nr(pid); |
| 1190 | __entry->prio = current->prio; |
| 1191 | ), |
| 1192 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1193 | TP_printk("comm=%s pid=%d prio=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1194 | __entry->comm, __entry->pid, __entry->prio) |
| 1195 | ); |
| 1196 | |
| 1197 | /* |
| 1198 | * Tracepoint for do_fork: |
| 1199 | */ |
| 1200 | TRACE_EVENT(sched_process_fork, |
| 1201 | |
| 1202 | TP_PROTO(struct task_struct *parent, struct task_struct *child), |
| 1203 | |
| 1204 | TP_ARGS(parent, child), |
| 1205 | |
| 1206 | TP_STRUCT__entry( |
| 1207 | __array( char, parent_comm, TASK_COMM_LEN ) |
| 1208 | __field( pid_t, parent_pid ) |
| 1209 | __array( char, child_comm, TASK_COMM_LEN ) |
| 1210 | __field( pid_t, child_pid ) |
| 1211 | ), |
| 1212 | |
| 1213 | TP_fast_assign( |
| 1214 | memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN); |
| 1215 | __entry->parent_pid = parent->pid; |
| 1216 | memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN); |
| 1217 | __entry->child_pid = child->pid; |
| 1218 | ), |
| 1219 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1220 | TP_printk("comm=%s pid=%d child_comm=%s child_pid=%d", |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1221 | __entry->parent_comm, __entry->parent_pid, |
| 1222 | __entry->child_comm, __entry->child_pid) |
| 1223 | ); |
| 1224 | |
| 1225 | /* |
David Smith | 4ff16c2 | 2012-02-07 10:11:05 -0600 | [diff] [blame] | 1226 | * Tracepoint for exec: |
| 1227 | */ |
| 1228 | TRACE_EVENT(sched_process_exec, |
| 1229 | |
| 1230 | TP_PROTO(struct task_struct *p, pid_t old_pid, |
| 1231 | struct linux_binprm *bprm), |
| 1232 | |
| 1233 | TP_ARGS(p, old_pid, bprm), |
| 1234 | |
| 1235 | TP_STRUCT__entry( |
| 1236 | __string( filename, bprm->filename ) |
| 1237 | __field( pid_t, pid ) |
| 1238 | __field( pid_t, old_pid ) |
| 1239 | ), |
| 1240 | |
| 1241 | TP_fast_assign( |
| 1242 | __assign_str(filename, bprm->filename); |
| 1243 | __entry->pid = p->pid; |
Oleg Nesterov | 6308191 | 2012-03-30 18:26:36 +0200 | [diff] [blame] | 1244 | __entry->old_pid = old_pid; |
David Smith | 4ff16c2 | 2012-02-07 10:11:05 -0600 | [diff] [blame] | 1245 | ), |
| 1246 | |
| 1247 | TP_printk("filename=%s pid=%d old_pid=%d", __get_str(filename), |
| 1248 | __entry->pid, __entry->old_pid) |
| 1249 | ); |
| 1250 | |
| 1251 | /* |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1252 | * XXX the below sched_stat tracepoints only apply to SCHED_OTHER/BATCH/IDLE |
| 1253 | * adding sched_stat support to SCHED_FIFO/RR would be welcome. |
| 1254 | */ |
Ingo Molnar | 091ad36 | 2009-11-26 09:04:55 +0100 | [diff] [blame] | 1255 | DECLARE_EVENT_CLASS(sched_stat_template, |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1256 | |
| 1257 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1258 | |
Oleg Nesterov | 1247396 | 2013-08-06 18:08:44 +0200 | [diff] [blame] | 1259 | TP_ARGS(__perf_task(tsk), __perf_count(delay)), |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1260 | |
| 1261 | TP_STRUCT__entry( |
| 1262 | __array( char, comm, TASK_COMM_LEN ) |
| 1263 | __field( pid_t, pid ) |
| 1264 | __field( u64, delay ) |
| 1265 | ), |
| 1266 | |
| 1267 | TP_fast_assign( |
| 1268 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1269 | __entry->pid = tsk->pid; |
| 1270 | __entry->delay = delay; |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1271 | ), |
| 1272 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1273 | TP_printk("comm=%s pid=%d delay=%Lu [ns]", |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1274 | __entry->comm, __entry->pid, |
| 1275 | (unsigned long long)__entry->delay) |
| 1276 | ); |
| 1277 | |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1278 | |
| 1279 | /* |
| 1280 | * Tracepoint for accounting wait time (time the task is runnable |
| 1281 | * but not actually running due to scheduler contention). |
| 1282 | */ |
| 1283 | DEFINE_EVENT(sched_stat_template, sched_stat_wait, |
| 1284 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1285 | TP_ARGS(tsk, delay)); |
| 1286 | |
| 1287 | /* |
| 1288 | * Tracepoint for accounting sleep time (time the task is not runnable, |
| 1289 | * including iowait, see below). |
| 1290 | */ |
Li Zefan | 470dda74 | 2009-11-26 15:08:01 +0800 | [diff] [blame] | 1291 | DEFINE_EVENT(sched_stat_template, sched_stat_sleep, |
| 1292 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1293 | TP_ARGS(tsk, delay)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1294 | |
| 1295 | /* |
| 1296 | * Tracepoint for accounting iowait time (time the task is not runnable |
| 1297 | * due to waiting on IO to complete). |
| 1298 | */ |
Li Zefan | 470dda74 | 2009-11-26 15:08:01 +0800 | [diff] [blame] | 1299 | DEFINE_EVENT(sched_stat_template, sched_stat_iowait, |
| 1300 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1301 | TP_ARGS(tsk, delay)); |
Steven Rostedt | 75ec29a | 2009-11-18 20:48:08 -0500 | [diff] [blame] | 1302 | |
Peter Zijlstra | 768d0c2 | 2009-07-23 20:13:26 +0200 | [diff] [blame] | 1303 | /* |
Andrew Vagin | b781a60 | 2011-11-28 12:03:35 +0300 | [diff] [blame] | 1304 | * Tracepoint for accounting blocked time (time the task is in uninterruptible). |
| 1305 | */ |
| 1306 | DEFINE_EVENT(sched_stat_template, sched_stat_blocked, |
| 1307 | TP_PROTO(struct task_struct *tsk, u64 delay), |
| 1308 | TP_ARGS(tsk, delay)); |
| 1309 | |
| 1310 | /* |
Riley Andrews | 9de15b4 | 2015-10-02 00:39:53 -0700 | [diff] [blame] | 1311 | * Tracepoint for recording the cause of uninterruptible sleep. |
| 1312 | */ |
| 1313 | TRACE_EVENT(sched_blocked_reason, |
| 1314 | |
| 1315 | TP_PROTO(struct task_struct *tsk), |
| 1316 | |
| 1317 | TP_ARGS(tsk), |
| 1318 | |
| 1319 | TP_STRUCT__entry( |
| 1320 | __field( pid_t, pid ) |
| 1321 | __field( void*, caller ) |
| 1322 | __field( bool, io_wait ) |
| 1323 | ), |
| 1324 | |
| 1325 | TP_fast_assign( |
| 1326 | __entry->pid = tsk->pid; |
| 1327 | __entry->caller = (void*)get_wchan(tsk); |
| 1328 | __entry->io_wait = tsk->in_iowait; |
| 1329 | ), |
| 1330 | |
| 1331 | TP_printk("pid=%d iowait=%d caller=%pS", __entry->pid, __entry->io_wait, __entry->caller) |
| 1332 | ); |
| 1333 | |
| 1334 | /* |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1335 | * Tracepoint for accounting runtime (time the task is executing |
| 1336 | * on a CPU). |
| 1337 | */ |
Oleg Nesterov | 36009d07 | 2013-08-06 18:08:41 +0200 | [diff] [blame] | 1338 | DECLARE_EVENT_CLASS(sched_stat_runtime, |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1339 | |
| 1340 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), |
| 1341 | |
Oleg Nesterov | 1247396 | 2013-08-06 18:08:44 +0200 | [diff] [blame] | 1342 | TP_ARGS(tsk, __perf_count(runtime), vruntime), |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1343 | |
| 1344 | TP_STRUCT__entry( |
| 1345 | __array( char, comm, TASK_COMM_LEN ) |
| 1346 | __field( pid_t, pid ) |
| 1347 | __field( u64, runtime ) |
| 1348 | __field( u64, vruntime ) |
| 1349 | ), |
| 1350 | |
| 1351 | TP_fast_assign( |
| 1352 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1353 | __entry->pid = tsk->pid; |
| 1354 | __entry->runtime = runtime; |
| 1355 | __entry->vruntime = vruntime; |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1356 | ), |
| 1357 | |
Ingo Molnar | 434a83c | 2009-10-15 11:50:39 +0200 | [diff] [blame] | 1358 | TP_printk("comm=%s pid=%d runtime=%Lu [ns] vruntime=%Lu [ns]", |
Ingo Molnar | f977bb4 | 2009-09-13 18:15:54 +0200 | [diff] [blame] | 1359 | __entry->comm, __entry->pid, |
| 1360 | (unsigned long long)__entry->runtime, |
| 1361 | (unsigned long long)__entry->vruntime) |
| 1362 | ); |
| 1363 | |
Oleg Nesterov | 36009d07 | 2013-08-06 18:08:41 +0200 | [diff] [blame] | 1364 | DEFINE_EVENT(sched_stat_runtime, sched_stat_runtime, |
| 1365 | TP_PROTO(struct task_struct *tsk, u64 runtime, u64 vruntime), |
| 1366 | TP_ARGS(tsk, runtime, vruntime)); |
| 1367 | |
Steven Rostedt | a802707 | 2010-09-20 15:13:34 -0400 | [diff] [blame] | 1368 | /* |
| 1369 | * Tracepoint for showing priority inheritance modifying a tasks |
| 1370 | * priority. |
| 1371 | */ |
| 1372 | TRACE_EVENT(sched_pi_setprio, |
| 1373 | |
| 1374 | TP_PROTO(struct task_struct *tsk, int newprio), |
| 1375 | |
| 1376 | TP_ARGS(tsk, newprio), |
| 1377 | |
| 1378 | TP_STRUCT__entry( |
| 1379 | __array( char, comm, TASK_COMM_LEN ) |
| 1380 | __field( pid_t, pid ) |
| 1381 | __field( int, oldprio ) |
| 1382 | __field( int, newprio ) |
| 1383 | ), |
| 1384 | |
| 1385 | TP_fast_assign( |
| 1386 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1387 | __entry->pid = tsk->pid; |
| 1388 | __entry->oldprio = tsk->prio; |
| 1389 | __entry->newprio = newprio; |
| 1390 | ), |
| 1391 | |
| 1392 | TP_printk("comm=%s pid=%d oldprio=%d newprio=%d", |
| 1393 | __entry->comm, __entry->pid, |
| 1394 | __entry->oldprio, __entry->newprio) |
| 1395 | ); |
| 1396 | |
Oleg Nesterov | 6a716c9 | 2013-10-19 18:18:28 +0200 | [diff] [blame] | 1397 | #ifdef CONFIG_DETECT_HUNG_TASK |
| 1398 | TRACE_EVENT(sched_process_hang, |
| 1399 | TP_PROTO(struct task_struct *tsk), |
| 1400 | TP_ARGS(tsk), |
| 1401 | |
| 1402 | TP_STRUCT__entry( |
| 1403 | __array( char, comm, TASK_COMM_LEN ) |
| 1404 | __field( pid_t, pid ) |
| 1405 | ), |
| 1406 | |
| 1407 | TP_fast_assign( |
| 1408 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1409 | __entry->pid = tsk->pid; |
| 1410 | ), |
| 1411 | |
| 1412 | TP_printk("comm=%s pid=%d", __entry->comm, __entry->pid) |
| 1413 | ); |
| 1414 | #endif /* CONFIG_DETECT_HUNG_TASK */ |
| 1415 | |
Mel Gorman | 286549d | 2014-01-21 15:51:03 -0800 | [diff] [blame] | 1416 | DECLARE_EVENT_CLASS(sched_move_task_template, |
| 1417 | |
| 1418 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1419 | |
| 1420 | TP_ARGS(tsk, src_cpu, dst_cpu), |
| 1421 | |
| 1422 | TP_STRUCT__entry( |
| 1423 | __field( pid_t, pid ) |
| 1424 | __field( pid_t, tgid ) |
| 1425 | __field( pid_t, ngid ) |
| 1426 | __field( int, src_cpu ) |
| 1427 | __field( int, src_nid ) |
| 1428 | __field( int, dst_cpu ) |
| 1429 | __field( int, dst_nid ) |
| 1430 | ), |
| 1431 | |
| 1432 | TP_fast_assign( |
| 1433 | __entry->pid = task_pid_nr(tsk); |
| 1434 | __entry->tgid = task_tgid_nr(tsk); |
| 1435 | __entry->ngid = task_numa_group_id(tsk); |
| 1436 | __entry->src_cpu = src_cpu; |
| 1437 | __entry->src_nid = cpu_to_node(src_cpu); |
| 1438 | __entry->dst_cpu = dst_cpu; |
| 1439 | __entry->dst_nid = cpu_to_node(dst_cpu); |
| 1440 | ), |
| 1441 | |
| 1442 | TP_printk("pid=%d tgid=%d ngid=%d src_cpu=%d src_nid=%d dst_cpu=%d dst_nid=%d", |
| 1443 | __entry->pid, __entry->tgid, __entry->ngid, |
| 1444 | __entry->src_cpu, __entry->src_nid, |
| 1445 | __entry->dst_cpu, __entry->dst_nid) |
| 1446 | ); |
| 1447 | |
| 1448 | /* |
| 1449 | * Tracks migration of tasks from one runqueue to another. Can be used to |
| 1450 | * detect if automatic NUMA balancing is bouncing between nodes |
| 1451 | */ |
| 1452 | DEFINE_EVENT(sched_move_task_template, sched_move_numa, |
| 1453 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1454 | |
| 1455 | TP_ARGS(tsk, src_cpu, dst_cpu) |
| 1456 | ); |
| 1457 | |
| 1458 | DEFINE_EVENT(sched_move_task_template, sched_stick_numa, |
| 1459 | TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu), |
| 1460 | |
| 1461 | TP_ARGS(tsk, src_cpu, dst_cpu) |
| 1462 | ); |
| 1463 | |
| 1464 | TRACE_EVENT(sched_swap_numa, |
| 1465 | |
| 1466 | TP_PROTO(struct task_struct *src_tsk, int src_cpu, |
| 1467 | struct task_struct *dst_tsk, int dst_cpu), |
| 1468 | |
| 1469 | TP_ARGS(src_tsk, src_cpu, dst_tsk, dst_cpu), |
| 1470 | |
| 1471 | TP_STRUCT__entry( |
| 1472 | __field( pid_t, src_pid ) |
| 1473 | __field( pid_t, src_tgid ) |
| 1474 | __field( pid_t, src_ngid ) |
| 1475 | __field( int, src_cpu ) |
| 1476 | __field( int, src_nid ) |
| 1477 | __field( pid_t, dst_pid ) |
| 1478 | __field( pid_t, dst_tgid ) |
| 1479 | __field( pid_t, dst_ngid ) |
| 1480 | __field( int, dst_cpu ) |
| 1481 | __field( int, dst_nid ) |
| 1482 | ), |
| 1483 | |
| 1484 | TP_fast_assign( |
| 1485 | __entry->src_pid = task_pid_nr(src_tsk); |
| 1486 | __entry->src_tgid = task_tgid_nr(src_tsk); |
| 1487 | __entry->src_ngid = task_numa_group_id(src_tsk); |
| 1488 | __entry->src_cpu = src_cpu; |
| 1489 | __entry->src_nid = cpu_to_node(src_cpu); |
| 1490 | __entry->dst_pid = task_pid_nr(dst_tsk); |
| 1491 | __entry->dst_tgid = task_tgid_nr(dst_tsk); |
| 1492 | __entry->dst_ngid = task_numa_group_id(dst_tsk); |
| 1493 | __entry->dst_cpu = dst_cpu; |
| 1494 | __entry->dst_nid = cpu_to_node(dst_cpu); |
| 1495 | ), |
| 1496 | |
| 1497 | 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", |
| 1498 | __entry->src_pid, __entry->src_tgid, __entry->src_ngid, |
| 1499 | __entry->src_cpu, __entry->src_nid, |
| 1500 | __entry->dst_pid, __entry->dst_tgid, __entry->dst_ngid, |
| 1501 | __entry->dst_cpu, __entry->dst_nid) |
| 1502 | ); |
Andy Lutomirski | dfc68f2 | 2014-06-04 10:31:15 -0700 | [diff] [blame] | 1503 | |
| 1504 | /* |
| 1505 | * Tracepoint for waking a polling cpu without an IPI. |
| 1506 | */ |
| 1507 | TRACE_EVENT(sched_wake_idle_without_ipi, |
| 1508 | |
| 1509 | TP_PROTO(int cpu), |
| 1510 | |
| 1511 | TP_ARGS(cpu), |
| 1512 | |
| 1513 | TP_STRUCT__entry( |
| 1514 | __field( int, cpu ) |
| 1515 | ), |
| 1516 | |
| 1517 | TP_fast_assign( |
| 1518 | __entry->cpu = cpu; |
| 1519 | ), |
| 1520 | |
| 1521 | TP_printk("cpu=%d", __entry->cpu) |
| 1522 | ); |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1523 | |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1524 | TRACE_EVENT(sched_contrib_scale_f, |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1525 | TP_PROTO(int cpu, unsigned long freq_scale_factor, |
| 1526 | unsigned long cpu_scale_factor), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1527 | TP_ARGS(cpu, freq_scale_factor, cpu_scale_factor), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1528 | TP_STRUCT__entry( |
| 1529 | __field(int, cpu) |
| 1530 | __field(unsigned long, freq_scale_factor) |
| 1531 | __field(unsigned long, cpu_scale_factor) |
| 1532 | ), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1533 | TP_fast_assign( |
| 1534 | __entry->cpu = cpu; |
| 1535 | __entry->freq_scale_factor = freq_scale_factor; |
| 1536 | __entry->cpu_scale_factor = cpu_scale_factor; |
| 1537 | ), |
Juri Lelli | 0a94200 | 2015-11-09 12:06:24 +0000 | [diff] [blame] | 1538 | TP_printk("cpu=%d freq_scale_factor=%lu cpu_scale_factor=%lu", |
| 1539 | __entry->cpu, __entry->freq_scale_factor, |
| 1540 | __entry->cpu_scale_factor) |
| 1541 | ); |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1542 | |
Jeevan Shriram | 49f575e | 2017-03-02 16:52:44 -0800 | [diff] [blame] | 1543 | #ifdef CONFIG_SMP |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1544 | /* |
| 1545 | * Tracepoint for accounting sched averages for tasks. |
| 1546 | */ |
| 1547 | TRACE_EVENT(sched_load_avg_task, |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1548 | TP_PROTO(struct task_struct *tsk, struct sched_avg *avg), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1549 | TP_ARGS(tsk, avg), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1550 | TP_STRUCT__entry( |
| 1551 | __array( char, comm, TASK_COMM_LEN ) |
| 1552 | __field( pid_t, pid ) |
| 1553 | __field( int, cpu ) |
| 1554 | __field( unsigned long, load_avg ) |
| 1555 | __field( unsigned long, util_avg ) |
| 1556 | __field( u64, load_sum ) |
| 1557 | __field( u32, util_sum ) |
| 1558 | __field( u32, period_contrib ) |
| 1559 | ), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1560 | TP_fast_assign( |
| 1561 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1562 | __entry->pid = tsk->pid; |
| 1563 | __entry->cpu = task_cpu(tsk); |
| 1564 | __entry->load_avg = avg->load_avg; |
| 1565 | __entry->util_avg = avg->util_avg; |
| 1566 | __entry->load_sum = avg->load_sum; |
| 1567 | __entry->util_sum = avg->util_sum; |
| 1568 | __entry->period_contrib = avg->period_contrib; |
| 1569 | ), |
Juri Lelli | a4b0c3a | 2015-11-09 12:07:27 +0000 | [diff] [blame] | 1570 | TP_printk("comm=%s pid=%d cpu=%d load_avg=%lu util_avg=%lu load_sum=%llu" |
| 1571 | " util_sum=%u period_contrib=%u", |
| 1572 | __entry->comm, |
| 1573 | __entry->pid, |
| 1574 | __entry->cpu, |
| 1575 | __entry->load_avg, |
| 1576 | __entry->util_avg, |
| 1577 | (u64)__entry->load_sum, |
| 1578 | (u32)__entry->util_sum, |
| 1579 | (u32)__entry->period_contrib) |
| 1580 | ); |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1581 | /* |
| 1582 | * Tracepoint for accounting sched averages for cpus. |
| 1583 | */ |
| 1584 | TRACE_EVENT(sched_load_avg_cpu, |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1585 | TP_PROTO(int cpu, struct cfs_rq *cfs_rq), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1586 | TP_ARGS(cpu, cfs_rq), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1587 | TP_STRUCT__entry( |
| 1588 | __field( int, cpu ) |
| 1589 | __field( unsigned long, load_avg ) |
| 1590 | __field( unsigned long, util_avg ) |
| 1591 | ), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1592 | TP_fast_assign( |
| 1593 | __entry->cpu = cpu; |
| 1594 | __entry->load_avg = cfs_rq->avg.load_avg; |
| 1595 | __entry->util_avg = cfs_rq->avg.util_avg; |
| 1596 | ), |
Juri Lelli | 7947880 | 2015-11-09 12:07:48 +0000 | [diff] [blame] | 1597 | TP_printk("cpu=%d load_avg=%lu util_avg=%lu", |
| 1598 | __entry->cpu, __entry->load_avg, __entry->util_avg) |
| 1599 | ); |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1600 | /* |
| 1601 | * Tracepoint for sched_tune_config settings |
| 1602 | */ |
| 1603 | TRACE_EVENT(sched_tune_config, |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1604 | TP_PROTO(int boost), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1605 | TP_ARGS(boost), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1606 | TP_STRUCT__entry( |
| 1607 | __field( int, boost ) |
| 1608 | ), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1609 | TP_fast_assign( |
| 1610 | __entry->boost = boost; |
| 1611 | ), |
Patrick Bellasi | 050dcb8 | 2015-06-22 13:49:07 +0100 | [diff] [blame] | 1612 | TP_printk("boost=%d ", __entry->boost) |
| 1613 | ); |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1614 | /* |
| 1615 | * Tracepoint for accounting CPU boosted utilization |
| 1616 | */ |
| 1617 | TRACE_EVENT(sched_boost_cpu, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1618 | TP_PROTO(int cpu, unsigned long util, long margin), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1619 | TP_ARGS(cpu, util, margin), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1620 | TP_STRUCT__entry( |
| 1621 | __field( int, cpu ) |
| 1622 | __field( unsigned long, util ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1623 | __field(long, margin ) |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1624 | ), |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1625 | TP_fast_assign( |
| 1626 | __entry->cpu = cpu; |
| 1627 | __entry->util = util; |
| 1628 | __entry->margin = margin; |
| 1629 | ), |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1630 | TP_printk("cpu=%d util=%lu margin=%ld", |
Patrick Bellasi | cccead1 | 2015-06-22 13:51:07 +0100 | [diff] [blame] | 1631 | __entry->cpu, |
| 1632 | __entry->util, |
| 1633 | __entry->margin) |
| 1634 | ); |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1635 | /* |
| 1636 | * Tracepoint for schedtune_tasks_update |
| 1637 | */ |
| 1638 | TRACE_EVENT(sched_tune_tasks_update, |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1639 | TP_PROTO(struct task_struct *tsk, int cpu, int tasks, int idx, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1640 | int boost, int max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1641 | TP_ARGS(tsk, cpu, tasks, idx, boost, max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1642 | TP_STRUCT__entry( |
| 1643 | __array( char, comm, TASK_COMM_LEN ) |
| 1644 | __field( pid_t, pid ) |
| 1645 | __field( int, cpu ) |
| 1646 | __field( int, tasks ) |
| 1647 | __field( int, idx ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1648 | __field( int, boost ) |
| 1649 | __field( int, max_boost ) |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1650 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1651 | TP_fast_assign( |
| 1652 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1653 | __entry->pid = tsk->pid; |
| 1654 | __entry->cpu = cpu; |
| 1655 | __entry->tasks = tasks; |
| 1656 | __entry->idx = idx; |
| 1657 | __entry->boost = boost; |
| 1658 | __entry->max_boost = max_boost; |
| 1659 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1660 | TP_printk("pid=%d comm=%s " |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1661 | "cpu=%d tasks=%d idx=%d boost=%d max_boost=%d", |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1662 | __entry->pid, __entry->comm, |
| 1663 | __entry->cpu, __entry->tasks, __entry->idx, |
| 1664 | __entry->boost, __entry->max_boost) |
| 1665 | ); |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1666 | /* |
| 1667 | * Tracepoint for schedtune_boostgroup_update |
| 1668 | */ |
| 1669 | TRACE_EVENT(sched_tune_boostgroup_update, |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1670 | TP_PROTO(int cpu, int variation, int max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1671 | TP_ARGS(cpu, variation, max_boost), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1672 | TP_STRUCT__entry( |
| 1673 | __field( int, cpu ) |
| 1674 | __field( int, variation ) |
| 1675 | __field( int, max_boost ) |
| 1676 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1677 | TP_fast_assign( |
| 1678 | __entry->cpu = cpu; |
| 1679 | __entry->variation = variation; |
| 1680 | __entry->max_boost = max_boost; |
| 1681 | ), |
Patrick Bellasi | 953b104 | 2015-06-24 15:36:08 +0100 | [diff] [blame] | 1682 | TP_printk("cpu=%d variation=%d max_boost=%d", |
| 1683 | __entry->cpu, __entry->variation, __entry->max_boost) |
| 1684 | ); |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1685 | /* |
| 1686 | * Tracepoint for accounting task boosted utilization |
| 1687 | */ |
| 1688 | TRACE_EVENT(sched_boost_task, |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1689 | TP_PROTO(struct task_struct *tsk, unsigned long util, long margin), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1690 | TP_ARGS(tsk, util, margin), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1691 | TP_STRUCT__entry( |
| 1692 | __array( char, comm, TASK_COMM_LEN ) |
| 1693 | __field( pid_t, pid ) |
| 1694 | __field( unsigned long, util ) |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1695 | __field( long, margin ) |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1696 | ), |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1697 | TP_fast_assign( |
| 1698 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1699 | __entry->pid = tsk->pid; |
| 1700 | __entry->util = util; |
| 1701 | __entry->margin = margin; |
| 1702 | ), |
Srinath Sridharan | e71c425 | 2016-07-28 17:28:55 +0100 | [diff] [blame] | 1703 | TP_printk("comm=%s pid=%d util=%lu margin=%ld", |
Patrick Bellasi | ecccdb7 | 2016-01-14 18:43:37 +0000 | [diff] [blame] | 1704 | __entry->comm, __entry->pid, |
| 1705 | __entry->util, |
| 1706 | __entry->margin) |
| 1707 | ); |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1708 | /* |
| 1709 | * Tracepoint for accounting sched group energy |
| 1710 | */ |
| 1711 | TRACE_EVENT(sched_energy_diff, |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1712 | TP_PROTO(struct task_struct *tsk, int scpu, int dcpu, int udelta, |
| 1713 | int nrgb, int nrga, int nrgd, int capb, int capa, int capd, |
| 1714 | int nrgn, int nrgp), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1715 | TP_ARGS(tsk, scpu, dcpu, udelta, |
| 1716 | nrgb, nrga, nrgd, capb, capa, capd, |
| 1717 | nrgn, nrgp), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1718 | TP_STRUCT__entry( |
| 1719 | __array( char, comm, TASK_COMM_LEN ) |
| 1720 | __field( pid_t, pid ) |
| 1721 | __field( int, scpu ) |
| 1722 | __field( int, dcpu ) |
| 1723 | __field( int, udelta ) |
| 1724 | __field( int, nrgb ) |
| 1725 | __field( int, nrga ) |
| 1726 | __field( int, nrgd ) |
| 1727 | __field( int, capb ) |
| 1728 | __field( int, capa ) |
| 1729 | __field( int, capd ) |
| 1730 | __field( int, nrgn ) |
| 1731 | __field( int, nrgp ) |
| 1732 | ), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1733 | TP_fast_assign( |
| 1734 | memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); |
| 1735 | __entry->pid = tsk->pid; |
| 1736 | __entry->scpu = scpu; |
| 1737 | __entry->dcpu = dcpu; |
| 1738 | __entry->udelta = udelta; |
| 1739 | __entry->nrgb = nrgb; |
| 1740 | __entry->nrga = nrga; |
| 1741 | __entry->nrgd = nrgd; |
| 1742 | __entry->capb = capb; |
| 1743 | __entry->capa = capa; |
| 1744 | __entry->capd = capd; |
| 1745 | __entry->nrgn = nrgn; |
| 1746 | __entry->nrgp = nrgp; |
| 1747 | ), |
Patrick Bellasi | 110441b | 2016-01-14 18:47:21 +0000 | [diff] [blame] | 1748 | TP_printk("pid=%d comm=%s " |
| 1749 | "src_cpu=%d dst_cpu=%d usage_delta=%d " |
| 1750 | "nrg_before=%d nrg_after=%d nrg_diff=%d " |
| 1751 | "cap_before=%d cap_after=%d cap_delta=%d " |
| 1752 | "nrg_delta=%d nrg_payoff=%d", |
| 1753 | __entry->pid, __entry->comm, |
| 1754 | __entry->scpu, __entry->dcpu, __entry->udelta, |
| 1755 | __entry->nrgb, __entry->nrga, __entry->nrgd, |
| 1756 | __entry->capb, __entry->capa, __entry->capd, |
| 1757 | __entry->nrgn, __entry->nrgp) |
| 1758 | ); |
Joonwoo Park | 16f1ddd | 2017-02-16 12:52:16 -0800 | [diff] [blame] | 1759 | |
| 1760 | TRACE_EVENT(sched_group_energy, |
| 1761 | |
| 1762 | TP_PROTO(int cpu, long group_util, u64 total_nrg, |
| 1763 | int busy_nrg, int idle_nrg, int grp_idle_idx, |
| 1764 | int new_capacity), |
| 1765 | |
| 1766 | TP_ARGS(cpu, group_util, total_nrg, |
| 1767 | busy_nrg, idle_nrg, grp_idle_idx, |
| 1768 | new_capacity), |
| 1769 | |
| 1770 | TP_STRUCT__entry( |
| 1771 | __field(int, cpu) |
| 1772 | __field(long, group_util) |
| 1773 | __field(u64, total_nrg) |
| 1774 | __field(int, busy_nrg) |
| 1775 | __field(int, idle_nrg) |
| 1776 | __field(int, grp_idle_idx) |
| 1777 | __field(int, new_capacity) |
| 1778 | ), |
| 1779 | |
| 1780 | TP_fast_assign( |
| 1781 | __entry->cpu = cpu; |
| 1782 | __entry->group_util = group_util; |
| 1783 | __entry->total_nrg = total_nrg; |
| 1784 | __entry->busy_nrg = busy_nrg; |
| 1785 | __entry->idle_nrg = idle_nrg; |
| 1786 | __entry->grp_idle_idx = grp_idle_idx; |
| 1787 | __entry->new_capacity = new_capacity; |
| 1788 | ), |
| 1789 | |
| 1790 | TP_printk("cpu=%d group_util=%ld total_nrg=%llu busy_nrg=%d idle_nrg=%d grp_idle_idx=%d new_capacity=%d", |
| 1791 | __entry->cpu, __entry->group_util, |
| 1792 | __entry->total_nrg, __entry->busy_nrg, __entry->idle_nrg, |
| 1793 | __entry->grp_idle_idx, __entry->new_capacity) |
| 1794 | ); |
| 1795 | |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1796 | /* |
| 1797 | * Tracepoint for schedtune_tasks_update |
| 1798 | */ |
| 1799 | TRACE_EVENT(sched_tune_filter, |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1800 | TP_PROTO(int nrg_delta, int cap_delta, |
| 1801 | int nrg_gain, int cap_gain, |
| 1802 | int payoff, int region), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1803 | TP_ARGS(nrg_delta, cap_delta, nrg_gain, cap_gain, payoff, region), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1804 | TP_STRUCT__entry( |
| 1805 | __field( int, nrg_delta ) |
| 1806 | __field( int, cap_delta ) |
| 1807 | __field( int, nrg_gain ) |
| 1808 | __field( int, cap_gain ) |
| 1809 | __field( int, payoff ) |
| 1810 | __field( int, region ) |
| 1811 | ), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1812 | TP_fast_assign( |
| 1813 | __entry->nrg_delta = nrg_delta; |
| 1814 | __entry->cap_delta = cap_delta; |
| 1815 | __entry->nrg_gain = nrg_gain; |
| 1816 | __entry->cap_gain = cap_gain; |
| 1817 | __entry->payoff = payoff; |
| 1818 | __entry->region = region; |
| 1819 | ), |
Patrick Bellasi | 5824d98 | 2016-01-20 14:06:05 +0000 | [diff] [blame] | 1820 | TP_printk("nrg_delta=%d cap_delta=%d nrg_gain=%d cap_gain=%d payoff=%d region=%d", |
| 1821 | __entry->nrg_delta, __entry->cap_delta, |
| 1822 | __entry->nrg_gain, __entry->cap_gain, |
| 1823 | __entry->payoff, __entry->region) |
| 1824 | ); |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1825 | /* |
| 1826 | * Tracepoint for system overutilized flag |
| 1827 | */ |
| 1828 | TRACE_EVENT(sched_overutilized, |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1829 | TP_PROTO(bool overutilized), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1830 | TP_ARGS(overutilized), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1831 | TP_STRUCT__entry( |
| 1832 | __field( bool, overutilized ) |
| 1833 | ), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1834 | TP_fast_assign( |
| 1835 | __entry->overutilized = overutilized; |
| 1836 | ), |
Patrick Bellasi | 8e45d94 | 2016-02-10 09:24:36 +0000 | [diff] [blame] | 1837 | TP_printk("overutilized=%d", |
| 1838 | __entry->overutilized ? 1 : 0) |
| 1839 | ); |
Jeevan Shriram | 49f575e | 2017-03-02 16:52:44 -0800 | [diff] [blame] | 1840 | #endif |
Srivatsa Vaddagiri | 26c2154 | 2016-05-31 09:08:38 -0700 | [diff] [blame] | 1841 | |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1842 | TRACE_EVENT(sched_get_nr_running_avg, |
| 1843 | |
Pavankumar Kondeti | 00530928 | 2017-05-10 15:43:29 +0530 | [diff] [blame] | 1844 | TP_PROTO(int avg, int big_avg, int iowait_avg, |
| 1845 | unsigned int max_nr, unsigned int big_max_nr), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1846 | |
Pavankumar Kondeti | 00530928 | 2017-05-10 15:43:29 +0530 | [diff] [blame] | 1847 | TP_ARGS(avg, big_avg, iowait_avg, max_nr, big_max_nr), |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1848 | |
| 1849 | TP_STRUCT__entry( |
| 1850 | __field( int, avg ) |
| 1851 | __field( int, big_avg ) |
| 1852 | __field( int, iowait_avg ) |
Pavankumar Kondeti | 00530928 | 2017-05-10 15:43:29 +0530 | [diff] [blame] | 1853 | __field( unsigned int, max_nr ) |
| 1854 | __field( unsigned int, big_max_nr ) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1855 | ), |
| 1856 | |
| 1857 | TP_fast_assign( |
| 1858 | __entry->avg = avg; |
| 1859 | __entry->big_avg = big_avg; |
| 1860 | __entry->iowait_avg = iowait_avg; |
Pavankumar Kondeti | 00530928 | 2017-05-10 15:43:29 +0530 | [diff] [blame] | 1861 | __entry->max_nr = max_nr; |
| 1862 | __entry->big_max_nr = big_max_nr; |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1863 | ), |
| 1864 | |
Pavankumar Kondeti | 00530928 | 2017-05-10 15:43:29 +0530 | [diff] [blame] | 1865 | TP_printk("avg=%d big_avg=%d iowait_avg=%d max_nr=%u big_max_nr=%u", |
| 1866 | __entry->avg, __entry->big_avg, __entry->iowait_avg, |
| 1867 | __entry->max_nr, __entry->big_max_nr) |
Syed Rameez Mustafa | dddcab7 | 2016-09-07 16:18:27 -0700 | [diff] [blame] | 1868 | ); |
Olav Haugan | 39432ea | 2016-06-12 13:57:05 -0700 | [diff] [blame] | 1869 | |
Olav Haugan | 09bcc68 | 2016-09-02 17:12:20 -0700 | [diff] [blame] | 1870 | TRACE_EVENT(core_ctl_eval_need, |
| 1871 | |
| 1872 | TP_PROTO(unsigned int cpu, unsigned int old_need, |
| 1873 | unsigned int new_need, unsigned int updated), |
| 1874 | TP_ARGS(cpu, old_need, new_need, updated), |
| 1875 | TP_STRUCT__entry( |
| 1876 | __field(u32, cpu) |
| 1877 | __field(u32, old_need) |
| 1878 | __field(u32, new_need) |
| 1879 | __field(u32, updated) |
| 1880 | ), |
| 1881 | TP_fast_assign( |
| 1882 | __entry->cpu = cpu; |
| 1883 | __entry->old_need = old_need; |
| 1884 | __entry->new_need = new_need; |
| 1885 | __entry->updated = updated; |
| 1886 | ), |
| 1887 | TP_printk("cpu=%u, old_need=%u, new_need=%u, updated=%u", __entry->cpu, |
| 1888 | __entry->old_need, __entry->new_need, __entry->updated) |
| 1889 | ); |
| 1890 | |
| 1891 | TRACE_EVENT(core_ctl_set_busy, |
| 1892 | |
| 1893 | TP_PROTO(unsigned int cpu, unsigned int busy, |
| 1894 | unsigned int old_is_busy, unsigned int is_busy), |
| 1895 | TP_ARGS(cpu, busy, old_is_busy, is_busy), |
| 1896 | TP_STRUCT__entry( |
| 1897 | __field(u32, cpu) |
| 1898 | __field(u32, busy) |
| 1899 | __field(u32, old_is_busy) |
| 1900 | __field(u32, is_busy) |
| 1901 | ), |
| 1902 | TP_fast_assign( |
| 1903 | __entry->cpu = cpu; |
| 1904 | __entry->busy = busy; |
| 1905 | __entry->old_is_busy = old_is_busy; |
| 1906 | __entry->is_busy = is_busy; |
| 1907 | ), |
| 1908 | TP_printk("cpu=%u, busy=%u, old_is_busy=%u, new_is_busy=%u", |
| 1909 | __entry->cpu, __entry->busy, __entry->old_is_busy, |
| 1910 | __entry->is_busy) |
| 1911 | ); |
| 1912 | |
Olav Haugan | a024f47 | 2016-10-13 10:34:11 -0700 | [diff] [blame] | 1913 | TRACE_EVENT(core_ctl_set_boost, |
| 1914 | |
| 1915 | TP_PROTO(u32 refcount, s32 ret), |
| 1916 | TP_ARGS(refcount, ret), |
| 1917 | TP_STRUCT__entry( |
| 1918 | __field(u32, refcount) |
| 1919 | __field(s32, ret) |
| 1920 | ), |
| 1921 | TP_fast_assign( |
| 1922 | __entry->refcount = refcount; |
| 1923 | __entry->ret = ret; |
| 1924 | ), |
| 1925 | TP_printk("refcount=%u, ret=%d", __entry->refcount, __entry->ret) |
| 1926 | ); |
| 1927 | |
Olav Haugan | 39432ea | 2016-06-12 13:57:05 -0700 | [diff] [blame] | 1928 | /* |
| 1929 | * sched_isolate - called when cores are isolated/unisolated |
| 1930 | * |
| 1931 | * @acutal_mask: mask of cores actually isolated/unisolated |
| 1932 | * @req_mask: mask of cores requested isolated/unisolated |
| 1933 | * @online_mask: cpu online mask |
| 1934 | * @time: amount of time in us it took to isolate/unisolate |
| 1935 | * @isolate: 1 if isolating, 0 if unisolating |
| 1936 | * |
| 1937 | */ |
| 1938 | TRACE_EVENT(sched_isolate, |
| 1939 | |
| 1940 | TP_PROTO(unsigned int requested_cpu, unsigned int isolated_cpus, |
| 1941 | u64 start_time, unsigned char isolate), |
| 1942 | |
| 1943 | TP_ARGS(requested_cpu, isolated_cpus, start_time, isolate), |
| 1944 | |
| 1945 | TP_STRUCT__entry( |
| 1946 | __field(u32, requested_cpu) |
| 1947 | __field(u32, isolated_cpus) |
| 1948 | __field(u32, time) |
| 1949 | __field(unsigned char, isolate) |
| 1950 | ), |
| 1951 | |
| 1952 | TP_fast_assign( |
| 1953 | __entry->requested_cpu = requested_cpu; |
| 1954 | __entry->isolated_cpus = isolated_cpus; |
| 1955 | __entry->time = div64_u64(sched_clock() - start_time, 1000); |
| 1956 | __entry->isolate = isolate; |
| 1957 | ), |
| 1958 | |
| 1959 | TP_printk("iso cpu=%u cpus=0x%x time=%u us isolated=%d", |
| 1960 | __entry->requested_cpu, __entry->isolated_cpus, |
| 1961 | __entry->time, __entry->isolate) |
| 1962 | ); |
Steven Rostedt | ea20d92 | 2009-04-10 08:54:16 -0400 | [diff] [blame] | 1963 | #endif /* _TRACE_SCHED_H */ |
Steven Rostedt | a8d154b | 2009-04-10 09:36:00 -0400 | [diff] [blame] | 1964 | |
| 1965 | /* This part must be outside protection */ |
| 1966 | #include <trace/define_trace.h> |