aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-25 21:00:47 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-03-25 21:03:36 -0400
commit34886c8bc590f078d4c0b88f50d061326639198d (patch)
tree5119877f332b554bb0c777cdb926e6a49f866d9b /kernel/trace/ftrace.c
parent318e0a73c9e41b9a17241829bcd0605a39b87cb9 (diff)
tracing: add average time in function to function profiler
Show the average time in the function (Time / Hit) Function Hit Time Avg -------- --- ---- --- mwait_idle 51 140326.6 us 2751.503 us smp_apic_timer_interrupt 47 3517.735 us 74.845 us schedule 10 2738.754 us 273.875 us __schedule 10 2732.857 us 273.285 us hrtimer_interrupt 47 1896.104 us 40.342 us irq_exit 56 1711.833 us 30.568 us __run_hrtimer 47 1315.589 us 27.991 us tick_sched_timer 47 1138.690 us 24.227 us do_softirq 56 1116.829 us 19.943 us __do_softirq 56 1066.932 us 19.052 us do_IRQ 9 926.153 us 102.905 us Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4d90c916b2bb..c7f4a4be05dc 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -347,8 +347,10 @@ static int function_stat_cmp(void *p1, void *p2)
347static int function_stat_headers(struct seq_file *m) 347static int function_stat_headers(struct seq_file *m)
348{ 348{
349#ifdef CONFIG_FUNCTION_GRAPH_TRACER 349#ifdef CONFIG_FUNCTION_GRAPH_TRACER
350 seq_printf(m, " Function Hit Time\n" 350 seq_printf(m, " Function "
351 " -------- --- ----\n"); 351 "Hit Time Avg\n"
352 " -------- "
353 "--- ---- ---\n");
352#else 354#else
353 seq_printf(m, " Function Hit\n" 355 seq_printf(m, " Function Hit\n"
354 " -------- ---\n"); 356 " -------- ---\n");
@@ -361,12 +363,9 @@ static int function_stat_show(struct seq_file *m, void *v)
361 struct ftrace_profile *rec = v; 363 struct ftrace_profile *rec = v;
362 char str[KSYM_SYMBOL_LEN]; 364 char str[KSYM_SYMBOL_LEN];
363#ifdef CONFIG_FUNCTION_GRAPH_TRACER 365#ifdef CONFIG_FUNCTION_GRAPH_TRACER
364 static struct trace_seq s;
365 static DEFINE_MUTEX(mutex); 366 static DEFINE_MUTEX(mutex);
366 367 static struct trace_seq s;
367 mutex_lock(&mutex); 368 unsigned long long avg;
368 trace_seq_init(&s);
369 trace_print_graph_duration(rec->time, &s);
370#endif 369#endif
371 370
372 kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); 371 kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
@@ -374,6 +373,14 @@ static int function_stat_show(struct seq_file *m, void *v)
374 373
375#ifdef CONFIG_FUNCTION_GRAPH_TRACER 374#ifdef CONFIG_FUNCTION_GRAPH_TRACER
376 seq_printf(m, " "); 375 seq_printf(m, " ");
376 avg = rec->time;
377 do_div(avg, rec->counter);
378
379 mutex_lock(&mutex);
380 trace_seq_init(&s);
381 trace_print_graph_duration(rec->time, &s);
382 trace_seq_puts(&s, " ");
383 trace_print_graph_duration(avg, &s);
377 trace_print_seq(m, &s); 384 trace_print_seq(m, &s);
378 mutex_unlock(&mutex); 385 mutex_unlock(&mutex);
379#endif 386#endif