diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:18 -0400 |
commit | cc367732ff0b1c63d0d7bdd11e6d1661794ef6a3 (patch) | |
tree | 27c65e05bf19644224937624ca356c876e6d1318 /kernel/sched_debug.c | |
parent | 2d92f22784b7b8879ebe3254e44c92cb8792b0dd (diff) |
sched: debug, improve migration statistics
add new migration statistics when SCHED_DEBUG and SCHEDSTATS
is enabled. Available in /proc/<PID>/sched.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_debug.c')
-rw-r--r-- | kernel/sched_debug.c | 87 |
1 files changed, 77 insertions, 10 deletions
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 755815937417..27e82cbccaa5 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -260,6 +260,7 @@ __initcall(init_sched_debug_procfs); | |||
260 | 260 | ||
261 | void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | 261 | void proc_sched_show_task(struct task_struct *p, struct seq_file *m) |
262 | { | 262 | { |
263 | unsigned long nr_switches; | ||
263 | unsigned long flags; | 264 | unsigned long flags; |
264 | int num_threads = 1; | 265 | int num_threads = 1; |
265 | 266 | ||
@@ -273,8 +274,12 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
273 | SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads); | 274 | SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads); |
274 | SEQ_printf(m, | 275 | SEQ_printf(m, |
275 | "---------------------------------------------------------\n"); | 276 | "---------------------------------------------------------\n"); |
277 | #define __P(F) \ | ||
278 | SEQ_printf(m, "%-35s:%21Ld\n", #F, (long long)F) | ||
276 | #define P(F) \ | 279 | #define P(F) \ |
277 | SEQ_printf(m, "%-35s:%21Ld\n", #F, (long long)p->F) | 280 | SEQ_printf(m, "%-35s:%21Ld\n", #F, (long long)p->F) |
281 | #define __PN(F) \ | ||
282 | SEQ_printf(m, "%-35s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)F)) | ||
278 | #define PN(F) \ | 283 | #define PN(F) \ |
279 | SEQ_printf(m, "%-35s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) | 284 | SEQ_printf(m, "%-35s:%14Ld.%06ld\n", #F, SPLIT_NS((long long)p->F)) |
280 | 285 | ||
@@ -282,6 +287,8 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
282 | PN(se.vruntime); | 287 | PN(se.vruntime); |
283 | PN(se.sum_exec_runtime); | 288 | PN(se.sum_exec_runtime); |
284 | 289 | ||
290 | nr_switches = p->nvcsw + p->nivcsw; | ||
291 | |||
285 | #ifdef CONFIG_SCHEDSTATS | 292 | #ifdef CONFIG_SCHEDSTATS |
286 | PN(se.wait_start); | 293 | PN(se.wait_start); |
287 | PN(se.sleep_start); | 294 | PN(se.sleep_start); |
@@ -292,14 +299,55 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
292 | PN(se.slice_max); | 299 | PN(se.slice_max); |
293 | PN(se.wait_max); | 300 | PN(se.wait_max); |
294 | P(sched_info.bkl_count); | 301 | P(sched_info.bkl_count); |
302 | P(se.nr_migrations); | ||
303 | P(se.nr_migrations_cold); | ||
304 | P(se.nr_failed_migrations_affine); | ||
305 | P(se.nr_failed_migrations_running); | ||
306 | P(se.nr_failed_migrations_hot); | ||
307 | P(se.nr_forced_migrations); | ||
308 | P(se.nr_forced2_migrations); | ||
309 | P(se.nr_wakeups); | ||
310 | P(se.nr_wakeups_sync); | ||
311 | P(se.nr_wakeups_migrate); | ||
312 | P(se.nr_wakeups_local); | ||
313 | P(se.nr_wakeups_remote); | ||
314 | P(se.nr_wakeups_affine); | ||
315 | P(se.nr_wakeups_affine_attempts); | ||
316 | P(se.nr_wakeups_passive); | ||
317 | P(se.nr_wakeups_idle); | ||
318 | |||
319 | { | ||
320 | u64 avg_atom, avg_per_cpu; | ||
321 | |||
322 | avg_atom = p->se.sum_exec_runtime; | ||
323 | if (nr_switches) | ||
324 | do_div(avg_atom, nr_switches); | ||
325 | else | ||
326 | avg_atom = -1LL; | ||
327 | |||
328 | avg_per_cpu = p->se.sum_exec_runtime; | ||
329 | if (p->se.nr_migrations) | ||
330 | avg_per_cpu = div64_64(avg_per_cpu, p->se.nr_migrations); | ||
331 | else | ||
332 | avg_per_cpu = -1LL; | ||
333 | |||
334 | __PN(avg_atom); | ||
335 | __PN(avg_per_cpu); | ||
336 | } | ||
295 | #endif | 337 | #endif |
338 | __P(nr_switches); | ||
296 | SEQ_printf(m, "%-35s:%21Ld\n", | 339 | SEQ_printf(m, "%-35s:%21Ld\n", |
297 | "nr_switches", (long long)(p->nvcsw + p->nivcsw)); | 340 | "nr_voluntary_switches", (long long)p->nvcsw); |
341 | SEQ_printf(m, "%-35s:%21Ld\n", | ||
342 | "nr_involuntary_switches", (long long)p->nivcsw); | ||
343 | |||
298 | P(se.load.weight); | 344 | P(se.load.weight); |
299 | P(policy); | 345 | P(policy); |
300 | P(prio); | 346 | P(prio); |
301 | #undef P | ||
302 | #undef PN | 347 | #undef PN |
348 | #undef __PN | ||
349 | #undef P | ||
350 | #undef __P | ||
303 | 351 | ||
304 | { | 352 | { |
305 | u64 t0, t1; | 353 | u64 t0, t1; |
@@ -314,13 +362,32 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m) | |||
314 | void proc_sched_set_task(struct task_struct *p) | 362 | void proc_sched_set_task(struct task_struct *p) |
315 | { | 363 | { |
316 | #ifdef CONFIG_SCHEDSTATS | 364 | #ifdef CONFIG_SCHEDSTATS |
317 | p->se.sleep_max = 0; | 365 | p->se.wait_max = 0; |
318 | p->se.block_max = 0; | 366 | p->se.sleep_max = 0; |
319 | p->se.exec_max = 0; | 367 | p->se.sum_sleep_runtime = 0; |
320 | p->se.slice_max = 0; | 368 | p->se.block_max = 0; |
321 | p->se.wait_max = 0; | 369 | p->se.exec_max = 0; |
322 | p->sched_info.bkl_count = 0; | 370 | p->se.slice_max = 0; |
371 | p->se.nr_migrations = 0; | ||
372 | p->se.nr_migrations_cold = 0; | ||
373 | p->se.nr_failed_migrations_affine = 0; | ||
374 | p->se.nr_failed_migrations_running = 0; | ||
375 | p->se.nr_failed_migrations_hot = 0; | ||
376 | p->se.nr_forced_migrations = 0; | ||
377 | p->se.nr_forced2_migrations = 0; | ||
378 | p->se.nr_wakeups = 0; | ||
379 | p->se.nr_wakeups_sync = 0; | ||
380 | p->se.nr_wakeups_migrate = 0; | ||
381 | p->se.nr_wakeups_local = 0; | ||
382 | p->se.nr_wakeups_remote = 0; | ||
383 | p->se.nr_wakeups_affine = 0; | ||
384 | p->se.nr_wakeups_affine_attempts = 0; | ||
385 | p->se.nr_wakeups_passive = 0; | ||
386 | p->se.nr_wakeups_idle = 0; | ||
387 | p->sched_info.bkl_count = 0; | ||
323 | #endif | 388 | #endif |
324 | p->se.sum_exec_runtime = 0; | 389 | p->se.sum_exec_runtime = 0; |
325 | p->se.prev_sum_exec_runtime = 0; | 390 | p->se.prev_sum_exec_runtime = 0; |
391 | p->nvcsw = 0; | ||
392 | p->nivcsw = 0; | ||
326 | } | 393 | } |