Commit a61a22f6 authored by Namhyung Kim's avatar Namhyung Kim Committed by Ingo Molnar

perf hists browser: Use hierarchy hpp list

Now hpp formats are linked using perf_hpp_list_node when hierarchy is
enabled.  Like in stdio, use this info to print entries with multiple
sort keys in a single hierarchy properly.
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1457361308-514-7-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent f58c95e3
...@@ -1289,6 +1289,7 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -1289,6 +1289,7 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
off_t row_offset = entry->row_offset; off_t row_offset = entry->row_offset;
bool first = true; bool first = true;
struct perf_hpp_fmt *fmt; struct perf_hpp_fmt *fmt;
struct perf_hpp_list_node *fmt_node;
struct hpp_arg arg = { struct hpp_arg arg = {
.b = &browser->b, .b = &browser->b,
.current_entry = current_entry, .current_entry = current_entry,
...@@ -1320,7 +1321,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -1320,7 +1321,10 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
width -= level * HIERARCHY_INDENT; width -= level * HIERARCHY_INDENT;
hists__for_each_format(entry->hists, fmt) { /* the first hpp_list_node is for overhead columns */
fmt_node = list_first_entry(&entry->hists->hpp_formats,
struct perf_hpp_list_node, list);
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
char s[2048]; char s[2048];
struct perf_hpp hpp = { struct perf_hpp hpp = {
.buf = s, .buf = s,
...@@ -1332,10 +1336,6 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser, ...@@ -1332,10 +1336,6 @@ static int hist_browser__show_hierarchy_entry(struct hist_browser *browser,
column++ < browser->b.horiz_scroll) column++ < browser->b.horiz_scroll)
continue; continue;
if (perf_hpp__is_sort_entry(fmt) ||
perf_hpp__is_dynamic_entry(fmt))
break;
if (current_entry && browser->b.navkeypressed) { if (current_entry && browser->b.navkeypressed) {
ui_browser__set_color(&browser->b, ui_browser__set_color(&browser->b,
HE_COLORSET_SELECTED); HE_COLORSET_SELECTED);
...@@ -1444,6 +1444,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser, ...@@ -1444,6 +1444,7 @@ static int hist_browser__show_no_entry(struct hist_browser *browser,
int column = 0; int column = 0;
int ret; int ret;
struct perf_hpp_fmt *fmt; struct perf_hpp_fmt *fmt;
struct perf_hpp_list_node *fmt_node;
int indent = browser->hists->nr_hpp_node - 2; int indent = browser->hists->nr_hpp_node - 2;
if (current_entry) { if (current_entry) {
...@@ -1461,15 +1462,14 @@ static int hist_browser__show_no_entry(struct hist_browser *browser, ...@@ -1461,15 +1462,14 @@ static int hist_browser__show_no_entry(struct hist_browser *browser,
ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT); ui_browser__write_nstring(&browser->b, "", level * HIERARCHY_INDENT);
width -= level * HIERARCHY_INDENT; width -= level * HIERARCHY_INDENT;
hists__for_each_format(browser->hists, fmt) { /* the first hpp_list_node is for overhead columns */
fmt_node = list_first_entry(&browser->hists->hpp_formats,
struct perf_hpp_list_node, list);
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
if (perf_hpp__should_skip(fmt, browser->hists) || if (perf_hpp__should_skip(fmt, browser->hists) ||
column++ < browser->b.horiz_scroll) column++ < browser->b.horiz_scroll)
continue; continue;
if (perf_hpp__is_sort_entry(fmt) ||
perf_hpp__is_dynamic_entry(fmt))
break;
ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists)); ret = fmt->width(fmt, NULL, hists_to_evsel(browser->hists));
if (first) { if (first) {
...@@ -1551,22 +1551,23 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1551,22 +1551,23 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows
.size = size, .size = size,
}; };
struct perf_hpp_fmt *fmt; struct perf_hpp_fmt *fmt;
struct perf_hpp_list_node *fmt_node;
size_t ret = 0; size_t ret = 0;
int column = 0; int column = 0;
int indent = hists->nr_hpp_node - 2; int indent = hists->nr_hpp_node - 2;
bool first = true; bool first_node, first_col;
ret = scnprintf(buf, size, " "); ret = scnprintf(buf, size, " ");
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
return ret; return ret;
hists__for_each_format(hists, fmt) { /* the first hpp_list_node is for overhead columns */
fmt_node = list_first_entry(&hists->hpp_formats,
struct perf_hpp_list_node, list);
perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
if (column++ < browser->b.horiz_scroll) if (column++ < browser->b.horiz_scroll)
continue; continue;
if (perf_hpp__is_sort_entry(fmt) || perf_hpp__is_dynamic_entry(fmt))
break;
ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists)); ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
break; break;
...@@ -1581,34 +1582,42 @@ static int hists_browser__scnprintf_hierarchy_headers(struct hist_browser *brows ...@@ -1581,34 +1582,42 @@ 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;
hists__for_each_format(hists, fmt) { first_node = true;
char *start; list_for_each_entry_continue(fmt_node, &hists->hpp_formats, list) {
if (!first_node) {
if (!perf_hpp__is_sort_entry(fmt) && !perf_hpp__is_dynamic_entry(fmt))
continue;
if (perf_hpp__should_skip(fmt, hists))
continue;
if (first) {
first = false;
} else {
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;
ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists)); first_col = true;
dummy_hpp.buf[ret] = '\0'; perf_hpp_list__for_each_format(&fmt_node->hpp, fmt) {
rtrim(dummy_hpp.buf); char *start;
start = ltrim(dummy_hpp.buf); if (perf_hpp__should_skip(fmt, hists))
ret = strlen(start); continue;
if (start != dummy_hpp.buf) if (!first_col) {
memmove(dummy_hpp.buf, start, ret + 1); ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, "+");
if (advance_hpp_check(&dummy_hpp, ret))
break;
}
first_col = false;
if (advance_hpp_check(&dummy_hpp, ret)) ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
break; dummy_hpp.buf[ret] = '\0';
rtrim(dummy_hpp.buf);
start = ltrim(dummy_hpp.buf);
ret = strlen(start);
if (start != dummy_hpp.buf)
memmove(dummy_hpp.buf, start, ret + 1);
if (advance_hpp_check(&dummy_hpp, ret))
break;
}
} }
return ret; return ret;
...@@ -1676,7 +1685,7 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) ...@@ -1676,7 +1685,7 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
break; break;
if (h->has_no_entry) { if (h->has_no_entry) {
hist_browser__show_no_entry(hb, row, h->depth); hist_browser__show_no_entry(hb, row, h->depth + 1);
row++; row++;
} }
} else { } else {
......
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