diff options
author | Namhyung Kim <namhyung@kernel.org> | 2016-11-08 08:08:32 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-11-09 09:45:58 -0500 |
commit | b9bf911e990a189f89147ee6b66660a153ed0125 (patch) | |
tree | 47a91d9a83be317d0b5cea11e585b4a4ac840051 /tools/perf | |
parent | 131d51eb1d17aac3a604cf929fd99ff4dd34f495 (diff) |
perf hists browser: Fix column indentation on --hierarchy
When horizontall scrolling is used in hierarchy mode, the the right most
column has unnecessary indentation. Actually it's needed only if some
of left (overhead) columns were shown.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20161108130833.9263-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index e767fbd17ad2..a53fef0c673b 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, | |||
1361 | width -= hpp.buf - s; | 1361 | width -= hpp.buf - s; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | ui_browser__write_nstring(&browser->b, "", hierarchy_indent); | 1364 | if (!first) { |
1365 | width -= hierarchy_indent; | 1365 | ui_browser__write_nstring(&browser->b, "", hierarchy_indent); |
1366 | width -= hierarchy_indent; | ||
1367 | } | ||
1366 | 1368 | ||
1367 | if (column >= browser->b.horiz_scroll) { | 1369 | if (column >= browser->b.horiz_scroll) { |
1368 | char s[2048]; | 1370 | char s[2048]; |
@@ -1565,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows | |||
1565 | if (advance_hpp_check(&dummy_hpp, ret)) | 1567 | if (advance_hpp_check(&dummy_hpp, ret)) |
1566 | return ret; | 1568 | return ret; |
1567 | 1569 | ||
1570 | first_node = true; | ||
1568 | /* the first hpp_list_node is for overhead columns */ | 1571 | /* the first hpp_list_node is for overhead columns */ |
1569 | fmt_node = list_first_entry(&hists->hpp_formats, | 1572 | fmt_node = list_first_entry(&hists->hpp_formats, |
1570 | struct perf_hpp_list_node, list); | 1573 | struct perf_hpp_list_node, list); |
@@ -1579,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows | |||
1579 | ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " "); | 1582 | ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " "); |
1580 | if (advance_hpp_check(&dummy_hpp, ret)) | 1583 | if (advance_hpp_check(&dummy_hpp, ret)) |
1581 | break; | 1584 | break; |
1585 | |||
1586 | first_node = false; | ||
1582 | } | 1587 | } |
1583 | 1588 | ||
1584 | ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s", | 1589 | if (!first_node) { |
1585 | indent * HIERARCHY_INDENT, ""); | 1590 | ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s", |
1586 | if (advance_hpp_check(&dummy_hpp, ret)) | 1591 | indent * HIERARCHY_INDENT, ""); |
1587 | return ret; | 1592 | if (advance_hpp_check(&dummy_hpp, ret)) |
1593 | return ret; | ||
1594 | } | ||
1588 | 1595 | ||
1589 | first_node = true; | 1596 | first_node = true; |
1590 | list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) { | 1597 | list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) { |