diff options
author | Namhyung Kim <namhyung@kernel.org> | 2017-01-13 05:45:23 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-01-17 09:36:44 -0500 |
commit | 587782c52a83b35673201fd9a54364fa2b189b33 (patch) | |
tree | 2579f31a4f22b3f375931c975c9f3c2a8eb93302 /tools | |
parent | 414e050c68ec2a3dd815544ea48ff6016f1a7a11 (diff) |
perf sched timehist: Show total wait times for summary
When --state option is given, the summary will show total run, sleep,
iowait, preempt and delay time instead of statistics of runtime.
$ perf sched timehist -s --state
Wait-time summary
comm parent sched-in run-time sleep iowait preempt delay
(count) (msec) (msec) (msec) (msec) (msec)
---------------------------------------------------------------------
systemd[1] 0 3 0.497 1.685 0.000 0.000 0.061
ksoftirqd/0[3] 2 21 0.434 989.948 0.000 0.000 0.325
rcu_preempt[7] 2 28 0.386 993.211 0.000 0.000 0.712
migration/0[10] 2 12 0.126 50.174 0.000 0.000 0.044
watchdog/0[11] 2 1 0.009 0.000 0.000 0.000 0.016
migration/1[13] 2 2 0.029 11.755 0.000 0.000 0.007
<SNIP>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20170113104523.31212-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-sched.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index a8ac76602187..daceb3202200 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -241,6 +241,10 @@ struct thread_runtime { | |||
241 | 241 | ||
242 | struct stats run_stats; | 242 | struct stats run_stats; |
243 | u64 total_run_time; | 243 | u64 total_run_time; |
244 | u64 total_sleep_time; | ||
245 | u64 total_iowait_time; | ||
246 | u64 total_preempt_time; | ||
247 | u64 total_delay_time; | ||
244 | 248 | ||
245 | int last_state; | 249 | int last_state; |
246 | u64 migrations; | 250 | u64 migrations; |
@@ -2008,7 +2012,12 @@ static void timehist_update_runtime_stats(struct thread_runtime *r, | |||
2008 | } | 2012 | } |
2009 | 2013 | ||
2010 | update_stats(&r->run_stats, r->dt_run); | 2014 | update_stats(&r->run_stats, r->dt_run); |
2011 | r->total_run_time += r->dt_run; | 2015 | |
2016 | r->total_run_time += r->dt_run; | ||
2017 | r->total_delay_time += r->dt_delay; | ||
2018 | r->total_sleep_time += r->dt_sleep; | ||
2019 | r->total_iowait_time += r->dt_iowait; | ||
2020 | r->total_preempt_time += r->dt_preempt; | ||
2012 | } | 2021 | } |
2013 | 2022 | ||
2014 | static bool is_idle_sample(struct perf_sample *sample, | 2023 | static bool is_idle_sample(struct perf_sample *sample, |
@@ -2593,7 +2602,26 @@ static void print_thread_runtime(struct thread *t, | |||
2593 | printf("\n"); | 2602 | printf("\n"); |
2594 | } | 2603 | } |
2595 | 2604 | ||
2605 | static void print_thread_waittime(struct thread *t, | ||
2606 | struct thread_runtime *r) | ||
2607 | { | ||
2608 | printf("%*s %5d %9" PRIu64 " ", | ||
2609 | comm_width, timehist_get_commstr(t), t->ppid, | ||
2610 | (u64) r->run_stats.n); | ||
2611 | |||
2612 | print_sched_time(r->total_run_time, 8); | ||
2613 | print_sched_time(r->total_sleep_time, 6); | ||
2614 | printf(" "); | ||
2615 | print_sched_time(r->total_iowait_time, 6); | ||
2616 | printf(" "); | ||
2617 | print_sched_time(r->total_preempt_time, 6); | ||
2618 | printf(" "); | ||
2619 | print_sched_time(r->total_delay_time, 6); | ||
2620 | printf("\n"); | ||
2621 | } | ||
2622 | |||
2596 | struct total_run_stats { | 2623 | struct total_run_stats { |
2624 | struct perf_sched *sched; | ||
2597 | u64 sched_count; | 2625 | u64 sched_count; |
2598 | u64 task_count; | 2626 | u64 task_count; |
2599 | u64 total_run_time; | 2627 | u64 total_run_time; |
@@ -2612,7 +2640,11 @@ static int __show_thread_runtime(struct thread *t, void *priv) | |||
2612 | stats->task_count++; | 2640 | stats->task_count++; |
2613 | stats->sched_count += r->run_stats.n; | 2641 | stats->sched_count += r->run_stats.n; |
2614 | stats->total_run_time += r->total_run_time; | 2642 | stats->total_run_time += r->total_run_time; |
2615 | print_thread_runtime(t, r); | 2643 | |
2644 | if (stats->sched->show_state) | ||
2645 | print_thread_waittime(t, r); | ||
2646 | else | ||
2647 | print_thread_runtime(t, r); | ||
2616 | } | 2648 | } |
2617 | 2649 | ||
2618 | return 0; | 2650 | return 0; |
@@ -2700,18 +2732,24 @@ static void timehist_print_summary(struct perf_sched *sched, | |||
2700 | u64 hist_time = sched->hist_time.end - sched->hist_time.start; | 2732 | u64 hist_time = sched->hist_time.end - sched->hist_time.start; |
2701 | 2733 | ||
2702 | memset(&totals, 0, sizeof(totals)); | 2734 | memset(&totals, 0, sizeof(totals)); |
2735 | totals.sched = sched; | ||
2703 | 2736 | ||
2704 | if (sched->idle_hist) { | 2737 | if (sched->idle_hist) { |
2705 | printf("\nIdle-time summary\n"); | 2738 | printf("\nIdle-time summary\n"); |
2706 | printf("%*s parent sched-out ", comm_width, "comm"); | 2739 | printf("%*s parent sched-out ", comm_width, "comm"); |
2707 | printf(" idle-time min-idle avg-idle max-idle stddev migrations\n"); | 2740 | printf(" idle-time min-idle avg-idle max-idle stddev migrations\n"); |
2741 | } else if (sched->show_state) { | ||
2742 | printf("\nWait-time summary\n"); | ||
2743 | printf("%*s parent sched-in ", comm_width, "comm"); | ||
2744 | printf(" run-time sleep iowait preempt delay\n"); | ||
2708 | } else { | 2745 | } else { |
2709 | printf("\nRuntime summary\n"); | 2746 | printf("\nRuntime summary\n"); |
2710 | printf("%*s parent sched-in ", comm_width, "comm"); | 2747 | printf("%*s parent sched-in ", comm_width, "comm"); |
2711 | printf(" run-time min-run avg-run max-run stddev migrations\n"); | 2748 | printf(" run-time min-run avg-run max-run stddev migrations\n"); |
2712 | } | 2749 | } |
2713 | printf("%*s (count) ", comm_width, ""); | 2750 | printf("%*s (count) ", comm_width, ""); |
2714 | printf(" (msec) (msec) (msec) (msec) %%\n"); | 2751 | printf(" (msec) (msec) (msec) (msec) %s\n", |
2752 | sched->show_state ? "(msec)" : "%"); | ||
2715 | printf("%.117s\n", graph_dotted_line); | 2753 | printf("%.117s\n", graph_dotted_line); |
2716 | 2754 | ||
2717 | machine__for_each_thread(m, show_thread_runtime, &totals); | 2755 | machine__for_each_thread(m, show_thread_runtime, &totals); |