diff options
author | Jiri Olsa <jolsa@kernel.org> | 2016-08-07 11:28:26 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-08-23 14:37:33 -0400 |
commit | f8e6710de859e1ac3a5df294bddeca19f60cec9a (patch) | |
tree | fe328a7beb138b17ce1e42e9a1e5ca97e058b8b2 /tools/perf/ui | |
parent | b9c4b0f40d22d4b1d29540f5faf6ca4269f25848 (diff) |
perf hists: Introduce nr_header_lines into struct perf_hpp_list
Currently we support just single line headers, this is first step to
allow more.
Store the number of header lines in perf_hpp_list, which encompasses all
the display/sort entries and is thus suitable to hold this value.
Signed-off-by: Jiri 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-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 15 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 13d414384739..95f7cf1991fc 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb) | |||
69 | static void hist_browser__update_rows(struct hist_browser *hb) | 69 | static void hist_browser__update_rows(struct hist_browser *hb) |
70 | { | 70 | { |
71 | struct ui_browser *browser = &hb->b; | 71 | struct ui_browser *browser = &hb->b; |
72 | u16 header_offset = hb->show_headers ? 1 : 0, index_row; | 72 | struct hists *hists = hb->hists; |
73 | struct perf_hpp_list *hpp_list = hists->hpp_list; | ||
74 | u16 header_offset, index_row; | ||
73 | 75 | ||
76 | header_offset = hb->show_headers ? hpp_list->nr_header_lines : 0; | ||
74 | browser->rows = browser->height - header_offset; | 77 | browser->rows = browser->height - header_offset; |
75 | /* | 78 | /* |
76 | * Verify if we were at the last line and that line isn't | 79 | * Verify if we were at the last line and that line isn't |
@@ -99,8 +102,11 @@ static void hist_browser__refresh_dimensions(struct ui_browser *browser) | |||
99 | 102 | ||
100 | static void hist_browser__gotorc(struct hist_browser *browser, int row, int column) | 103 | static void hist_browser__gotorc(struct hist_browser *browser, int row, int column) |
101 | { | 104 | { |
102 | u16 header_offset = browser->show_headers ? 1 : 0; | 105 | struct hists *hists = browser->hists; |
106 | struct perf_hpp_list *hpp_list = hists->hpp_list; | ||
107 | u16 header_offset; | ||
103 | 108 | ||
109 | header_offset = browser->show_headers ? hpp_list->nr_header_lines : 0; | ||
104 | ui_browser__gotorc(&browser->b, row + header_offset, column); | 110 | ui_browser__gotorc(&browser->b, row + header_offset, column); |
105 | } | 111 | } |
106 | 112 | ||
@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) | |||
1656 | u16 header_offset = 0; | 1662 | u16 header_offset = 0; |
1657 | struct rb_node *nd; | 1663 | struct rb_node *nd; |
1658 | struct hist_browser *hb = container_of(browser, struct hist_browser, b); | 1664 | struct hist_browser *hb = container_of(browser, struct hist_browser, b); |
1665 | struct hists *hists = hb->hists; | ||
1659 | 1666 | ||
1660 | if (hb->show_headers) { | 1667 | if (hb->show_headers) { |
1668 | struct perf_hpp_list *hpp_list = hists->hpp_list; | ||
1669 | |||
1661 | hist_browser__show_headers(hb); | 1670 | hist_browser__show_headers(hb); |
1662 | header_offset = 1; | 1671 | header_offset = hpp_list->nr_header_lines; |
1663 | } | 1672 | } |
1664 | 1673 | ||
1665 | ui_browser__hists_init_top(browser); | 1674 | ui_browser__hists_init_top(browser); |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 4274969ddc89..be7a17fec889 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = { | |||
441 | struct perf_hpp_list perf_hpp_list = { | 441 | struct perf_hpp_list perf_hpp_list = { |
442 | .fields = LIST_HEAD_INIT(perf_hpp_list.fields), | 442 | .fields = LIST_HEAD_INIT(perf_hpp_list.fields), |
443 | .sorts = LIST_HEAD_INIT(perf_hpp_list.sorts), | 443 | .sorts = LIST_HEAD_INIT(perf_hpp_list.sorts), |
444 | .nr_header_lines = 1, | ||
444 | }; | 445 | }; |
445 | 446 | ||
446 | #undef HPP__COLOR_PRINT_FNS | 447 | #undef HPP__COLOR_PRINT_FNS |