linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Milian Wolff <milian.wolff@kdab.com>
Cc: linux-perf-users@vger.kernel.org, "Jiri Olsa" <jolsa@kernel.org>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>
Subject: Re: [PATCH] perf report: Support caller callchain order when using DWARF unwinder.
Date: Sun, 4 Oct 2015 17:38:17 -0300	[thread overview]
Message-ID: <20151004203817.GE20515@kernel.org> (raw)
In-Reply-To: <1443971797-25548-1-git-send-email-milian.wolff@kdab.com>

Em Sun, Oct 04, 2015 at 05:16:37PM +0200, Milian Wolff escreveu:
> We cannot reverse the order of the libunwind stepper. To workaround
> this, we store the IPs in a temporary stack buffer and then walk
> this buffer in reverse order when callchain_param.order is set to
> ORDER_CALLER.
> 
> Signed-off-by: Milian Wolff <milian.wolff@kdab.com>

Jiri,

	Can you please take a look at this?

- Arnaldo
 
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> ---
>  tools/perf/util/unwind-libunwind.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
> index 4c00507..bf631f1 100644
> --- a/tools/perf/util/unwind-libunwind.c
> +++ b/tools/perf/util/unwind-libunwind.c
> @@ -621,11 +621,24 @@ static int get_entries(struct unwind_info *ui, unwind_entry_cb_t cb,
>  	if (ret)
>  		display_error(ret);
>  
> -	while (!ret && (unw_step(&c) > 0) && max_stack--) {
> -		unw_word_t ip;
> +	if (callchain_param.order == ORDER_CALLEE) {
> +		while (!ret && (unw_step(&c) > 0) && max_stack--) {
> +			unw_word_t ip;
>  
> -		unw_get_reg(&c, UNW_REG_IP, &ip);
> -		ret = ip ? entry(ip, ui->thread, cb, arg) : 0;
> +			unw_get_reg(&c, UNW_REG_IP, &ip);
> +			ret = ip ? entry(ip, ui->thread, cb, arg) : 0;
> +		}
> +	} else {
> +		unw_word_t ips[max_stack];
> +		int i = 0;
> +
> +		while ((unw_step(&c) > 0) && i < max_stack) {
> +			unw_get_reg(&c, UNW_REG_IP, &ips[i]);
> +			++i;
> +		}
> +		max_stack = i;
> +		for (i = max_stack - 1; i >= 0; --i)
> +			entry(ips[i], ui->thread, cb, arg);
>  	}
>  
>  	return ret;
> -- 
> 2.6.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2015-10-04 20:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-04 15:16 [PATCH] perf report: Support caller callchain order when using DWARF unwinder Milian Wolff
2015-10-04 20:38 ` Arnaldo Carvalho de Melo [this message]
2015-10-05 11:08   ` Jiri Olsa
2015-10-09 17:29     ` Milian Wolff
2015-11-02 21:19       ` Arnaldo Carvalho de Melo
2015-11-03  7:33         ` Jiri Olsa
2015-11-03 12:06           ` Arnaldo Carvalho de Melo
2015-11-03 12:54             ` Milian Wolff
2015-11-03 14:28               ` Arnaldo Carvalho de Melo
2015-11-03 14:30                 ` Arnaldo Carvalho de Melo
2015-11-03 14:32                 ` Jiri Olsa
2015-11-03 15:11                   ` Arnaldo Carvalho de Melo
2015-11-03  7:37       ` Jiri Olsa
2015-11-03 11:25         ` Milian Wolff

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=20151004203817.GE20515@kernel.org \
    --to=acme@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=milian.wolff@kdab.com \
    --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;
as well as URLs for NNTP newsgroup(s).