perf diff: Use hists__link when not pairing just with baseline
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Nov 2012 21:08:26 +0000 (18:08 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 8 Nov 2012 21:08:26 +0000 (18:08 -0300)
Previously there were blind spots because we were not looking at symbols
that didn't ocurred in the latest run:

  # perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.018 MB perf.data (~801 samples) ]
  # perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.018 MB perf.data (~801 samples) ]

Before:

  # perf diff
  # Event 'cycles'
  #
  # Baseline    Delta      Shared Object                         Symbol
  # ........  .......  .................  .............................
  #
              +10.38%  [kernel.kallsyms]  [k] get_empty_filp
               +9.51%  [kernel.kallsyms]  [k] update_sd_lb_stats
               +9.41%  libpopt.so.0.0.0   [.] _init
               +9.29%  [kernel.kallsyms]  [k] vma_interval_tree_insert
       9.05%   +0.12%  [kernel.kallsyms]  [k] do_sys_open
               +9.14%  [kernel.kallsyms]  [k] kfree
               +8.98%  [kernel.kallsyms]  [k] free_pages_and_swap_cache
               +8.78%  [kernel.kallsyms]  [k] unmap_page_range
       9.36%   -0.90%  [kernel.kallsyms]  [k] zap_pte_range
       7.60%   +0.09%  [kernel.kallsyms]  [k] find_next_bit
               +4.37%  [kernel.kallsyms]  [k] place_entity
               +3.38%  [kernel.kallsyms]  [k] __do_page_fault
               +0.80%  [kernel.kallsyms]  [k] native_apic_mem_write
       0.21%   +0.43%  [kernel.kallsyms]  [k] native_write_msr_safe
  #

So 9.05 + 9.36 + 7.60 + 0.21 != 100%

Now using the recently introduced hists__link we can see the whole
picture:

  # perf diff
  # Event 'cycles'
  #
  # Baseline    Delta      Shared Object                         Symbol
  # ........  .......  .................  .............................
  #
       8.44%   -8.44%  [kernel.kallsyms]  [k] _raw_spin_lock
       9.05%   -9.05%  [kernel.kallsyms]  [k] sha_transform
      10.55%  -10.55%  [kernel.kallsyms]  [k] __d_lookup_rcu
              +10.38%  [kernel.kallsyms]  [k] get_empty_filp
      17.70%  -17.70%  [kernel.kallsyms]  [k] kmem_cache_free
               +9.51%  [kernel.kallsyms]  [k] update_sd_lb_stats
               +9.41%  libpopt.so.0.0.0   [.] _init
               +9.29%  [kernel.kallsyms]  [k] vma_interval_tree_insert
       9.05%   +0.12%  [kernel.kallsyms]  [k] do_sys_open
               +9.14%  [kernel.kallsyms]  [k] kfree
               +8.98%  [kernel.kallsyms]  [k] free_pages_and_swap_cache
               +8.78%  [kernel.kallsyms]  [k] unmap_page_range
       9.36%   -0.90%  [kernel.kallsyms]  [k] zap_pte_range
       7.60%   +0.09%  [kernel.kallsyms]  [k] find_next_bit
               +4.37%  [kernel.kallsyms]  [k] place_entity
               +3.38%  [kernel.kallsyms]  [k] __do_page_fault
       4.01%   -4.01%  [kernel.kallsyms]  [k] handle_pte_fault
       9.27%   -9.27%  [kernel.kallsyms]  [k] find_get_page
       0.78%   -0.78%  [kernel.kallsyms]  [k] rcu_irq_enter
       0.57%   -0.57%  [kernel.kallsyms]  [k] finish_task_switch
       4.25%   -4.25%  [kernel.kallsyms]  [k] run_timer_softirq
               +0.80%  [kernel.kallsyms]  [k] native_apic_mem_write
       0.21%   +0.43%  [kernel.kallsyms]  [k] native_write_msr_safe
       9.16%   -9.16%  ld-2.12.so         [.] close
  #

Now:

8.44 + 9.05 + 10.55 + 17.70 + 9.05 + 9.36 +
7.60 + 4.01 + 9.27 + 0.78 + 0.57 + 4.25 + 0.21 + 9.16 == 100%

Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-jeq55qdgby1745bs8r9sscdh@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-diff.c

index e99fb3bc1c2dc61ab6c69c35c50bc06680532fd3..93b852f8a5d5936c902a720ed74cde4904bfa781 100644 (file)
@@ -491,6 +491,8 @@ static void hists__process(struct hists *old, struct hists *new)
 
        if (show_baseline_only)
                hists__baseline_only(new);
+       else
+               hists__link(new, old);
 
        if (sort_compute) {
                hists__precompute(new);