Commit ce75632c authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-hists-hierarchy-fixes-for-mingo-20161111' of...

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents d786810b c72ab446
...@@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -1337,8 +1337,8 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
} }
if (first) { if (first) {
ui_browser__printf(&browser->b, "%c", folded_sign); ui_browser__printf(&browser->b, "%c ", folded_sign);
width--; width -= 2;
first = false; first = false;
} else { } else {
ui_browser__printf(&browser->b, " "); ui_browser__printf(&browser->b, " ");
...@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -1361,8 +1361,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
width -= hpp.buf - s; width -= hpp.buf - s;
} }
if (!first) {
ui_browser__write_nstring(&browser->b, "", hierarchy_indent); ui_browser__write_nstring(&browser->b, "", hierarchy_indent);
width -= hierarchy_indent; width -= hierarchy_indent;
}
if (column >= browser->b.horiz_scroll) { if (column >= browser->b.horiz_scroll) {
char s[2048]; char s[2048];
...@@ -1381,7 +1383,13 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -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) { perf_hpp_list__for_each_format(entry->hpp_list, fmt) {
if (first) {
ui_browser__printf(&browser->b, "%c ", folded_sign);
first = false;
} else {
ui_browser__write_nstring(&browser->b, "", 2); ui_browser__write_nstring(&browser->b, "", 2);
}
width -= 2; width -= 2;
/* /*
...@@ -1559,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1559,6 +1567,7 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
return ret; return ret;
first_node = true;
/* the first hpp_list_node is for overhead columns */ /* the first hpp_list_node is for overhead columns */
fmt_node = list_first_entry(&hists->hpp_formats, fmt_node = list_first_entry(&hists->hpp_formats,
struct perf_hpp_list_node, list); struct perf_hpp_list_node, list);
...@@ -1573,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1573,12 +1582,16 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " "); ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " ");
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
break; break;
first_node = false;
} }
if (!first_node) {
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s", ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "%*s",
indent * HIERARCHY_INDENT, ""); indent * HIERARCHY_INDENT, "");
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
return ret; return ret;
}
first_node = true; first_node = true;
list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) { list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
...@@ -2076,8 +2089,21 @@ void hist_browser__init(struct hist_browser *browser, ...@@ -2076,8 +2089,21 @@ void hist_browser__init(struct hist_browser *browser,
browser->b.use_navkeypressed = true; browser->b.use_navkeypressed = true;
browser->show_headers = symbol_conf.show_hist_headers; browser->show_headers = symbol_conf.show_hist_headers;
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) hists__for_each_format(hists, fmt)
++browser->b.columns; ++browser->b.columns;
}
hists__reset_column_width(hists); hists__reset_column_width(hists);
} }
......
...@@ -1600,18 +1600,18 @@ static void hists__hierarchy_output_resort(struct hists *hists, ...@@ -1600,18 +1600,18 @@ static void hists__hierarchy_output_resort(struct hists *hists,
if (prog) if (prog)
ui_progress__update(prog, 1); ui_progress__update(prog, 1);
if (!he->leaf) {
hists__hierarchy_output_resort(hists, prog,
&he->hroot_in,
&he->hroot_out,
min_callchain_hits,
use_callchain);
hists->nr_entries++; hists->nr_entries++;
if (!he->filtered) { if (!he->filtered) {
hists->nr_non_filtered_entries++; hists->nr_non_filtered_entries++;
hists__calc_col_len(hists, he); 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);
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment