diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-01 16:01:01 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-07-07 11:36:55 -0400 |
commit | 357cfff1c2173b7aedc0e521a2146b78396171e0 (patch) | |
tree | 56ae499e4e0da50270fc351bf7edc057e6f5e1b8 /tools | |
parent | ca3ff33b5c2dc67daa8d4d130e3bd6231fcb3d14 (diff) |
perf hists browser: Override ui_browser refresh_dimensions method
This requires some more work so that we can really just use the width of
current entries when we want to partition the screen.
Right now its just a prep patch so that we can have where to update
ui_browser->rows when introducing the column headers line, that will be
togglable, so we need to update it everytime we refresh the dimensions
of the browser.
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-ovk654rx525b4657y0mh6ku9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index ca63564d203a..ef7abf896f5a 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -56,11 +56,19 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb) | |||
56 | return nr_entries + hb->nr_callchain_rows; | 56 | return nr_entries + hb->nr_callchain_rows; |
57 | } | 57 | } |
58 | 58 | ||
59 | static void hist_browser__refresh_dimensions(struct hist_browser *browser) | 59 | static void hist_browser__refresh_dimensions(struct ui_browser *browser) |
60 | { | 60 | { |
61 | struct hist_browser *hb = container_of(browser, struct hist_browser, b); | ||
62 | |||
61 | /* 3 == +/- toggle symbol before actual hist_entry rendering */ | 63 | /* 3 == +/- toggle symbol before actual hist_entry rendering */ |
62 | browser->b.width = 3 + (hists__sort_list_width(browser->hists) + | 64 | browser->width = 3 + (hists__sort_list_width(hb->hists) + sizeof("[k]")); |
63 | sizeof("[k]")); | 65 | /* |
66 | * FIXME: Just keeping existing behaviour, but this really should be | ||
67 | * before updating browser->width, as it will invalidate the | ||
68 | * calculation above. Fix this and the fallout in another | ||
69 | * changeset. | ||
70 | */ | ||
71 | ui_browser__refresh_dimensions(browser); | ||
64 | } | 72 | } |
65 | 73 | ||
66 | static void hist_browser__gotorc(struct hist_browser *browser, int row, int column) | 74 | static void hist_browser__gotorc(struct hist_browser *browser, int row, int column) |
@@ -78,7 +86,7 @@ static void hist_browser__reset(struct hist_browser *browser) | |||
78 | 86 | ||
79 | hist_browser__update_nr_entries(browser); | 87 | hist_browser__update_nr_entries(browser); |
80 | browser->b.nr_entries = hist_browser__nr_entries(browser); | 88 | browser->b.nr_entries = hist_browser__nr_entries(browser); |
81 | hist_browser__refresh_dimensions(browser); | 89 | hist_browser__refresh_dimensions(&browser->b); |
82 | ui_browser__reset_index(&browser->b); | 90 | ui_browser__reset_index(&browser->b); |
83 | } | 91 | } |
84 | 92 | ||
@@ -360,7 +368,6 @@ static int hist_browser__run(struct hist_browser *browser, | |||
360 | browser->b.entries = &browser->hists->entries; | 368 | browser->b.entries = &browser->hists->entries; |
361 | browser->b.nr_entries = hist_browser__nr_entries(browser); | 369 | browser->b.nr_entries = hist_browser__nr_entries(browser); |
362 | 370 | ||
363 | hist_browser__refresh_dimensions(browser); | ||
364 | hists__browser_title(browser->hists, title, sizeof(title)); | 371 | hists__browser_title(browser->hists, title, sizeof(title)); |
365 | 372 | ||
366 | if (ui_browser__show(&browser->b, title, | 373 | if (ui_browser__show(&browser->b, title, |
@@ -1195,6 +1202,7 @@ static struct hist_browser *hist_browser__new(struct hists *hists) | |||
1195 | if (browser) { | 1202 | if (browser) { |
1196 | browser->hists = hists; | 1203 | browser->hists = hists; |
1197 | browser->b.refresh = hist_browser__refresh; | 1204 | browser->b.refresh = hist_browser__refresh; |
1205 | browser->b.refresh_dimensions = hist_browser__refresh_dimensions; | ||
1198 | browser->b.seek = ui_browser__hists_seek; | 1206 | browser->b.seek = ui_browser__hists_seek; |
1199 | browser->b.use_navkeypressed = true; | 1207 | browser->b.use_navkeypressed = true; |
1200 | } | 1208 | } |