aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-12-09 15:40:08 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-10 02:30:26 -0500
commit3786310afe738070be31c439b8deeaeb69b9735d (patch)
tree8148395e586322c13efb0f72ba3a0c6f15e9ad45 /tools/perf/builtin-sched.c
parent5660ce34241ab204bf78fbcaa5e09318c2748d37 (diff)
perf sched: Add max delay time snapshot
When we have a maximum latency reported for a task, we need a convenient way to find the matching location to the raw traces or to perf sched map that shows where the task has been eventually scheduled in. This gives a pointer to retrieve the events that occured during this max latency. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Reviewed-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1260391208-6808-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index b12b23ac06f3..7cca7c15b40a 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -140,6 +140,7 @@ struct work_atoms {
140 struct thread *thread; 140 struct thread *thread;
141 struct rb_node node; 141 struct rb_node node;
142 u64 max_lat; 142 u64 max_lat;
143 u64 max_lat_at;
143 u64 total_lat; 144 u64 total_lat;
144 u64 nb_atoms; 145 u64 nb_atoms;
145 u64 total_runtime; 146 u64 total_runtime;
@@ -1013,8 +1014,10 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp)
1013 1014
1014 delta = atom->sched_in_time - atom->wake_up_time; 1015 delta = atom->sched_in_time - atom->wake_up_time;
1015 atoms->total_lat += delta; 1016 atoms->total_lat += delta;
1016 if (delta > atoms->max_lat) 1017 if (delta > atoms->max_lat) {
1017 atoms->max_lat = delta; 1018 atoms->max_lat = delta;
1019 atoms->max_lat_at = timestamp;
1020 }
1018 atoms->nb_atoms++; 1021 atoms->nb_atoms++;
1019} 1022}
1020 1023
@@ -1210,10 +1213,11 @@ static void output_lat_thread(struct work_atoms *work_list)
1210 1213
1211 avg = work_list->total_lat / work_list->nb_atoms; 1214 avg = work_list->total_lat / work_list->nb_atoms;
1212 1215
1213 printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms |\n", 1216 printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n",
1214 (double)work_list->total_runtime / 1e6, 1217 (double)work_list->total_runtime / 1e6,
1215 work_list->nb_atoms, (double)avg / 1e6, 1218 work_list->nb_atoms, (double)avg / 1e6,
1216 (double)work_list->max_lat / 1e6); 1219 (double)work_list->max_lat / 1e6,
1220 (double)work_list->max_lat_at / 1e9);
1217} 1221}
1218 1222
1219static int pid_cmp(struct work_atoms *l, struct work_atoms *r) 1223static int pid_cmp(struct work_atoms *l, struct work_atoms *r)
@@ -1704,9 +1708,9 @@ static void __cmd_lat(void)
1704 read_events(); 1708 read_events();
1705 sort_lat(); 1709 sort_lat();
1706 1710
1707 printf("\n -----------------------------------------------------------------------------------------\n"); 1711 printf("\n ---------------------------------------------------------------------------------------------------------------\n");
1708 printf(" Task | Runtime ms | Switches | Average delay ms | Maximum delay ms |\n"); 1712 printf(" Task | Runtime ms | Switches | Average delay ms | Maximum delay ms | Maximum delay at |\n");
1709 printf(" -----------------------------------------------------------------------------------------\n"); 1713 printf(" ---------------------------------------------------------------------------------------------------------------\n");
1710 1714
1711 next = rb_first(&sorted_atom_root); 1715 next = rb_first(&sorted_atom_root);
1712 1716