提交 f8e6710d 编写于 作者: J Jiri Olsa 提交者: Arnaldo Carvalho de Melo

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: NJiri 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.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 b9c4b0f4
...@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb) ...@@ -69,8 +69,11 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
static void hist_browser__update_rows(struct hist_browser *hb) static void hist_browser__update_rows(struct hist_browser *hb)
{ {
struct ui_browser *browser = &hb->b; struct ui_browser *browser = &hb->b;
u16 header_offset = hb->show_headers ? 1 : 0, index_row; struct hists *hists = hb->hists;
struct perf_hpp_list *hpp_list = hists->hpp_list;
u16 header_offset, index_row;
header_offset = hb->show_headers ? hpp_list->nr_header_lines : 0;
browser->rows = browser->height - header_offset; browser->rows = browser->height - header_offset;
/* /*
* Verify if we were at the last line and that line isn't * 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,8 +102,11 @@ static void hist_browser__refresh_dimensions(struct ui_browser *browser)
static void hist_browser__gotorc(struct hist_browser *browser, int row, int column) static void hist_browser__gotorc(struct hist_browser *browser, int row, int column)
{ {
u16 header_offset = browser->show_headers ? 1 : 0; struct hists *hists = browser->hists;
struct perf_hpp_list *hpp_list = hists->hpp_list;
u16 header_offset;
header_offset = browser->show_headers ? hpp_list->nr_header_lines : 0;
ui_browser__gotorc(&browser->b, row + header_offset, column); ui_browser__gotorc(&browser->b, row + header_offset, column);
} }
...@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) ...@@ -1656,10 +1662,13 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser)
u16 header_offset = 0; u16 header_offset = 0;
struct rb_node *nd; struct rb_node *nd;
struct hist_browser *hb = container_of(browser, struct hist_browser, b); struct hist_browser *hb = container_of(browser, struct hist_browser, b);
struct hists *hists = hb->hists;
if (hb->show_headers) { if (hb->show_headers) {
struct perf_hpp_list *hpp_list = hists->hpp_list;
hist_browser__show_headers(hb); hist_browser__show_headers(hb);
header_offset = 1; header_offset = hpp_list->nr_header_lines;
} }
ui_browser__hists_init_top(browser); ui_browser__hists_init_top(browser);
......
...@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = { ...@@ -441,6 +441,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
struct perf_hpp_list perf_hpp_list = { struct perf_hpp_list perf_hpp_list = {
.fields = LIST_HEAD_INIT(perf_hpp_list.fields), .fields = LIST_HEAD_INIT(perf_hpp_list.fields),
.sorts = LIST_HEAD_INIT(perf_hpp_list.sorts), .sorts = LIST_HEAD_INIT(perf_hpp_list.sorts),
.nr_header_lines = 1,
}; };
#undef HPP__COLOR_PRINT_FNS #undef HPP__COLOR_PRINT_FNS
......
...@@ -259,6 +259,7 @@ struct perf_hpp_list { ...@@ -259,6 +259,7 @@ struct perf_hpp_list {
struct list_head fields; struct list_head fields;
struct list_head sorts; struct list_head sorts;
int nr_header_lines;
int need_collapse; int need_collapse;
int parent; int parent;
int sym; int sym;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册