• Jin Yao's avatar
    perf stat: Align the output for interval aggregation mode · d13e9e41
    Jin Yao authored
    There is a slight misalignment in -A -I output.
    
    For example:
    
     # perf stat -e cpu/event=cpu-cycles/ -a -A -I 1000
    
     #           time CPU                    counts unit events
          1.000440863 CPU0               1,068,388      cpu/event=cpu-cycles/
          1.000440863 CPU1                 875,954      cpu/event=cpu-cycles/
          1.000440863 CPU2               3,072,538      cpu/event=cpu-cycles/
          1.000440863 CPU3               4,026,870      cpu/event=cpu-cycles/
          1.000440863 CPU4               5,919,630      cpu/event=cpu-cycles/
          1.000440863 CPU5               2,714,260      cpu/event=cpu-cycles/
          1.000440863 CPU6               2,219,240      cpu/event=cpu-cycles/
          1.000440863 CPU7               1,299,232      cpu/event=cpu-cycles/
    
    The value of counts is not aligned with the column "counts" and
    the event name is not aligned with the column "events".
    
    With this patch, the output is,
    
     # perf stat -e cpu/event=cpu-cycles/ -a -A -I 1000
    
     #           time CPU                    counts unit events
          1.000423009 CPU0                  997,421      cpu/event=cpu-cycles/
          1.000423009 CPU1                1,422,042      cpu/event=cpu-cycles/
          1.000423009 CPU2                  484,651      cpu/event=cpu-cycles/
          1.000423009 CPU3                  525,791      cpu/event=cpu-cycles/
          1.000423009 CPU4                1,370,100      cpu/event=cpu-cycles/
          1.000423009 CPU5                  442,072      cpu/event=cpu-cycles/
          1.000423009 CPU6                  205,643      cpu/event=cpu-cycles/
          1.000423009 CPU7                1,302,250      cpu/event=cpu-cycles/
    
    Now output is aligned.
    Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Kan Liang <kan.liang@linux.intel.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: http://lore.kernel.org/lkml/20200218071614.25736-1-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    d13e9e41
stat-display.c 30.6 KB