• F
    perf tools: Fix missing top level callchain · af0a6fa4
    Frederic Weisbecker 提交于
    While recursively printing the branches of each callchains, we
    forget to display the root. It is never printed.
    
    Say we have:
    
        symbol
        f1
        f2
         |
         -------- f3
         |        f4
         |
         ---------f5
                  f6
    
    Actually we never see that, instead it displays:
    
        symbol
        |
        --------- f3
        |         f4
        |
        --------- f5
                  f6
    
    However f1 is always the same than "symbol" and if we are
    sorting by symbols first then "symbol", f1 and f2 will be well
    aligned like in the above example, so displaying f1 looks
    redundant here.
    
    But if we are sorting by something else first (dso, comm,
    etc...), displaying f1 doesn't look redundant but rather
    necessary because the symbol is not well aligned anymore with
    its callchain:
    
         comm     dso        symbol
         f1
         f2
         |
         --------- [...]
    
    And we want the callchain to be obvious.
    So we fix the bug by printing the root branch, but we also
    filter its first entry if we are sorting by symbols first.
    Reported-by: NAnton Blanchard <anton@samba.org>
    Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Paul Mackerras <paulus@samba.org>
    LKML-Reference: <1256246604-17156-1-git-send-email-fweisbec@gmail.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    af0a6fa4
sort.c 5.8 KB