perf/urgent fixes for perf {top,report} --hierarchy

- These are fixes for the --hierarchy view of perf top and report, fixing
   output oddities, mostly related to scrolling. (Namhyung Kim)
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJYJec7AAoJENZQFvNTUqpA6/MP/jdTM+jO+KEBhb+7mRirL091
 Ir83siquBDJgI4hpV/CzwcapxqZCXj5jkZARuDP5rLcSvLjB3Bl3814xH+PtS+nX
 iTKZ/ZbpSaqITzc5cWFufitopKk7DxKKETLaxTSu9sOrleXl0HXcxjrMQG4uUpyZ
 Fo3KbKkk9igYenGt/iRnHtN0rFG7QOoPZYFaDw6N4CZ9XKTezLXW3trMIoqbDSJD
 7zn0fljAiVSrc9bUQd6I0pfVOowEFEryl511r/zgyKajh1Ns5dhYkF/0e8ex/sEV
 AoRBqBnv8xG8mGnhZePub7lF4rNlAUawJPKjIH9VdZAvGTn4eN88vVNGGGvGtcvh
 QxHJpBr7ayDE9LFqj9vTPxOnyFWqFfNMG8gV05PFNo6qhgCjJQq/dWLNxDbQAZ+I
 Xt0x5iNRHgQgl047vWEJAkBvu2KfgaUTjXBR+copn/omQAoTXdrHfkOxNQeCfUpj
 yKGiJmCpWS1F4AZ6gR9YMtxHYZ0BPdkQ27e97hHPNa6IgA7tLpWsGmBfmXN11Ftj
 zL14mvCg+AGHXRytGljpXTLYF+f7PRz+LdzGSkr6rOg4yDVBgV7uq4qO4Ak8pHFn
 FZbCRdrA3xMamc9juCsSPL7Tlou2ZcmNYxyfzKnn9ptaDf9RlFhblaL3WdgqiC7q
 r91kqLxXyIkD8V7+d1Kv
 =qT5b
 -----END PGP SIGNATURE-----

Merge tag 'perf-hists-hierarchy-fixes-for-mingo-20161111' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf/urgent fixes for perf {top,report} --hierarchy, from Arnaldo Carvalho de Melo:

 - These are fixes for the --hierarchy view of perf top and report, fixing
   output oddities, mostly related to scrolling. (Namhyung Kim)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2016-11-12 11:47:30 +01:00
commit ce75632cc4
2 changed files with 43 additions and 17 deletions

View file

@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
}
if (first) {
ui_browser__printf(&browser->b, "%c", folded_sign);
width--;
ui_browser__printf(&browser->b, "%c ", folded_sign);
width -= 2;
first = false;
} else {
ui_browser__printf(&browser->b, " ");
@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
width -= hpp.buf - s;
}
ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
width -= hierarchy_indent;
if (!first) {
ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
width -= hierarchy_indent;
}
if (column >= browser->b.horiz_scroll) {
char s[2048];
@ -1381,7 +1383,13 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
}
perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
ui_browser__write_nstring(&browser->b, "", 2);
if (first) {
ui_browser__printf(&browser->b, "%c ", folded_sign);
first = false;
} else {
ui_browser__write_nstring(&browser->b, "", 2);
}
width -= 2;
/*
@ -1555,10 +1563,11 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
int indent = hists->nr_hpp_node - 2;
bool first_node, first_col;
ret = scnprintf(buf, size, " ");
ret = scnprintf(buf, size, " ");
if (advance_hpp_check(&dummy_hpp, ret))
return ret;
first_node = true;
/* the first hpp_list_node is for overhead columns */
fmt_node = list_first_entry(&hists->hpp_formats,
struct perf_hpp_list_node, list);
@ -1573,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " ");
if (advance_hpp_check(&dummy_hpp, ret))
break;
first_node = false;
}
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
indent * HIERARCHY_INDENT, "");
if (advance_hpp_check(&dummy_hpp, ret))
return ret;
if (!first_node) {
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
indent * HIERARCHY_INDENT, "");
if (advance_hpp_check(&dummy_hpp, ret))
return ret;
}
first_node = true;
list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
@ -2076,8 +2089,21 @@ void hist_browser__init(struct hist_browser *browser,
browser->b.use_navkeypressed = true;
browser->show_headers = symbol_conf.show_hist_headers;
hists__for_each_format(hists, fmt)
if (symbol_conf.report_hierarchy) {
struct perf_hpp_list_node *fmt_node;
/* count overhead columns (in the first node) */
fmt_node = list_first_entry(&hists->hpp_formats,
struct perf_hpp_list_node, list);
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt)
++browser->b.columns;
/* add a single column for whole hierarchy sort keys*/
++browser->b.columns;
} else {
hists__for_each_format(hists, fmt)
++browser->b.columns;
}
hists__reset_column_width(hists);
}

View file

@ -1600,18 +1600,18 @@ static void hists__hierarchy_output_resort(struct hists *hists,
if (prog)
ui_progress__update(prog, 1);
hists->nr_entries++;
if (!he->filtered) {
hists->nr_non_filtered_entries++;
hists__calc_col_len(hists, he);
}
if (!he->leaf) {
hists__hierarchy_output_resort(hists, prog,
&he->hroot_in,
&he->hroot_out,
min_callchain_hits,
use_callchain);
hists->nr_entries++;
if (!he->filtered) {
hists->nr_non_filtered_entries++;
hists__calc_col_len(hists, he);
}
continue;
}