linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: James Clark <james.clark@arm.com>,
	acme@kernel.org, linux-perf-users@vger.kernel.org
Cc: german.gomez@arm.com, leo.yan@linaro.com,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] perf: Print branch stack entry type in --dump-raw-trace
Date: Tue, 8 Mar 2022 09:59:24 +0530	[thread overview]
Message-ID: <fb9717bb-735a-88d9-254d-0e7b2f7209f2@arm.com> (raw)
In-Reply-To: <20220307171917.2555829-3-james.clark@arm.com>



On 3/7/22 22:49, James Clark wrote:
> This can help with debugging issues. It only prints when -j save_type
> is used otherwise an empty string is printed.

Specifying events with PERF_SAMPLE_BRANCH_CALL_STACK flag explicitly might
be better along with '-j save_type'.

> 
> Before the change:
> 
>   101603801707130 0xa70 [0x630]: PERF_RECORD_SAMPLE(IP, 0x2): 1108/1108: 0xffff9c1df24c period: 10694 addr: 0
>   ... branch stack: nr:64
>   .....  0: 0000ffff9c26029c -> 0000ffff9c26f340 0 cycles  P   0
>   .....  1: 0000ffff9c2601bc -> 0000ffff9c26f340 0 cycles  P   0
> 
> After the change:
> 
>   101603801707130 0xa70 [0x630]: PERF_RECORD_SAMPLE(IP, 0x2): 1108/1108: 0xffff9c1df24c period: 10694 addr: 0
>   ... branch stack: nr:64
>   .....  0: 0000ffff9c26029c -> 0000ffff9c26f340 0 cycles  P   0 CALL
>   .....  1: 0000ffff9c2601bc -> 0000ffff9c26f340 0 cycles  P   0 IND_CALL
> 
> Signed-off-by: James Clark <james.clark@arm.com>
> ---
>  tools/perf/util/session.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
> index f54282d5c648..3b8dfe603e50 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -1159,14 +1159,15 @@ static void branch_stack__printf(struct perf_sample *sample, bool callstack)
>  		struct branch_entry *e = &entries[i];
>  
>  		if (!callstack) {
> -			printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 " %hu cycles %s%s%s%s %x\n",
> +			printf("..... %2"PRIu64": %016" PRIx64 " -> %016" PRIx64 " %hu cycles %s%s%s%s %x %s\n",
>  				i, e->from, e->to,
>  				(unsigned short)e->flags.cycles,
>  				e->flags.mispred ? "M" : " ",
>  				e->flags.predicted ? "P" : " ",
>  				e->flags.abort ? "A" : " ",
>  				e->flags.in_tx ? "T" : " ",
> -				(unsigned)e->flags.reserved);
> +				(unsigned)e->flags.reserved,
> +				e->flags.type ? branch_type_name(e->flags.type) : "");
>  		} else {
>  			printf("..... %2"PRIu64": %016" PRIx64 "\n",
>  				i, i > 0 ? e->from : e->to);

LGTM but I am wondering whether this might affect existing tools ?

  reply	other threads:[~2022-03-08  4:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 17:19 [PATCH 0/4] Branch stack improvements James Clark
2022-03-07 17:19 ` [PATCH 1/4] perf: Add error message for unsupported branch stack cases James Clark
2022-03-08  4:17   ` Anshuman Khandual
2022-03-07 17:19 ` [PATCH 2/4] perf: Print branch stack entry type in --dump-raw-trace James Clark
2022-03-08  4:29   ` Anshuman Khandual [this message]
2022-03-08 11:58     ` James Clark
2022-03-07 17:19 ` [PATCH 3/4] perf: Refactor perf script branch stack printing James Clark
2022-03-08  5:06   ` Anshuman Khandual
2022-03-07 17:19 ` [PATCH 4/4] perf script: Output branch sample type James Clark
2022-03-08  5:22   ` Anshuman Khandual
2022-03-08 12:09     ` James Clark
2022-03-07 17:53 ` [PATCH 0/4] Branch stack improvements Arnaldo Carvalho de Melo

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=fb9717bb-735a-88d9-254d-0e7b2f7209f2@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=german.gomez@arm.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@linaro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.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).