All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf annotate: Display multiple events for --stdio
@ 2018-05-09 15:57 Jin Yao
  2018-05-09 16:42 ` Arnaldo Carvalho de Melo
  2018-05-15  6:40 ` [tip:perf/urgent] perf annotate: Display all available events on --stdio tip-bot for Jin Yao
  0 siblings, 2 replies; 6+ messages in thread
From: Jin Yao @ 2018-05-09 15:57 UTC (permalink / raw)
  To: acme, jolsa, peterz, mingo, alexander.shishkin
  Cc: Linux-kernel, ak, kan.liang, yao.jin, Jin Yao

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)
-----------------------------------------------------------------------------------
                 :
                 :
                 :
                 :            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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf annotate: Display multiple events for --stdio
  2018-05-09 15:57 [PATCH] perf annotate: Display multiple events for --stdio Jin Yao
@ 2018-05-09 16:42 ` Arnaldo Carvalho de Melo
  2018-05-09 17:24   ` Arnaldo Carvalho de Melo
  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
  1 sibling, 2 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-09 16:42 UTC (permalink / raw)
  To: Jin Yao
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf annotate: Display multiple events for --stdio
  2018-05-09 16:42 ` Arnaldo Carvalho de Melo
@ 2018-05-09 17:24   ` Arnaldo Carvalho de Melo
  2018-05-10  0:49     ` Jin, Yao
  2018-05-10  0:29   ` Jin, Yao
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-05-09 17:24 UTC (permalink / raw)
  To: Jin Yao
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin

Em Wed, May 09, 2018 at 01:42:51PM -0300, Arnaldo Carvalho de Melo escreveu:
> 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.

Also you forgot to add this:

Cc: Jiri Olsa <jolsa@kernel.org>
Fixes: f681d593d1ce ("perf annotate: Remove disasm__calc_percent() from disasm_line__print()")

Which I've just added, to help with stable@ processing.

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf annotate: Display multiple events for --stdio
  2018-05-09 16:42 ` Arnaldo Carvalho de Melo
  2018-05-09 17:24   ` Arnaldo Carvalho de Melo
@ 2018-05-10  0:29   ` Jin, Yao
  1 sibling, 0 replies; 6+ messages in thread
From: Jin, Yao @ 2018-05-10  0:29 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin



On 5/10/2018 12:42 AM, Arnaldo Carvalho de Melo wrote:
> 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
> 

Breaking the scripts? Oh, very sorry about that, I will be careful next 
time.

Thanks
Jin Yao

>>                   :
>>                   :
>>                   :
>>                   :            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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf annotate: Display multiple events for --stdio
  2018-05-09 17:24   ` Arnaldo Carvalho de Melo
@ 2018-05-10  0:49     ` Jin, Yao
  0 siblings, 0 replies; 6+ messages in thread
From: Jin, Yao @ 2018-05-10  0:49 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: jolsa, peterz, mingo, alexander.shishkin, Linux-kernel, ak,
	kan.liang, yao.jin



On 5/10/2018 1:24 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 09, 2018 at 01:42:51PM -0300, Arnaldo Carvalho de Melo escreveu:
>> 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.
> 
> Also you forgot to add this:
> 
> Cc: Jiri Olsa <jolsa@kernel.org>
> Fixes: f681d593d1ce ("perf annotate: Remove disasm__calc_percent() from disasm_line__print()")
> 
> Which I've just added, to help with stable@ processing.
> 
> - Arnaldo
> 

Actually I notice this issue during fixing another issue. :)

Another issue is, without using group, the multiple events can't be 
supported well in perf annotate.

perf record -e cycles,branches ./div
perf annotate main --stdio

It should show both cycles and branches on the left side but actually it 
only show cycles.

I will post patches for fixing this (working on the patch now).

Thanks
Jin Yao

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:perf/urgent] perf annotate: Display all available events on --stdio
  2018-05-09 15:57 [PATCH] perf annotate: Display multiple events for --stdio Jin Yao
  2018-05-09 16:42 ` Arnaldo Carvalho de Melo
@ 2018-05-15  6:40 ` tip-bot for Jin Yao
  1 sibling, 0 replies; 6+ messages in thread
From: tip-bot for Jin Yao @ 2018-05-15  6:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: yao.jin, ak, peterz, alexander.shishkin, hpa, kan.liang,
	linux-kernel, tglx, acme, mingo, jolsa

Commit-ID:  04d2600ab669b2d44dd7920cc8a1b95c8144084c
Gitweb:     https://git.kernel.org/tip/04d2600ab669b2d44dd7920cc8a1b95c8144084c
Author:     Jin Yao <yao.jin@linux.intel.com>
AuthorDate: Wed, 9 May 2018 23:57:15 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 10 May 2018 15:19:30 -0300

perf annotate: Display all available events on --stdio

When we perform the following command lines:

  $ perf record -e "{cycles,branches}" ./div
  $ perf annotate main --stdio

The output shows only the first event, "cycles" and the displaying
format is not correct.

   Percent         |      Source code & Disassembly of div for cycles (44550 samples)
  -----------------------------------------------------------------------------------
                   :
                   :
                   :
                   :            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 that the value of the 'nr_percent' variable 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>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: f681d593d1ce ("perf annotate: Remove disasm__calc_percent() from disasm_line__print()")
Link: http://lkml.kernel.org/r/1525881435-4092-1-git-send-email-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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 536ee148bff8..5d74a30fe00f 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;
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-15  6:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-09 15:57 [PATCH] perf annotate: Display multiple events for --stdio Jin Yao
2018-05-09 16:42 ` Arnaldo Carvalho de Melo
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

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.