• Jin Yao's avatar
    perf report: Add branch flag to callchain cursor node · 410024db
    Jin Yao authored
    Since the branch ip has been added to call stack for easier browsing,
    this patch adds more branch information. For example, add a flag to
    indicate if this ip is a branch, and also add with the branch flag.
    
    Then we can know if the cursor node represents a branch and know what
    the branch flag it has.
    
    The branch history code has a loop detection pass that removes loops. It
    would be nice for knowing how many loops were removed then in next
    steps, we can compute out the average number of iterations.
    
    For example:
    
    Before remove_loops(),
    entry0: from = 0x100, to = 0x200
    entry1: from = 0x300, to = 0x250
    entry2: from = 0x300, to = 0x250
    entry3: from = 0x300, to = 0x250
    entry4: from = 0x700, to = 0x800
    
    After remove_loops()
    entry0: from = 0x100, to = 0x200
    entry1: from = 0x300, to = 0x250
    entry2: from = 0x700, to = 0x800
    
    The original entry2 and entry3 are removed. So the number of iterations
    (from = 0x300, to = 0x250) is equal to removed number + 1 (2 + 1).
    
    iterations = removed number + 1;
    average iteractions = Sum(iteractions) / number of samples
    
    This formula ignores other cases, for example, iterations cross multiple
    buffers and one buffer contains 2+ loops. Because in practice, it's good
    enough.
    Signed-off-by: default avatarYao Jin <yao.jin@linux.intel.com>
    Acked-by: default avatarAndi Kleen <ak@linux.intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Kan Liang <kan.liang@intel.com>
    Cc: Linux-kernel@vger.kernel.org
    Cc: Yao Jin <yao.jin@linux.intel.com>
    Link: http://lkml.kernel.org/n/1477876794-30749-2-git-send-email-yao.jin@linux.intel.com
    [ Renamed 'iter' to 'nr_loop_iter' for clarity ]
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    410024db
machine.c 51.8 KB