On Fri, Jun 28, 2019 at 05:22:57PM +0800, Jin Yao wrote:
> In some cases small changes in hot loops can show big differences.
> But it's difficult to identify these differences.
> 
> perf diff currently can only diff symbols (functions). We can also expand
> it to diff cycles of individual programs blocks as reported by timed LBR.
> This would allow to identify changes in specific code accurately.
> 
> With this patch set, for example,
> 
>  $ perf record -b ./div
>  $ perf record -b ./div
>  $ perf diff -c cycles
> 
>  # Event 'cycles'
>  #
>  # Baseline                                       [Program Block Range] 
> Cycles Diff  Shared Object     Symbol
>  # ........  
> ......................................................................  
> ................  ..................................
>  #
>      48.75%                                             [div.c:42 -> 
> div.c:45]  147  div               [.] main
>      48.75%                                             [div.c:31 -> 
> div.c:40]    4  div               [.] main
>      48.75%                                             [div.c:40 -> 
> div.c:40]    0  div               [.] main
>      48.75%                                             [div.c:42 -> 
> div.c:42]    0  div               [.] main
>      48.75%                                             [div.c:42 -> 
> div.c:44]    0  div               [.] main
>      19.02%                                 [random_r.c:357 -> 
> random_r.c:360]    0  libc-2.23.so      [.] __random_r
>      19.02%                                 [random_r.c:357 -> 
> random_r.c:373]    0  libc-2.23.so      [.] __random_r
>      19.02%                                 [random_r.c:357 -> 
> random_r.c:376]    0  libc-2.23.so      [.] __random_r
>      19.02%                                 [random_r.c:357 -> 
> random_r.c:380]    0  libc-2.23.so      [.] __random_r
>      19.02%                                 [random_r.c:357 -> 
> random_r.c:392]    0  libc-2.23.so      [.] __random_r
>      16.17%                                     [random.c:288 -> 
> random.c:291]    0  libc-2.23.so      [.] __random
>      16.17%                                     [random.c:288 -> 
> random.c:291]    0  libc-2.23.so      [.] __random
>      16.17%                                     [random.c:288 -> 
> random.c:295]    0  libc-2.23.so      [.] __random
>      16.17%                                     [random.c:288 -> 
> random.c:297]    0  libc-2.23.so      [.] __random
>      16.17%                                     [random.c:291 -> 
> random.c:291]    0  libc-2.23.so      [.] __random
>      16.17%                                     [random.c:293 -> 
> random.c:293]    0  libc-2.23.so      [.] __random
>       8.21%                                             [div.c:22 -> 
> div.c:22]  148  div               [.] compute_flag
>       8.21%                                             [div.c:22 -> 
> div.c:25]    0  div               [.] compute_flag
>       8.21%                                             [div.c:27 -> 
> div.c:28]    0  div               [.] compute_flag
>       5.52%                                           [rand.c:26 -> 
> rand.c:27]    0  libc-2.23.so      [.] rand
>       5.52%                                           [rand.c:26 -> 
> rand.c:28]    0  libc-2.23.so      [.] rand
>       2.27%                                         [rand@plt+0 -> 
> rand@plt+0]    0  div               [.] rand@plt
>       0.01%                                 [entry_64.S:694 -> 
> entry_64.S:694]   16  [kernel.vmlinux]  [k] native_irq_return_iret
>       0.00%                                       [fair.c:7676 -> 
> fair.c:7665]  162  [kernel.vmlinux]  [k] update_blocked_averages
> 
>  '[Program Block Range]' indicates the range of program basic block
>  (start -> end). If we can find the source line it prints the source
>  line otherwise it prints the symbol+offset instead.
> 
>  v6:
>  ---
>  Remove the 'ops' argument in hists__add_entry_block. No functional change.
> 
>  Changed patches
>   perf util: Add block_info in hist_entry 
>   perf diff: Use hists to manage basic blocks per symbol

Reviewed-by: Jiri Olsa <[email protected]>

thanks,
jirka

Reply via email to