Skip to content

perf tools: Honor column width setting

Namhyung Kim lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6perf tools: Left-align output contentstools/perf/util/sort.c+3 -30 replies
2/6perf tools: Make __hpp__fmt() receive an additional len argumenttools/perf/ui/browsers/hists.c tools/perf/ui/gtk/hists.c tools/perf/ui/hist.c +3 more+54 -320 replies
3/6perf tools: Save column length in perf_hpp_fmttools/perf/ui/browsers/hists.c tools/perf/ui/hist.c tools/perf/util/hist.h +1 more+94 -483 replies
4/6perf report: Honor column width settingtools/perf/ui/browsers/hists.c tools/perf/ui/gtk/hists.c tools/perf/ui/hist.c +3 more+116 -638 replies
5/6perf top: Add -w option for setting column widthtools/perf/Documentation/perf-report.txt tools/perf/Documentation/perf-top.txt tools/perf/builtin-top.c+10 -10 replies
6/6perf tools: Add name field into perf_hpp_fmttools/perf/ui/gtk/hists.c tools/perf/ui/hist.c tools/perf/util/hist.h +1 more+57 -630 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHSET 0/6] perf tools: Honor column width setting

Hello,

This patchset is to control perf report/top output column width by -w/--column-widths option so that it can fit into the terminal size. The -w option is there for perf report but it ignored by recent output field changed due to some reason. This patchset fixes it and supports perf top also.

This is sometimes useful if your terminal is small and there's some C++ applications which have amazingly long symbol names. Without this patchset user might not see those symbols on TUI, since it maps left/right arrow keys to other functions.

The -w option sets column width starting from the first column (overhead or optional overhead_children column unless -F option is given). It doesn't make sense to limit those overhead columns so it's not a hard-limit for them. But it *is* a hard-limit for other columns such as comm, dso, symbol, and so on. One can use 0 not to limit/force a width for those columns.

For example:

  $ perf report --stdio -s comm,dso
  ...
  # Overhead  Command          Shared Object                                        
  # ........  ...............  .....................................................
  #
      71.08%  gnome-shell      perf-1497.map                                        
       9.23%  gnome-shell      swrast_dri.so                                        
       3.99%  Xorg             [unknown]                                            
       3.18%  Xorg             [kernel.kallsyms]                                    
       2.93%  gnome-shell      [kernel.kallsyms]                                    
       2.41%  swapper          [kernel.kallsyms]                                    
       1.55%  synergys         libpthread-2.15.so                                   
       1.08%  synergys         synergys                                             
       0.68%  systemd-journal  [kernel.kallsyms]                                    
       0.59%  synergys         libstdc++.so.6.0.17                                  
       0.58%  gnome-shell      libc-2.15.so                                         
       0.54%  kworker/0:2      [kernel.kallsyms]                                    
       0.20%  systemd-journal  [unknown]                                            
       0.19%  gnome-shell      libclutter-1.0.so.0.1000.8.#prelink#.1kh1we (deleted)
       0.18%  firefox          libxul.so (deleted)                                  
       0.17%  gnome-shell      libcogl.so.9.1.1.#prelink#.ZL3fn1 (deleted)          
       0.14%  firefox          [kernel.kallsyms]                                    
       0.14%  gnome-shell      libgobject-2.0.so.0.3200.4                           
       0.13%  gnome-shell      libpthread-2.15.so                                   
       0.11%  synergys         [kernel.kallsyms]                                    
       0.10%  perf             [kernel.kallsyms]                                    
  $ perf report --stdio -s comm,dso -w 0,10,20   # 0 means no limit
  ...
  # Overhead  Command     Shared Object       
  # ........  ..........  ....................
  #
      71.08%  gnome-shel  perf-1497.map       
       9.23%  gnome-shel  swrast_dri.so       
       3.99%  Xorg        [unknown]           
       3.18%  Xorg        [kernel.kallsyms]   
       2.93%  gnome-shel  [kernel.kallsyms]   
       2.41%  swapper     [kernel.kallsyms]   
       1.55%  synergys    libpthread-2.15.so  
       1.08%  synergys    synergys            
       0.68%  systemd-jo  [kernel.kallsyms]   
       0.59%  synergys    libstdc++.so.6.0.17 
       0.58%  gnome-shel  libc-2.15.so        
       0.54%  kworker/0:  [kernel.kallsyms]   
       0.20%  systemd-jo  [unknown]           
       0.19%  gnome-shel  libclutter-1.0.so.0.
       0.18%  firefox     libxul.so (deleted) 
       0.17%  gnome-shel  libcogl.so.9.1.1.#pr
       0.14%  firefox     [kernel.kallsyms]   
       0.14%  gnome-shel  libgobject-2.0.so.0.
       0.13%  gnome-shel  libpthread-2.15.so  
       0.11%  synergys    [kernel.kallsyms]   
       0.10%  perf        [kernel.kallsyms]   

You can also get this from 'perf/width-v1' branch on my tree

git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf.git

Thanks,
Namhyung

Namhyung Kim (6):
perf tools: Left-align output contents
perf tools: Make __hpp__fmt() receive an additional len argument perf tools: Save column length in perf_hpp_fmt
perf report: Honor column width setting
perf top: Add -w option for setting column width
perf tools: Add name field into perf_hpp_fmt

 tools/perf/Documentation/perf-report.txt |   2 +-
 tools/perf/Documentation/perf-top.txt    |   6 +
 tools/perf/builtin-top.c                 |   3 +
 tools/perf/ui/browsers/hists.c           |  31 ++--
 tools/perf/ui/gtk/hists.c                |  18 +-
 tools/perf/ui/hist.c                     | 275 +++++++++++++++++++------------
 tools/perf/ui/stdio/hist.c               |   4 +-
 tools/perf/util/color.c                  |  16 ++
 tools/perf/util/color.h                  |   1 +
 tools/perf/util/hist.h                   |  17 +-
 tools/perf/util/sort.c                   |  51 +++---
 11 files changed, 274 insertions(+), 150 deletions(-)
Signature · 1 line
2.0.0