• Namhyung Kim's avatar
    perf ui/tui: Reset output width for hierarchy · 5ff3e7a2
    Namhyung Kim authored
    When --hierarchy option is used, each entry has its own hpp_list to show
    the result.  But it missed to update width of each column.
    
    Before:
    
      - 46.29% 48.12%        netctl-auto
         + 31.44% 29.25%        [kernel.vmlinux]
         + 8.52% 11.55%        libc-2.22.so
         + 5.19% 6.91%        bash
      + 10.75% 11.83%        wpa_cli
      + 8.25% 2.23%        swapper
      + 6.45% 5.40%        tr
      + 4.81% 8.09%        awk
      + 4.15% 2.85%        firefox
      + 3.86% 2.53%        sh
    
    After:
    
      -  46.29%  48.12%        netctl-auto
          +  31.44%  29.25%        [kernel.vmlinux]
          +   8.52%  11.55%        libc-2.22.so
          +   5.19%   6.91%        bash
      +  10.75%  11.83%        wpa_cli
      +   8.25%   2.23%        swapper
      +   6.45%   5.40%        tr
      +   4.81%   8.09%        awk
      +   4.15%   2.85%        firefox
      +   3.86%   2.53%        sh
    
    Committer note:
    
    Full testing instructions:
    
    1) Record with an event group:
    
      $ perf record -e '{cycles,instructions}' make -j4
    
    2) Use report in hierarchy mode, to get a few expanded trees on
       the same screen, use --percent-limit:
    
      $ perf report --hierarchy --percent-limit 0.5
    
    Samples: 103K of event 'anon group { cycles:u, instructions:u }',
    Event count (approx.): 57317631725
             Overhead        Command / Shared Object / Symbol        ◆
    -  58.89%  55.12%        cc1                                     ▒
       -  50.26%  48.10%        cc1                                  ▒
              3.61%   5.13%        [.] _cpp_lex_token                ▒
              2.58%   0.78%        [.] ht_lookup_with_hash           ▒
              1.31%   1.30%        [.] ggc_internal_alloc            ▒
              1.08%   2.25%        [.] get_combined_adhoc_loc        ▒
              1.01%   1.95%        [.] ira_init                      ▒
              0.96%   1.78%        [.] linemap_position_for_column   ▒
              0.65%   1.01%        [.] cpp_get_token_with_location   ▒
       -   7.52%   6.58%        libc-2.23.so                         ▒
              1.70%   1.78%        [.] _int_malloc                   ▒
              0.69%   0.75%        [.] _int_free                     ▒
              0.67%   0.42%        [.] malloc_consolidate            ▒
       -   0.58%   0.42%        ld-2.23.so                           ▒
                                   no entry >= 0.50%                 ▒
       -   0.52%   0.03%        [kernel.vmlinux]                     ▒
                                   no entry >= 0.50%                 ▒
    Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Fixes: 1b2dbbf4 ("perf hists: Use own hpp_list for hierarchy mode")
    Link: http://lkml.kernel.org/r/20160920053025.13989-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    5ff3e7a2
hists.c 81.4 KB