diff options
author | Jiri Olsa <jolsa@kernel.org> | 2014-06-14 09:44:52 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-07 11:36:55 -0400 |
commit | 81a888fea2cfd727052926e95510c11981d9b1c2 (patch) | |
tree | 6444b98ad4bed8b7f6d136c70e5b8bc72adf1a3e | |
parent | 025bf7ea0aca26df4a4b28f0b12afe1aaf91e4bd (diff) |
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: Jiri 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 2be71bf17b71..5fa2e181ef0c 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -822,11 +822,54 @@ static int hist_browser__show_entry(struct hist_browser *browser, | |||
822 | return printed; | 822 | return printed; |
823 | } | 823 | } |
824 | 824 | ||
825 | static int advance_hpp_check(struct perf_hpp *hpp, int inc) | ||
826 | { | ||
827 | advance_hpp(hpp, inc); | ||
828 | return hpp->size <= 0; | ||
829 | } | ||
830 | |||
831 | static int hists__scnprintf_headers(char *buf, size_t size, struct hists *hists) | ||
832 | { | ||
833 | struct perf_hpp dummy_hpp = { | ||
834 | .buf = buf, | ||
835 | .size = size, | ||
836 | }; | ||
837 | struct perf_hpp_fmt *fmt; | ||
838 | size_t ret = 0; | ||
839 | |||
840 | if (symbol_conf.use_callchain) { | ||
841 | ret = scnprintf(buf, size, " "); | ||
842 | if (advance_hpp_check(&dummy_hpp, ret)) | ||
843 | return ret; | ||
844 | } | ||
845 | |||
846 | perf_hpp__for_each_format(fmt) { | ||
847 | if (perf_hpp__should_skip(fmt)) | ||
848 | continue; | ||
849 | |||
850 | /* We need to add the length of the columns header. */ | ||
851 | perf_hpp__reset_width(fmt, hists); | ||
852 | |||
853 | ret = fmt->header(fmt, &dummy_hpp, hists_to_evsel(hists)); | ||
854 | if (advance_hpp_check(&dummy_hpp, ret)) | ||
855 | break; | ||
856 | |||
857 | ret = scnprintf(dummy_hpp.buf, dummy_hpp.size, " "); | ||
858 | if (advance_hpp_check(&dummy_hpp, ret)) | ||
859 | break; | ||
860 | } | ||
861 | |||
862 | return ret; | ||
863 | } | ||
864 | |||
825 | static void hist_browser__show_headers(struct hist_browser *browser) | 865 | static void hist_browser__show_headers(struct hist_browser *browser) |
826 | { | 866 | { |
867 | char headers[1024]; | ||
868 | |||
869 | hists__scnprintf_headers(headers, sizeof(headers), browser->hists); | ||
827 | ui_browser__gotorc(&browser->b, 0, 0); | 870 | ui_browser__gotorc(&browser->b, 0, 0); |
828 | ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); | 871 | ui_browser__set_color(&browser->b, HE_COLORSET_ROOT); |
829 | slsmg_write_nstring(" ", browser->b.width + 1); | 872 | slsmg_write_nstring(headers, browser->b.width + 1); |
830 | } | 873 | } |
831 | 874 | ||
832 | static void ui_browser__hists_init_top(struct ui_browser *browser) | 875 | 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 | browser->b.refresh_dimensions = hist_browser__refresh_dimensions; | 1284 | browser->b.refresh_dimensions = hist_browser__refresh_dimensions; |
1242 | browser->b.seek = ui_browser__hists_seek; | 1285 | browser->b.seek = ui_browser__hists_seek; |
1243 | browser->b.use_navkeypressed = true; | 1286 | browser->b.use_navkeypressed = true; |
1244 | browser->show_headers = false; | 1287 | browser->show_headers = true; |
1245 | } | 1288 | } |
1246 | 1289 | ||
1247 | return browser; | 1290 | return browser; |