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