Commit 69705b35 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf tools tui: Display multiple header lines

Display multiple header lines in TUI browser, if it's configured within
struct perf_hpp_list::nr_header_lines.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1470583710-1649-4-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 74bb43f2
...@@ -1502,7 +1502,9 @@ static int advance_hpp_check(struct perf_hpp *hpp, int inc) ...@@ -1502,7 +1502,9 @@ static int advance_hpp_check(struct perf_hpp *hpp, int inc)
return hpp->size <= 0; return hpp->size <= 0;
} }
static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf, size_t size) static int
hists_browser__scnprintf_headers(struct hist_browser *browser, char *buf,
size_t size, int line)
{ {
struct hists *hists = browser->hists; struct hists *hists = browser->hists;
struct perf_hpp dummy_hpp = { struct perf_hpp dummy_hpp = {
...@@ -1523,7 +1525,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char * ...@@ -1523,7 +1525,7 @@ static int hists_browser__scnprintf_headers(struct hist_browser *browser, char *
if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll) if (perf_hpp__should_skip(fmt, hists) || column++ < browser->b.horiz_scroll)
continue; continue;
ret = fmt->header(fmt, &dummy_hpp, hists, 0); ret = fmt->header(fmt, &dummy_hpp, hists, line);
if (advance_hpp_check(&dummy_hpp, ret)) if (advance_hpp_check(&dummy_hpp, ret))
break; break;
...@@ -1628,14 +1630,21 @@ static void hists_browser__hierarchy_headers(struct hist_browser *browser) ...@@ -1628,14 +1630,21 @@ static void hists_browser__hierarchy_headers(struct hist_browser *browser)
static void hists_browser__headers(struct hist_browser *browser) static void hists_browser__headers(struct hist_browser *browser)
{ {
char headers[1024]; struct hists *hists = browser->hists;
struct perf_hpp_list *hpp_list = hists->hpp_list;
hists_browser__scnprintf_headers(browser, headers, int line;
sizeof(headers));
ui_browser__gotorc(&browser->b, 0, 0); for (line = 0; line < hpp_list->nr_header_lines; line++) {
ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); char headers[1024];
ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
hists_browser__scnprintf_headers(browser, headers,
sizeof(headers), line);
ui_browser__gotorc(&browser->b, line, 0);
ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
}
} }
static void hist_browser__show_headers(struct hist_browser *browser) static void hist_browser__show_headers(struct hist_browser *browser)
......
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