mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@infradead.org, namhyung@kernel.org, mingo@kernel.org,
	dsahern@gmail.com, fweisbec@gmail.com, adrian.hunter@intel.com,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 4/6] perf, tools: Enable printing the srcline in the history
Date: Wed, 15 Jan 2014 16:12:55 +0100	[thread overview]
Message-ID: <20140115151255.GC17358@krava.redhat.com> (raw)
In-Reply-To: <1389661461-18996-5-git-send-email-andi@firstfloor.org>

On Mon, Jan 13, 2014 at 05:04:19PM -0800, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
> 
> For lbr-as-callgraph we need to see the line number in the history,
> because many LBR entries can be in a single function, and just
> showing the same function name many times is not useful.
> 
> When the history code is configured to sort by address, also try to
> resolve the address to a file:srcline and display this in the browser.
> If that doesn't work still display the address.
> 
> This can be also useful without LBRs for understanding which call in a large
> function (or in which inlined function) called something else.
> 
> Contains fixes from Namhyung Kim
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  tools/perf/ui/browsers/hists.c | 15 ++++++++++++---
>  tools/perf/ui/stdio/hist.c     | 16 +++++++++++++---
>  tools/perf/util/callchain.h    |  1 +
>  tools/perf/util/machine.c      |  2 +-
>  tools/perf/util/srcline.c      |  6 ++++--
>  5 files changed, 31 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> index b720b92..060fffc 100644
> --- a/tools/perf/ui/browsers/hists.c
> +++ b/tools/perf/ui/browsers/hists.c
> @@ -399,9 +399,18 @@ static char *callchain_list__sym_name(struct callchain_list *cl,
>  {
>  	int printed;
>  
> -	if (cl->ms.sym)
> -		printed = scnprintf(bf, bfsize, "%s", cl->ms.sym->name);
> -	else
> +	if (cl->ms.sym) {
> +		if (callchain_param.key == CCKEY_ADDRESS &&
> +		    cl->ms.map && !cl->srcline)
> +			cl->srcline = get_srcline(cl->ms.map->dso,
> +						  map__rip_2objdump(cl->ms.map,
> +								    cl->ip));
> +		if (cl->srcline)
> +			printed = scnprintf(bf, bfsize, "%s %s",
> +					cl->ms.sym->name, cl->srcline);
> +		else
> +			printed = scnprintf(bf, bfsize, "%s", cl->ms.sym->name);
> +	} else
>  		printed = scnprintf(bf, bfsize, "%#" PRIx64, cl->ip);

above function 'callchain_list__sym_name' could be exported

>  
>  	if (show_dso)
> diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
> index 831fbb7..a494eed 100644
> --- a/tools/perf/ui/stdio/hist.c
> +++ b/tools/perf/ui/stdio/hist.c
> @@ -56,9 +56,19 @@ static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain,
>  		} else
>  			ret += fprintf(fp, "%s", "          ");
>  	}
> -	if (chain->ms.sym)
> -		ret += fprintf(fp, "%s\n", chain->ms.sym->name);
> -	else
> +	if (chain->ms.sym) {
> +		if (callchain_param.key == CCKEY_ADDRESS &&
> +		    chain->ms.map)
> +			chain->srcline = get_srcline(chain->ms.map->dso,
> +						  map__rip_2objdump(
> +							  chain->ms.map,
> +							  chain->ip));
> +		if (chain->srcline)
> +			ret += fprintf(fp, "%s %s\n",
> +				       chain->ms.sym->name, chain->srcline);
> +		else
> +			ret += fprintf(fp, "%s\n", chain->ms.sym->name);
> +	} else
>  		ret += fprintf(fp, "0x%0" PRIx64 "\n", chain->ip);

and this place could call it

jirka

  reply	other threads:[~2014-01-15 15:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  1:04 Implement lbr-as-callgraph v3 Andi Kleen
2014-01-14  1:04 ` [PATCH 1/6] perf, tools: fix BFD detection on opensuse Andi Kleen
2014-01-14  1:04 ` [PATCH 2/6] perf, tools: Support handling complete branch stacks as histograms v3 Andi Kleen
2014-01-15 14:48   ` Jiri Olsa
2014-01-15 15:27     ` Andi Kleen
2014-01-15 15:45       ` Jiri Olsa
2014-01-15 15:00   ` Jiri Olsa
2014-01-14  1:04 ` [PATCH 3/6] perf, tools: Add --branch-history option to report v2 Andi Kleen
2014-01-15 14:44   ` Jiri Olsa
2014-01-15 15:23     ` Andi Kleen
2014-01-15 15:42       ` Jiri Olsa
2014-01-14  1:04 ` [PATCH 4/6] perf, tools: Enable printing the srcline in the history Andi Kleen
2014-01-15 15:12   ` Jiri Olsa [this message]
2014-01-14  1:04 ` [PATCH 5/6] perf, tools: Only print base source file for srcline Andi Kleen
2014-01-14  1:04 ` [PATCH 6/6] perf, tools: Support source line numbers in annotate Andi Kleen
2014-01-15 13:59 ` Implement lbr-as-callgraph v3 Jiri Olsa

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=20140115151255.GC17358@krava.redhat.com \
    --to=jolsa@redhat.com \
    --cc=acme@infradead.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome