All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Arun Sharma <asharma@fb.com>
Cc: 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>,
	Peter Zijlstra <peterz@infradead.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 2/2] perf: Add a new sort order: SORT_INCLUSIVE
Date: Tue, 13 Mar 2012 14:44:00 +0100	[thread overview]
Message-ID: <20120313134357.GA24028@somewhere.redhat.com> (raw)
In-Reply-To: <20120308182226.GA10065@dev3310.snc6.facebook.com>

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();
> 	}
> }
> 

  reply	other threads:[~2012-03-13 13:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 22:41 [PATCH 0/2] perf: add sort by inclusive time functionality (v2) Arun Sharma
2012-03-07 22:41 ` [PATCH 1/2] perf: refactor add_hist_entry() code paths Arun Sharma
2012-03-07 22:41 ` [PATCH 2/2] perf: Add a new sort order: SORT_INCLUSIVE Arun Sharma
2012-03-07 23:13   ` Arun Sharma
2012-03-08  7:22   ` Ingo Molnar
2012-03-12 19:35     ` Arun Sharma
2012-03-12 19:35       ` Arun Sharma
2012-03-08 15:39   ` Frederic Weisbecker
2012-03-08 18:22     ` Arun Sharma
2012-03-13 13:44       ` Frederic Weisbecker [this message]
2012-03-08  7:29 ` [PATCH 0/2] perf: add sort by inclusive time functionality (v2) Ingo Molnar
2012-03-08 15:31   ` Frederic Weisbecker
2012-03-08 18:49     ` Arun Sharma
2012-03-08 18:49       ` Arun Sharma
2012-03-12  7:15       ` Namhyung Kim
2012-03-12 18:05         ` Arun Sharma
2012-03-12 18:05           ` Arun Sharma
2012-03-13  1:11           ` Namhyung Kim
2012-03-12  7:43 ` Namhyung Kim
2012-03-12 18:21   ` Arun Sharma
2012-03-12 18:21     ` Arun Sharma
2012-03-12 19:58     ` Arun Sharma
2012-03-12 19:58       ` Arun Sharma
2012-03-13  1:36       ` Namhyung Kim
2012-03-15 14:50         ` Frederic Weisbecker
2012-03-15 17:41           ` Arun Sharma
2012-03-15 17:41             ` Arun Sharma
2012-03-13  1:16     ` Namhyung Kim
2012-03-13 18:45       ` Arun Sharma
2012-03-13 18:45         ` Arun Sharma

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=20120313134357.GA24028@somewhere.redhat.com \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=asharma@fb.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.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=peterz@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.