diff options
author | Namhyung Kim <namhyung@kernel.org> | 2014-03-19 22:18:54 -0400 |
---|---|---|
committer | Jiri Olsa <jolsa@kernel.org> | 2014-05-21 05:45:36 -0400 |
commit | 678a500d076ec873b8809041c6b718653db2a75f (patch) | |
tree | d4a999436440d5edabc51fc1a7d7236e2d2d7ab6 /tools/perf/ui/stdio/hist.c | |
parent | e67d49a72df9aa50841ad400f7a99405e4980ee4 (diff) |
perf hists: Reset width of output fields with header length
Some fields missed to set default column length so it broke align in
--stdio output. Add perf_hpp__reset_width() to set it to a sane
default value.
Note that this change will ignore -w/--column-widths option for now.
Before:
$ perf report -F cpu,comm,overhead --stdio
...
# CPU Command Overhead
# ............... ........
#
0 firefox 2.65%
0 kworker/0:0 1.45%
0 swapper 5.52%
0 synergys 0.92%
1 firefox 4.54%
After:
# CPU Command Overhead
# ... ............... ........
#
0 firefox 2.65%
0 kworker/0:0 1.45%
0 swapper 5.52%
0 synergys 0.92%
1 firefox 4.54%
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1400480762-22852-17-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Diffstat (limited to 'tools/perf/ui/stdio/hist.c')
-rw-r--r-- | tools/perf/ui/stdio/hist.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c index e3fdf4e869fc..cfcd3f6fd1c5 100644 --- a/tools/perf/ui/stdio/hist.c +++ b/tools/perf/ui/stdio/hist.c | |||
@@ -369,12 +369,10 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
369 | int max_cols, float min_pcnt, FILE *fp) | 369 | int max_cols, float min_pcnt, FILE *fp) |
370 | { | 370 | { |
371 | struct perf_hpp_fmt *fmt; | 371 | struct perf_hpp_fmt *fmt; |
372 | struct sort_entry *se; | ||
373 | struct rb_node *nd; | 372 | struct rb_node *nd; |
374 | size_t ret = 0; | 373 | size_t ret = 0; |
375 | unsigned int width; | 374 | unsigned int width; |
376 | const char *sep = symbol_conf.field_sep; | 375 | const char *sep = symbol_conf.field_sep; |
377 | const char *col_width = symbol_conf.col_width_list_str; | ||
378 | int nr_rows = 0; | 376 | int nr_rows = 0; |
379 | char bf[96]; | 377 | char bf[96]; |
380 | struct perf_hpp dummy_hpp = { | 378 | struct perf_hpp dummy_hpp = { |
@@ -387,22 +385,9 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows, | |||
387 | 385 | ||
388 | init_rem_hits(); | 386 | init_rem_hits(); |
389 | 387 | ||
390 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 388 | |
391 | if (se->elide) | 389 | perf_hpp__for_each_format(fmt) |
392 | continue; | 390 | perf_hpp__reset_width(fmt, hists); |
393 | width = strlen(se->se_header); | ||
394 | if (symbol_conf.col_width_list_str) { | ||
395 | if (col_width) { | ||
396 | hists__set_col_len(hists, se->se_width_idx, | ||
397 | atoi(col_width)); | ||
398 | col_width = strchr(col_width, ','); | ||
399 | if (col_width) | ||
400 | ++col_width; | ||
401 | } | ||
402 | } | ||
403 | if (!hists__new_col_len(hists, se->se_width_idx, width)) | ||
404 | width = hists__col_len(hists, se->se_width_idx); | ||
405 | } | ||
406 | 391 | ||
407 | if (!show_header) | 392 | if (!show_header) |
408 | goto print_entries; | 393 | goto print_entries; |