mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Theodore Tso <tytso@mit.edu>,
	Arjan van de Ven <arjan@infradead.org>,
	Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 3/4] trace: branch profiling should not print percent without data
Date: Fri, 21 Nov 2008 02:12:16 -0500	[thread overview]
Message-ID: <20081121071328.254501091@goodmis.org> (raw)
In-Reply-To: <20081121071213.365288293@goodmis.org>

[-- Attachment #1: 0003-trace-branch-profiling-should-not-print-percent-wit.patch --]
[-- Type: text/plain, Size: 2017 bytes --]

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

-- 

  parent reply	other threads:[~2008-11-21  7:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-21  7:12 [PATCH 0/4] trace: profiling branches Steven Rostedt
2008-11-21  7:12 ` [PATCH 1/4] trace: remove extra assign in branch check Steven Rostedt
2008-11-21  7:12 ` [PATCH 2/4] trace: consolidate unlikely and likely profiler Steven Rostedt
2008-11-21  7:12 ` Steven Rostedt [this message]
2008-11-21  7:12 ` [PATCH 4/4] trace: profile all if conditionals Steven Rostedt
2008-11-21 23:20   ` Andrew Morton
2008-11-21 23:33     ` Steven Rostedt
2008-11-23 12:37       ` Ingo Molnar
2008-11-23 15:48   ` Ingo Molnar
2008-11-23 16:07     ` [PATCH] net/wireless/reg.c: fix Ingo Molnar
2008-11-23 19:43   ` [PATCH 4/4] trace: profile all if conditionals Andi Kleen
2008-11-23 19:56     ` Steven Rostedt
2008-11-23 20:24       ` Andi Kleen
2008-11-23 20:32         ` Steven Rostedt
2008-11-23 20:51           ` Andi Kleen
2008-11-23 21:38       ` Ingo Molnar
2008-11-30 10:58 ` [PATCH 0/4] trace: profiling branches Daniel Walker
2008-11-30 15:19   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081121071328.254501091@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome