lkml.org 
[lkml]   [2008]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/4] trace: branch profiling should not print percent without data
From: Steven Rostedt <srostedt@redhat.com>

Impact: cleanup on output of branch profiler

When a branch has not been taken, it does not make sense to show
a percentage incorrect or hit. This patch changes the behaviour
to print out a 'X' when the branch has not been executed yet.

For example:

correct incorrect % Function File Line
------- --------- - -------- ---- ----
2096 0 0 do_arch_prctl process_64.c 832
0 0 X do_arch_prctl process_64.c 804
2604 0 0 IS_ERR err.h 34
130228 5765 4 __switch_to process_64.c 673
0 0 X enable_TSC process_64.c 448
0 0 X disable_TSC process_64.c 431

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace_branch.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c
index 21dedc8..142acb3 100644
--- a/kernel/trace/trace_branch.c
+++ b/kernel/trace/trace_branch.c
@@ -225,7 +225,7 @@ static int t_show(struct seq_file *m, void *v)
{
struct ftrace_branch_data *p = v;
const char *f;
- unsigned long percent;
+ long percent;

if (v == (void *)1) {
seq_printf(m, " correct incorrect %% "
@@ -247,9 +247,13 @@ static int t_show(struct seq_file *m, void *v)
percent = p->incorrect * 100;
percent /= p->correct + p->incorrect;
} else
- percent = p->incorrect ? 100 : 0;
+ percent = p->incorrect ? 100 : -1;

- seq_printf(m, "%8lu %8lu %3lu ", p->correct, p->incorrect, percent);
+ seq_printf(m, "%8lu %8lu ", p->correct, p->incorrect);
+ if (percent < 0)
+ seq_printf(m, " X ");
+ else
+ seq_printf(m, "%3ld ", percent);
seq_printf(m, "%-30.30s %-20.20s %d\n", p->func, f, p->line);
return 0;
}
--
1.5.6.5
--


\
 
 \ /
  Last update: 2008-11-21 08:17    [W:0.119 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site