linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Arun Sharma <asharma@fb.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>,
	Namhyung Kim <namhyung.kim@lge.com>,
	Tom Zanussi <tzanussi@gmail.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v4)
Date: Tue, 27 Mar 2012 21:38:18 +0200	[thread overview]
Message-ID: <1332877098.16159.260.camel@twins> (raw)
In-Reply-To: <4F72026C.3050604@fb.com>

On Tue, 2012-03-27 at 11:09 -0700, Arun Sharma wrote:
> On 3/24/12 7:14 PM, Frederic Weisbecker wrote:
> 
> >> The other problem in branch stacks/LBR is that they're
> >> sampled branches. Just because I got a sample with:
> >>
> >> a ->  b
> >> b ->  c
> >>
> >> doesn't necessarily mean that the callchain was a ->  b ->  c.
> >
> > Not sure what you mean. If you have a ->  b, b ->  c in single
> > LBR sample it means you got a ->  b ->  c.
> >
> 
> I was going by Stephane's commit message here:
> 
> http://article.gmane.org/gmane.linux.kernel/1236999
> 
>  > Statistical sampling of taken branch should not be confused
>  > for branch tracing. Not all branches are necessarily captured
> 
> Stephane, could you please explain if the 16 filtered branches in LBR 
> are guaranteed to be from a given callchain to the leaf function? My 
> understanding is that it's not.
> 
> callchain1: a -> b -> d -> e (sample a->b)
> callchain2: a -> c -> b -> f (sample b->f)
> 
> on PMU interrupt can we end up with:
> 
> b -> f <- top of stack
> a -> b
> ...
> 
> even though a -> b -> f can never happen in the actual program flow?

Right, so the LBR is a queue not a stack. A program like:

foo() {
	bar1();
	bar2();
}

will, using the lbr, look like: foo->bar1->bar2 (if you filter returns),
or foo->bar1->foo+x->bar2 if you include returns.

A callchain is a pure stack, a return pops the top most entry, the above
program can only give 3 possible callchains:

a) foo
b) foo, bar1
c) foo, bar2

Furthermore, the LBR is about any branch, callchains are about function
calls.

      reply	other threads:[~2012-03-27 19:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 17:36 [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v4) Arun Sharma
2012-03-15  1:02 ` Namhyung Kim
2012-03-15 14:14 ` Frederic Weisbecker
2012-03-15 17:58   ` Arun Sharma
2012-03-19 15:57     ` Frederic Weisbecker
2012-03-20 23:28       ` Arun Sharma
2012-03-25  2:14         ` Frederic Weisbecker
2012-03-27 18:09           ` Arun Sharma
2012-03-27 19:38             ` Peter Zijlstra [this message]

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=1332877098.16159.260.camel@twins \
    --to=peterz@infradead.org \
    --cc=acme@redhat.com \
    --cc=asharma@fb.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --cc=paulus@samba.org \
    --cc=tzanussi@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).