diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-01 10:07:54 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-07 11:36:54 -0400 |
commit | 62c95ae33f64ecf398f490886f026a6132fb1520 (patch) | |
tree | 701435d99b2a87faf900325902dbaa38ee03f0c6 /tools/perf/ui/browsers/hists.c | |
parent | 8b5b584daf3b92fc5cdc83919e64231817d2f5a7 (diff) |
perf ui browser: Add ->rows to disambiguate from ->height
The ui_browser->height is about the whole browser "window", including
any header, status lines or any other space needed for some "Yes", "No",
etc buttons a descendent browser, like hist_browser, may have.
Since the navigation is done mostly on the ui_browser methods, it needs
to know how many rows are on the screen, while details about what other
components are, say, if a header (that may be composed of multiple
lines, etc) is present.
Besides this we'll need to add a ui_browser->refresh_dimensions() hook
so that browsers like hist_browser can update ->rows in response to
screen resizes, this will come in a follow up patch.
This patch just adds ->rows and updates it when updating ->height, keeps
using ->height for the only other widget that can come with ui_browser,
the scrollbar, that goes on using all the height on the rightmost column
in the screen, using ->rows for the keyboard navigation needs.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-xexmwg1mv7u03j5imn66jdak@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/browsers/hists.c')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 2185091c5227..e16aff45b564 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -392,10 +392,10 @@ static int hist_browser__run(struct hist_browser *browser, | |||
392 | struct hist_entry *h = rb_entry(browser->b.top, | 392 | struct hist_entry *h = rb_entry(browser->b.top, |
393 | struct hist_entry, rb_node); | 393 | struct hist_entry, rb_node); |
394 | ui_helpline__pop(); | 394 | ui_helpline__pop(); |
395 | ui_helpline__fpush("%d: nr_ent=(%d,%d), height=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d", | 395 | ui_helpline__fpush("%d: nr_ent=(%d,%d), rows=%d, idx=%d, fve: idx=%d, row_off=%d, nrows=%d", |
396 | seq++, browser->b.nr_entries, | 396 | seq++, browser->b.nr_entries, |
397 | browser->hists->nr_entries, | 397 | browser->hists->nr_entries, |
398 | browser->b.height, | 398 | browser->b.rows, |
399 | browser->b.index, | 399 | browser->b.index, |
400 | browser->b.top_idx, | 400 | browser->b.top_idx, |
401 | h->row_offset, h->nr_rows); | 401 | h->row_offset, h->nr_rows); |
@@ -514,7 +514,7 @@ static int hist_browser__show_callchain_node_rb_tree(struct hist_browser *browse | |||
514 | slsmg_write_nstring(str, width); | 514 | slsmg_write_nstring(str, width); |
515 | free(alloc_str); | 515 | free(alloc_str); |
516 | 516 | ||
517 | if (++row == browser->b.height) | 517 | if (++row == browser->b.rows) |
518 | goto out; | 518 | goto out; |
519 | do_next: | 519 | do_next: |
520 | if (folded_sign == '+') | 520 | if (folded_sign == '+') |
@@ -527,7 +527,7 @@ do_next: | |||
527 | new_level, row, row_offset, | 527 | new_level, row, row_offset, |
528 | is_current_entry); | 528 | is_current_entry); |
529 | } | 529 | } |
530 | if (row == browser->b.height) | 530 | if (row == browser->b.rows) |
531 | goto out; | 531 | goto out; |
532 | node = next; | 532 | node = next; |
533 | } | 533 | } |
@@ -573,7 +573,7 @@ static int hist_browser__show_callchain_node(struct hist_browser *browser, | |||
573 | slsmg_printf("%c ", folded_sign); | 573 | slsmg_printf("%c ", folded_sign); |
574 | slsmg_write_nstring(s, width - 2); | 574 | slsmg_write_nstring(s, width - 2); |
575 | 575 | ||
576 | if (++row == browser->b.height) | 576 | if (++row == browser->b.rows) |
577 | goto out; | 577 | goto out; |
578 | } | 578 | } |
579 | 579 | ||
@@ -602,7 +602,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser, | |||
602 | row += hist_browser__show_callchain_node(browser, node, level, | 602 | row += hist_browser__show_callchain_node(browser, node, level, |
603 | row, row_offset, | 603 | row, row_offset, |
604 | is_current_entry); | 604 | is_current_entry); |
605 | if (row == browser->b.height) | 605 | if (row == browser->b.rows) |
606 | break; | 606 | break; |
607 | } | 607 | } |
608 | 608 | ||
@@ -776,7 +776,7 @@ static int hist_browser__show_entry(struct hist_browser *browser, | |||
776 | } else | 776 | } else |
777 | --row_offset; | 777 | --row_offset; |
778 | 778 | ||
779 | if (folded_sign == '-' && row != browser->b.height) { | 779 | if (folded_sign == '-' && row != browser->b.rows) { |
780 | printed += hist_browser__show_callchain(browser, &entry->sorted_chain, | 780 | printed += hist_browser__show_callchain(browser, &entry->sorted_chain, |
781 | 1, row, &row_offset, | 781 | 1, row, &row_offset, |
782 | ¤t_entry); | 782 | ¤t_entry); |
@@ -817,7 +817,7 @@ static unsigned int hist_browser__refresh(struct ui_browser *browser) | |||
817 | continue; | 817 | continue; |
818 | 818 | ||
819 | row += hist_browser__show_entry(hb, h, row); | 819 | row += hist_browser__show_entry(hb, h, row); |
820 | if (row == browser->height) | 820 | if (row == browser->rows) |
821 | break; | 821 | break; |
822 | } | 822 | } |
823 | 823 | ||