Re: [PATCH] perf diff: Report noisy for cycles diff

2019-07-17 Thread Jin, Yao




On 7/16/2019 4:51 PM, Jiri Olsa wrote:

On Fri, Jul 12, 2019 at 03:53:55PM +0800, Jin Yao wrote:

This patch prints the stddev and hist for the cycles diff of
program block. It can help us to understand if the cycles diff
is noisy or not.


I'm getting compile error:

   CC   builtin-diff.o
builtin-diff.c: In function ‘compute_cycles_diff’:
builtin-diff.c:712:10: error: taking the absolute value of unsigned type ‘u64’ 
{aka ‘long unsigned int’} has no effect [-Werror=absolute-value]
   712 |  labs(pair->block_info->cycles_spark[i] -
   |  ^~~~
cc1: all warnings being treated as errors
mv: cannot stat './.builtin-diff.o.tmp': No such file or directory




Oh, sorry about that. My gcc (gcc version 7.4.0 (Ubuntu 
7.4.0-1ubuntu1~18.04.1)) didn't report this error. :(


u64 - u64 is u64. I should define it as s64.

Thanks for reminding me.

Thanks
Jin Yao


jirka



Re: [PATCH] perf diff: Report noisy for cycles diff

2019-07-16 Thread Jiri Olsa
On Fri, Jul 12, 2019 at 03:53:55PM +0800, Jin Yao wrote:
> This patch prints the stddev and hist for the cycles diff of
> program block. It can help us to understand if the cycles diff
> is noisy or not.

I'm getting compile error:

  CC   builtin-diff.o
builtin-diff.c: In function ‘compute_cycles_diff’:
builtin-diff.c:712:10: error: taking the absolute value of unsigned type ‘u64’ 
{aka ‘long unsigned int’} has no effect [-Werror=absolute-value]
  712 |  labs(pair->block_info->cycles_spark[i] -
  |  ^~~~
cc1: all warnings being treated as errors
mv: cannot stat './.builtin-diff.o.tmp': No such file or directory


jirka


[PATCH] perf diff: Report noisy for cycles diff

2019-07-12 Thread Jin Yao
This patch prints the stddev and hist for the cycles diff of
program block. It can help us to understand if the cycles diff
is noisy or not.

This patch is inspired by Andi Kleen's patch
https://lwn.net/Articles/600471/

We create new option '-n or --noisy'.

Example:

perf record -b ./div
perf record -b ./div
perf diff -c cycles

 # Event 'cycles'
 #
 # Baseline   [Program Block Range] Cycles 
Diff  Shared Object  Symbol
 #   
..  
.  
 #
 46.42% [div.c:40 -> div.c:40]  
  0  div[.] main
 46.42% [div.c:42 -> div.c:44]  
  0  div[.] main
 46.42% [div.c:42 -> div.c:39]  
  0  div[.] main
 20.72% [random_r.c:357 -> random_r.c:394]  
 -2  libc-2.27.so   [.] __random_r
 20.72% [random_r.c:357 -> random_r.c:380]  
 -1  libc-2.27.so   [.] __random_r
 20.72% [random_r.c:388 -> random_r.c:388]  
  0  libc-2.27.so   [.] __random_r
 20.72% [random_r.c:388 -> random_r.c:391]  
  0  libc-2.27.so   [.] __random_r
 17.58% [random.c:288 -> random.c:291]  
  0  libc-2.27.so   [.] __random
 17.58% [random.c:291 -> random.c:291]  
  0  libc-2.27.so   [.] __random
 17.58% [random.c:293 -> random.c:293]  
  0  libc-2.27.so   [.] __random
 17.58% [random.c:295 -> random.c:295]  
  0  libc-2.27.so   [.] __random
 17.58% [random.c:295 -> random.c:295]  
  0  libc-2.27.so   [.] __random
 17.58% [random.c:298 -> random.c:298]  
  0  libc-2.27.so   [.] __random
  8.33% [div.c:22 -> div.c:25]  
  0  div[.] compute_flag
  8.33% [div.c:27 -> div.c:28]  
  0  div[.] compute_flag
  4.80%   [rand.c:26 -> rand.c:27]  
  0  libc-2.27.so   [.] rand
  4.80%   [rand.c:28 -> rand.c:28]  
  0  libc-2.27.so   [.] rand
  2.14% [rand@plt+0 -> rand@plt+0]  
  0  div[.] rand@plt

When we enable the option '-n', the output is

perf diff -c cycles -n

 # Event 'cycles'
 #
 # Baseline [Program Block Range]/Cycles 
Diff/stddev/Hist  Shared Object  Symbol
 #   

  .  
 #
 46.42%[div.c:40 -> div.c:40]0  ± 
40.2% ▂███▁▂▁▁   div[.] main
 46.42%[div.c:42 -> div.c:44]0  
±100.0% █▁▁▁   div[.] main
 46.42%[div.c:42 -> div.c:39]0  ± 
15.3% ▃▃▂▆▃▂█▁   div[.] main
 20.72%[random_r.c:357 -> random_r.c:394]   -2  ± 
20.1% ▁▄▄▅▂▅█▁   libc-2.27.so   [.] __random_r
 20.72%[random_r.c:357 -> random_r.c:380]   -1  ± 
20.9% ▁▆▇▁█▅▇█   libc-2.27.so   [.] __random_r
 20.72%[random_r.c:388 -> random_r.c:388]0  ±  
0.0%libc-2.27.so   [.] __random_r
 20.72%[random_r.c:388 -> random_r.c:391]0  ± 
88.0% ▁▁▁█   libc-2.27.so   [.] __random_r
 17.58%[random.c:288 -> random.c:291]0  ± 
29.3% ▁▁█▁   libc-2.27.so   [.] __random
 17.58%[random.c:291 -> random.c:291]0  ± 
29.3% ▁▁▁█   libc-2.27.so   [.] __random
 17.58%[random.c:293 -> random.c:293]0  ± 
29.3% ▁▁▁█   libc-2.27.so   [.] __random
 17.58%[random.c:295 -> random.c:295]0  ±  
0.0%libc-2.27.so   [.] __random
 17.58%[random.c:295 -> random.c:295]0  ±  
0.0%libc-2.27.so   [.] __random
 17.58%[random.c:298 -> random.c:298]0  ±  
0.0%libc-2.27.so   [.] __random
  8.33%[div.c:22 -> div.c:25]0  ± 
29.3% ▁▁█▁   div[.] compute_flag
  8.33%[div.c:27 -> div.c:28]0  ± 
48.8% ▁██▁▁▁█▁   div