From: Andi Kleen <andi@firstfloor.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andi Kleen <andi@firstfloor.org>,
linux-kernel@vger.kernel.org, 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: Re: [PATCH 4/4] trace: profile all if conditionals
Date: Sun, 23 Nov 2008 21:24:34 +0100 [thread overview]
Message-ID: <20081123202434.GU6703@one.firstfloor.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0811231455090.13888@gandalf.stny.rr.com>
On Sun, Nov 23, 2008 at 02:56:42PM -0500, Steven Rostedt wrote:
You snipped my earlier suggestion? Can't you just use kernel gcov
for this? Frankly it's output is infinitely more useful than
the one from your patch. It also addresses Andrew's suggestion
of profiling other control flow constructs.
I know it's not ftrace, but not everything is bad just because it's
not seen through the ftrace spectacles @)
> On Sun, 23 Nov 2008, Andi Kleen wrote:
> > Steven Rostedt <rostedt@goodmis.org> writes:
>
> > > This adds a significant amount of overhead and should only be used
> > > by those analyzing their system.
> >
> > Often this can be also done using CPU performance counters. Might
> > be a cheaper option.
>
> I'd love to add an option that could hook into any arch with HW support
> for this. We could dump out the same information, but just a different way
> to gather it. But I'm still ignorant to the use of CPU performance
> counters and how to find which branch matches which if.
The theory is quite simple. Typically there are events for
"taken branches" and others for "non taken". So you set up
two counters using the existing oprofile support and collect
the samples. Then combine these two sample streams.
[Sometimes you have to also synthesize these
events because CPUs like to count predicted and mispredicted
(in the CPU sense) differently, but that's also quite simple
(on x86/core these can be all specified in the unit mask for
the same event)]
The sampling will be statistical (not every branch counted),
but that's ok because only branches that are executed a significant
time are interesting anyways.
The only problem is you have to map back to source code lines, which
can be done in user space based on the oprofile output and some
addr2line or similar hacks. oprofile can also do this,
although it gives this information only indirectly so a custom
tool might be easier.
Note it doesn't even need new kernel code, assuming
the architecture already has a working full oprofile implementation.
The main advantage over gcov would be lower runtime overhead,
although gcov is giving the better output (and is already working
too)
-Andi
>
> -- Steve
>
--
ak@linux.intel.com
next prev parent reply other threads:[~2008-11-23 20:14 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 ` [PATCH 3/4] trace: branch profiling should not print percent without data Steven Rostedt
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 [this message]
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=20081123202434.GU6703@one.firstfloor.org \
--to=andi@firstfloor.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=rostedt@goodmis.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