• Frederic Weisbecker's avatar
    perf tools: Fix display of first level of callchains · 6d4818c5
    Frederic Weisbecker authored
    The callchain stdio mode display was written using a sorted by symbol
    report. In this mode we have only one callchain root per hist so we
    forgot to handle cases where we have multiple callchain root, as in per
    dso sorting for example.
    
    Fix this by handling these roots like any other branch, with the hist as
    the parent.
    
    Before:
    
         1.97%  libpthread-2.12.1.so
                |
                --- __libc_write
                    create_worker
                    bench_sched_messaging
                    cmd_bench
                    run_builtin
                    main
                    __libc_start_main
    
                |
                --- __libc_read
                    create_worker
                    bench_sched_messaging
                    cmd_bench
                    run_builtin
                    main
                    __libc_start_main
    
    After:
    
         1.97%  libpthread-2.12.1.so
                |
                |--36.97%-- __libc_write
                |          create_worker
                |          bench_sched_messaging
                |          cmd_bench
                |          run_builtin
                |          main
                |          __libc_start_main
                |
                |--31.47%-- __libc_read
                |          create_worker
                |          bench_sched_messaging
                |          cmd_bench
                |          run_builtin
                |          main
                |          __libc_start_main
               ...
    
    Single roots keep their entry without percentage because they have
    the same overhead than the hist they refer to. ie: 100% in fractal
    mode and the percentage of the hist in graph mode:
    
         0.00%  [k] reschedule_interrupt
                |
                --- default_idle
                    amd_e400_idle
                    cpu_idle
                    start_secondary
    Reported-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/r/1332526010-15400-1-git-send-email-fweisbec@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    6d4818c5
hist.c 31.8 KB