• J
    perf report: Refactor the branch info printing code · 8d51735f
    Jin Yao 提交于
    The branch info such as predicted/cycles/... are printed at the
    callchain entries.
    
    For example: perf report --branch-history --no-children --stdio
    
        --1.07%--main div.c:39 (predicted:52.4% cycles:1 iterations:17)
                  main div.c:44 (predicted:52.4% cycles:1)
                  main div.c:42 (cycles:2)
                  compute_flag div.c:28 (cycles:2)
                  compute_flag div.c:27 (cycles:1)
                  rand rand.c:28 (cycles:1)
                  rand rand.c:28 (cycles:1)
                  __random random.c:298 (cycles:1)
                  __random random.c:297 (cycles:1)
                  __random random.c:295 (cycles:1)
                  __random random.c:295 (cycles:1)
                  __random random.c:295 (cycles:1)
    
    But the current code is difficult to maintain and extend. This patch
    refactors the code for easy maintenance.
    
    Change log:
    
    v6: 1. Put the multiline condition code into {} brackets in
           counts_str_build()
    
        2. Keep the original display order, that is:
           predicted, abort, cycles, iterations
    
    v5: It's a new patch in v5 patch series.
    Signed-off-by: NYao Jin <yao.jin@linux.intel.com>
    Acked-by: NJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Michael Ellerman <mpe@ellerman.id.au>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lkml.kernel.org/r/1500379995-6449-5-git-send-email-yao.jin@linux.intel.com
    [ Don't use 'index' as a name for a variable, it shadows a globa decl in older distros ]
    Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
    8d51735f
callchain.c 32.9 KB