• Jin Yao's avatar
    perf diff: Use hists to manage basic blocks per symbol · 99150a1f
    Jin Yao authored
    The hist__account_cycles() can account cycles per basic block. The basic
    block information is saved in cycles_hist structure.
    
    This patch processes each symbol, get basic blocks from cycles_hist and
    add the basic block entries to a new hists (in 'struct block_hist').
    Using a hists is because we need to compare, sort and print the basic
    blocks later.
    
     v6:
     ---
     Since 'ops' argument is removed from hists__add_entry_block,
     update the code accordingly. No functional change.
    
     v5:
     ---
     Since now we still carry block_info in 'struct hist_entry'
     we don't need to use our own new/free ops for hist entries.
     And the block_info is released in hist_entry__delete.
    
     v3:
     ---
     1. In v2, we put block stuffs in 'struct hist_entry', but
     it's not a good design. In v3, we create a new
     'struct block_hist' and cast the 'struct hist_entry' to
     'struct block_hist' in some places, which can avoid adding
     new stuffs in 'struct hist_entry'.
    
     2. abs() -> labs(), in block_cycles_diff_cmp().
    
     v2:
     ---
     v1 adds the basic block entries to per data-file hists
     but v2 adds the basic block entries to per symbol hists.
     That is to keep current perf-diff format. Will show the
     result in next patches.
    Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
    Reviewed-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Jin Yao <yao.jin@intel.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/1561713784-30533-5-git-send-email-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    99150a1f
sort.h 7.28 KB