提交 34886c8b 编写于 作者: S Steven Rostedt

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: NSteven Rostedt <srostedt@redhat.com>
上级 318e0a73
...@@ -347,8 +347,10 @@ static int function_stat_cmp(void *p1, void *p2) ...@@ -347,8 +347,10 @@ static int function_stat_cmp(void *p1, void *p2)
static int function_stat_headers(struct seq_file *m) static int function_stat_headers(struct seq_file *m)
{ {
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
seq_printf(m, " Function Hit Time\n" seq_printf(m, " Function "
" -------- --- ----\n"); "Hit Time Avg\n"
" -------- "
"--- ---- ---\n");
#else #else
seq_printf(m, " Function Hit\n" seq_printf(m, " Function Hit\n"
" -------- ---\n"); " -------- ---\n");
...@@ -361,12 +363,9 @@ static int function_stat_show(struct seq_file *m, void *v) ...@@ -361,12 +363,9 @@ static int function_stat_show(struct seq_file *m, void *v)
struct ftrace_profile *rec = v; struct ftrace_profile *rec = v;
char str[KSYM_SYMBOL_LEN]; char str[KSYM_SYMBOL_LEN];
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static struct trace_seq s;
static DEFINE_MUTEX(mutex); static DEFINE_MUTEX(mutex);
static struct trace_seq s;
mutex_lock(&mutex); unsigned long long avg;
trace_seq_init(&s);
trace_print_graph_duration(rec->time, &s);
#endif #endif
kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
...@@ -374,6 +373,14 @@ static int function_stat_show(struct seq_file *m, void *v) ...@@ -374,6 +373,14 @@ static int function_stat_show(struct seq_file *m, void *v)
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
seq_printf(m, " "); seq_printf(m, " ");
avg = rec->time;
do_div(avg, rec->counter);
mutex_lock(&mutex);
trace_seq_init(&s);
trace_print_graph_duration(rec->time, &s);
trace_seq_puts(&s, " ");
trace_print_graph_duration(avg, &s);
trace_print_seq(m, &s); trace_print_seq(m, &s);
mutex_unlock(&mutex); mutex_unlock(&mutex);
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册