Commit 3786310a authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: default avatarXiao 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: default avatarIngo Molnar <mingo@elte.hu>
parent 5660ce34
...@@ -140,6 +140,7 @@ struct work_atoms { ...@@ -140,6 +140,7 @@ struct work_atoms {
struct thread *thread; struct thread *thread;
struct rb_node node; struct rb_node node;
u64 max_lat; u64 max_lat;
u64 max_lat_at;
u64 total_lat; u64 total_lat;
u64 nb_atoms; u64 nb_atoms;
u64 total_runtime; u64 total_runtime;
...@@ -1013,8 +1014,10 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp) ...@@ -1013,8 +1014,10 @@ add_sched_in_event(struct work_atoms *atoms, u64 timestamp)
delta = atom->sched_in_time - atom->wake_up_time; delta = atom->sched_in_time - atom->wake_up_time;
atoms->total_lat += delta; atoms->total_lat += delta;
if (delta > atoms->max_lat) if (delta > atoms->max_lat) {
atoms->max_lat = delta; atoms->max_lat = delta;
atoms->max_lat_at = timestamp;
}
atoms->nb_atoms++; atoms->nb_atoms++;
} }
...@@ -1210,10 +1213,11 @@ static void output_lat_thread(struct work_atoms *work_list) ...@@ -1210,10 +1213,11 @@ static void output_lat_thread(struct work_atoms *work_list)
avg = work_list->total_lat / work_list->nb_atoms; avg = work_list->total_lat / work_list->nb_atoms;
printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms |\n", printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n",
(double)work_list->total_runtime / 1e6, (double)work_list->total_runtime / 1e6,
work_list->nb_atoms, (double)avg / 1e6, work_list->nb_atoms, (double)avg / 1e6,
(double)work_list->max_lat / 1e6); (double)work_list->max_lat / 1e6,
(double)work_list->max_lat_at / 1e9);
} }
static int pid_cmp(struct work_atoms *l, struct work_atoms *r) static int pid_cmp(struct work_atoms *l, struct work_atoms *r)
...@@ -1704,9 +1708,9 @@ static void __cmd_lat(void) ...@@ -1704,9 +1708,9 @@ static void __cmd_lat(void)
read_events(); read_events();
sort_lat(); sort_lat();
printf("\n -----------------------------------------------------------------------------------------\n"); printf("\n ---------------------------------------------------------------------------------------------------------------\n");
printf(" Task | Runtime ms | Switches | Average delay ms | Maximum delay ms |\n"); printf(" Task | Runtime ms | Switches | Average delay ms | Maximum delay ms | Maximum delay at |\n");
printf(" -----------------------------------------------------------------------------------------\n"); printf(" ---------------------------------------------------------------------------------------------------------------\n");
next = rb_first(&sorted_atom_root); next = rb_first(&sorted_atom_root);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment