All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
To: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Mike Galbraith <efault@gmx.de>, Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 07/15] perf top: Add callgraph support
Date: Thu, 6 Oct 2011 20:02:46 -0300	[thread overview]
Message-ID: <20111006230246.GA5944@ghostprotocols.net> (raw)
In-Reply-To: <4E8E21D6.9080201@gmail.com>

Em Thu, Oct 06, 2011 at 03:47:02PM -0600, David Ahern escreveu:
> On 10/06/2011 11:22 AM, Arnaldo Carvalho de Melo wrote:
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > +-G [type,min,order]::
> > +--call-graph::
> > +        Display call chains using type, min percent threshold and order.
> > +	type can be either:
> > +	- flat: single column, linear exposure of call chains.
> > +	- graph: use a graph tree, displaying absolute overhead rates.
> > +	- fractal: like graph, but displays relative rates. Each branch of
> > +		 the tree is considered as a new profiled object.
> > +
> > +	order can be either:
> > +	- callee: callee based call graph.
> > +	- caller: inverted caller based call graph.
> > +
> > +	Default: fractal,0.5,callee.

> yuk. perf-report has -g for this. How about moving the current -g to -G
> and let -g be consistent across commands?

Yup, but top has -g for --group... This is something we need to improve
ASAP. 

I think changing top to use 0 for group, i.e. just --group and -g for
callchains is the way to go, right?

The "record" command has 'G' for --cgroup, -g for --call-graph... So
topuse 'G' for --cgroup too, I guess.
 
> > @@ -748,13 +756,29 @@ static void perf_event__process_sample(const union perf_event *event,
> >  		evsel = perf_evlist__id2evsel(top.evlist, sample->id);
> >  		assert(evsel != NULL);
> >  
> > +		if ((sort__has_parent || symbol_conf.use_callchain) &&
> > +		    sample->callchain) {
> > +			err = perf_session__resolve_callchain(session, al.thread,
> > +							      sample->callchain, &parent);
> > +			if (err)
> > +				return;
> > +		}
> > +
> >  		he = perf_session__add_hist_entry(session, &al, sample, evsel);
> >  		if (he == NULL) {
> >  			pr_err("Problem incrementing symbol period, skipping event\n");
> >  			return;
> >  		}
> >  
> > -		record_precise_ip(he, evsel->idx, ip);
> > +		if (symbol_conf.use_callchain) {
> > +			err = callchain_append(he->callchain, &session->callchain_cursor,
> > +					       sample->period);
> > +			if (err)
> > +				return;
> > +		}
> > +
> > +		if (sort_has_symbols)
> > +			record_precise_ip(he, evsel->idx, ip);
> >  	}
> 
> A fair amount of code duplication with builtin-report now.

Yeah, eventually all this will be in the evlist class.
 
> > +	/* get the call chain order */
> > +	if (!strcmp(tok2, "caller"))
> > +		callchain_param.order = ORDER_CALLER;
> > +	else if (!strcmp(tok2, "callee"))
> > +		callchain_param.order = ORDER_CALLEE;
> > +	else
> > +		return -1;
> > +setup:
> > +	if (callchain_register_param(&callchain_param) < 0) {
> > +		fprintf(stderr, "Can't register callchain params\n");
> > +		return -1;
> > +	}
> 
> ditto for the parse_callchain_opt() -- seems to be a copy from report.

It is, I'll get that refactored. Just wanted to get this thing out now
as I found it to be an improvement to the current 'perf top' tool :)
 
> David

  reply	other threads:[~2011-10-06 23:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 17:22 [GIT PULL 00/15] perf/core improvements Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 01/15] perf hists: Stop using 'self' for struct hists Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 02/15] perf hists: Allow limiting the number of rows and columns in fprintf Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 03/15] perf report: Add option to show total period Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 04/15] perf hists: Threaded addition and sorting of entries Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 05/15] perf browsers: Add live mode to the hists, annotate browsers Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 06/15] perf top: Reuse the 'report' hist_entry/hists classes Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 07/15] perf top: Add callgraph support Arnaldo Carvalho de Melo
2011-10-06 21:47   ` David Ahern
2011-10-06 23:02     ` Arnaldo Carvalho de Melo [this message]
2011-10-06 17:22 ` [PATCH 08/15] perf annotate browser: Allow navigation to called functions Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 09/15] perf top: Use the TUI interface by default Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 10/15] perf tools: Fix broken number of samples for perf report -n Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 11/15] perf annotate browser: Use -> to navigate on assembly lines Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 12/15] perf hists browser: Don't offer symbol actions when symbols not on --sort Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 13/15] perf hists browser: Fix TAB/UNTAB use with multiple events Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 14/15] perf hists browser: Update the browser.nr_entries after the timer Arnaldo Carvalho de Melo
2011-10-06 17:22 ` [PATCH 15/15] perf tools: Make perf.data more self-descriptive (v8) Arnaldo Carvalho de Melo
2011-10-10  5:11 ` [GIT PULL 00/15] perf/core improvements Ingo Molnar

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=20111006230246.GA5944@ghostprotocols.net \
    --to=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=efault@gmx.de \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    /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.