[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120313134357.GA24028@somewhere.redhat.com>
Date: Tue, 13 Mar 2012 14:44:00 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Arun Sharma <asharma@...com>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <peterz@...radead.org>,
Stephane Eranian <eranian@...gle.com>,
Namhyung Kim <namhyung.kim@....com>,
Tom Zanussi <tzanussi@...il.com>,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 2/2] perf: Add a new sort order: SORT_INCLUSIVE
On Thu, Mar 08, 2012 at 10:22:26AM -0800, Arun Sharma wrote:
> On Thu, Mar 08, 2012 at 04:39:36PM +0100, Frederic Weisbecker wrote:
> >
> > I don't yet understand the point of this.
> >
> > Imagine those three hists:
> >
> > a -> b -> c
> > a -> b -> d
> > a-> e -> f
> >
> > The fractal inverted mode (-G) will report this:
> >
> > a--
> > |
> > ----- b
> > | |
> > | -----c
> > | |
> > | -----d
> > |
> > ----- e
> > |
> > -----f
> >
>
> Please see the test program attached. It has only two paths from main()
> to c(). But for this discussion, imagine a callgraph with 10 different
> paths.
Ok that makes sense.
Thanks.
>
> With -G, c() appears 10 times in the callgraph and the user is required
> to manually sum up the samples to realize that the callgraph under c()
> is very expensive.
>
> With -s inclusive, c() will show up at the very top after main().
>
> -Arun
>
> #include <stdio.h>
>
> int sum = 0;
>
> #define LOOP(n) \
> { \
> int j; \
> for (j = 0; j < 10000; j++) { \
> sum += j; \
> } \
> }
>
> int f()
> {
> LOOP(100);
> }
>
> int d()
> {
> LOOP(100);
> f();
> }
>
> int e()
> {
> LOOP(100);
> f();
> }
>
> int c()
> {
> LOOP(100);
> d();
> LOOP(100);
> e();
> }
>
> int b()
> {
> LOOP(70);
> c();
> }
>
> int a()
> {
> LOOP(30);
> c();
> }
>
> int main()
> {
> int i;
> for (i = 0; i < 10000; i++) {
> a();
> b();
> }
> }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists