From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH] perf: Add a new sort order: SORT_INCLUSIVE (v4) Date: Tue, 27 Mar 2012 21:38:18 +0200 Message-ID: <1332877098.16159.260.camel@twins> References: <1331746607-6706-1-git-send-email-asharma@fb.com> <20120315141402.GA550@somewhere.redhat.com> <4F622DCE.4090608@fb.com> <20120319155742.GF2660@somewhere> <4F691289.7080505@fb.com> <20120325021451.GA14971@somewhere.redhat.com> <4F72026C.3050604@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Return-path: Received: from merlin.infradead.org ([205.233.59.134]:60799 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754231Ab2C0Tif convert rfc822-to-8bit (ORCPT ); Tue, 27 Mar 2012 15:38:35 -0400 In-Reply-To: <4F72026C.3050604@fb.com> Sender: linux-perf-users-owner@vger.kernel.org List-ID: To: Arun Sharma Cc: Frederic Weisbecker , linux-kernel@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo , Mike Galbraith , Paul Mackerras , Stephane Eranian , Namhyung Kim , Tom Zanussi , linux-perf-users@vger.kernel.org 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.