• Namhyung Kim's avatar
    perf hist: Improve srcline sort key performance · ec222d7e
    Namhyung Kim authored
    The sort_entry->cmp() will be called for eventy sample data to find a
    matching entry.  When it has 'srcline' sort key, that means it needs to
    call addr2line or libbfd everytime.
    
    This is not optimal because many samples will have same address and it
    just can call addr2line once.  So postpone the actual srcline check to
    the sort_entry->collpase() and compare addresses in ->cmp().
    
    Also it needs to add ->init() callback to make sure it has srcline info.
    If a sample has a unique data, chances are the entry can be sorted out
    by other (previous) keys and callbacks in sort_srcline never called.
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Acked-by: default avatarIan Rogers <irogers@google.com>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Leo Yan <leo.yan@linaro.org>
    Cc: Milian Wolff <milian.wolff@kdab.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20221215192817.2734573-8-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    ec222d7e
sort.c 86.8 KB