public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Jin Yao <yao.jin@linux.intel.com>
Cc: jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH] perf annotate: Display multiple events for --stdio
Date: Wed, 9 May 2018 13:42:51 -0300	[thread overview]
Message-ID: <20180509164251.GH13491@kernel.org> (raw)
In-Reply-To: <1525881435-4092-1-git-send-email-yao.jin@linux.intel.com>

Em Wed, May 09, 2018 at 11:57:15PM +0800, Jin Yao escreveu:
> When we perform following command lines:
> 
> perf record -e "{cycles,branches}" ./div
> perf annotate main --stdio
> 
> Only shows one event "cycles" and the displaying format is not correct.
> 
>  Percent         |      Source code & Disassembly of div for cycles (44550 samples)
> -----------------------------------------------------------------------------------

Please indent command output (two spaces before all lines) to avoid
scripts breaking due to mistaking lines starting with --- as the end of
the patch.

Applying.

- Arnaldo

>                  :
>                  :
>                  :
>                  :            Disassembly of section .text:
>                  :
>                  :            00000000004004b0 <main>:
>                  :            main():
>                  :
>                  :                    return i;
>                  :            }
>                  :
>                  :            int main(void)
>                  :            {
>     0.00 :   4004b0:       push   %rbx
>                  :                    int i;
>                  :                    int flag;
>                  :                    volatile double x = 1212121212, y = 121212;
>                  :
>                  :                    s_randseed = time(0);
>     0.00 :   4004b1:       xor    %edi,%edi
>                  :                    srand(s_randseed);
>     0.00 :   4004b3:       mov    $0x77359400,%ebx
>                  :
>                  :                    return i;
>                  :            }
>                  :
> 
> The issue is the value of nr_percent is hardcoded to 1.
> This patch fixes it.
> 
> With this patch, the output is:
> 
>  Percent         |      Source code & Disassembly of div for cycles (44550 samples)
> -----------------------------------------------------------------------------------
>                  :
>                  :
>                  :
>                  :            Disassembly of section .text:
>                  :
>                  :            00000000004004b0 <main>:
>                  :            main():
>                  :
>                  :                    return i;
>                  :            }
>                  :
>                  :            int main(void)
>                  :            {
>     0.00    0.00 :   4004b0:       push   %rbx
>                  :                    int i;
>                  :                    int flag;
>                  :                    volatile double x = 1212121212, y = 121212;
>                  :
>                  :                    s_randseed = time(0);
>     0.00    0.00 :   4004b1:       xor    %edi,%edi
>                  :                    srand(s_randseed);
>     0.00    0.00 :   4004b3:       mov    $0x77359400,%ebx
>                  :
>                  :                    return i;
>                  :            }
> 
> Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
> ---
>  tools/perf/util/annotate.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index 536ee14..5d74a30 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -1263,6 +1263,9 @@ annotation_line__print(struct annotation_line *al, struct symbol *sym, u64 start
>  				max_percent = sample->percent;
>  		}
>  
> +		if (al->samples_nr > nr_percent)
> +			nr_percent = al->samples_nr;
> +
>  		if (max_percent < min_pcnt)
>  			return -1;
>  
> -- 
> 2.7.4

  reply	other threads:[~2018-05-09 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 15:57 [PATCH] perf annotate: Display multiple events for --stdio Jin Yao
2018-05-09 16:42 ` Arnaldo Carvalho de Melo [this message]
2018-05-09 17:24   ` Arnaldo Carvalho de Melo
2018-05-10  0:49     ` Jin, Yao
2018-05-10  0:29   ` Jin, Yao
2018-05-15  6:40 ` [tip:perf/urgent] perf annotate: Display all available events on --stdio tip-bot for Jin Yao

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=20180509164251.GH13491@kernel.org \
    --to=acme@kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox