Commit 81a888fe authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

perf hists browser: Display columns header text on 'H' press

Displaying columns header text whenever 'H' is pressed,
and hiding it on on another press.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-w9pcqpum5erza2a05ysvollz@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 025bf7ea
...@@ -822,11 +822,54 @@ static int hist_browser__show_entry(struct hist_browser *browser, ...@@ -822,11 +822,54 @@ static int hist_browser__show_entry(struct hist_browser *browser,
return printed; return printed;
} }
static int advance_hpp_check(struct perf_hpp *hpp, int inc)
{
advance_hpp(hpp, inc);
return hpp->size <= 0;
}
static int hists__scnprintf_headers(char *buf, size_t size, struct hists *hists)
{
struct perf_hpp dummy_hpp = {
.buf = buf,
.size = size,
};
struct perf_hpp_fmt *fmt;
size_t ret = 0;
if (symbol_conf.use_callchain) {
ret = scnprintf(buf, size, " ");
if (advance_hpp_check(&dummy_hpp, ret))
return ret;
}
perf_hpp__for_each_format(fmt) {
if (perf_hpp__should_skip(fmt))
continue;
/* We need to add the length of the columns header. */
perf_hpp__reset_width(fmt, hists);
ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists));
if (advance_hpp_check(&dummy_hpp, ret))
break;
ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " ");
if (advance_hpp_check(&dummy_hpp, ret))
break;
}
return ret;
}
static void hist_browser__show_headers(struct hist_browser *browser) static void hist_browser__show_headers(struct hist_browser *browser)
{ {
char headers[1024];
hists__scnprintf_headers(headers, sizeof(headers), browser->hists);
ui_browser__gotorc(&browser->b, 0, 0); ui_browser__gotorc(&browser->b, 0, 0);
ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
slsmg_write_nstring(" ", browser->b.width + 1); slsmg_write_nstring(headers, browser->b.width + 1);
} }
static void ui_browser__hists_init_top(struct ui_browser *browser) static void ui_browser__hists_init_top(struct ui_browser *browser)
...@@ -1241,7 +1284,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists) ...@@ -1241,7 +1284,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
browser->b.refresh_dimensions = hist_browser__refresh_dimensions; browser->b.refresh_dimensions = hist_browser__refresh_dimensions;
browser->b.seek = ui_browser__hists_seek; browser->b.seek = ui_browser__hists_seek;
browser->b.use_navkeypressed = true; browser->b.use_navkeypressed = true;
browser->show_headers = false; browser->show_headers = true;
} }
return browser; return 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