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