• Arnaldo Carvalho de Melo's avatar
    perf annotate browser: Initial loop detection · a3f895be
    Arnaldo Carvalho de Melo authored
    Simple algorithm, just look for the next backward jump that points to
    before the cursor.
    
    Then draw an arrow connecting the jump to its target.
    
    Do this as you move the cursor, entering/exiting possible loops.
    
    Ex (graph chars replaced to avoid mail encoding woes):
    
    avc_has_perm_flags
        0.00 |         nopl   0x0(%rax)
        5.36 |+-> 68:  mov    (%rax),%rax
        5.15 ||        test   %rax,%rax
        0.00 ||      v je     130
        2.96 ||   74:  cmp    -0x20(%rax),%ebx
       47.38 ||        lea    -0x20(%rax),%rcx
        0.28 ||      ^ jne    68
        3.16 ||        cmp    -0x18(%rax),%dx
        0.00 |+------^ jne    68
        4.92 |         cmp    0x4(%rcx),%r13d
        0.00 |       v jne    68
        1.15 |         test   %rcx,%rcx
        0.00 |       v je     130
    Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Namhyung Kim <namhyung@gmail.com>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/n/tip-5gairf6or7dazlx3ocxwvftm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    a3f895be
browser.c 13.6 KB