diff options
author | Ingo Molnar <mingo@elte.hu> | 2011-02-23 15:50:13 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-23 15:50:13 +0100 |
commit | 9848caf26dafefcec7881f0e3c35fc81c454ba59 (patch) | |
tree | d95d95326b5d20de6525fee644fc5ce2f70b7d19 /tools/perf/util/ui | |
parent | 768a06e2ca49cdf72389208cfc056a36cf8bc5e3 (diff) | |
parent | 9826e8329bc160e4cc58b83019f3f056965e42d0 (diff) |
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools/perf/util/ui')
-rw-r--r-- | tools/perf/util/ui/browsers/top.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/perf/util/ui/browsers/top.c b/tools/perf/util/ui/browsers/top.c index 377ff58c9ae..2f47224426b 100644 --- a/tools/perf/util/ui/browsers/top.c +++ b/tools/perf/util/ui/browsers/top.c @@ -70,6 +70,7 @@ static void perf_top_browser__write(struct ui_browser *browser, void *entry, int static void perf_top_browser__update_rb_tree(struct perf_top_browser *browser) { struct perf_top *top = browser->b.priv; + u64 top_idx = browser->b.top_idx; browser->root = RB_ROOT; browser->b.top = NULL; @@ -82,7 +83,29 @@ static void perf_top_browser__update_rb_tree(struct perf_top_browser *browser) if (browser->sym_width + browser->dso_width > browser->b.width - 29) browser->sym_width = browser->b.width - browser->dso_width - 29; } + + /* + * Adjust the ui_browser indexes since the entries in the browser->root + * rb_tree may have changed, then seek it from start, so that we get a + * possible new top of the screen. + */ browser->b.nr_entries = top->rb_entries; + + if (top_idx >= browser->b.nr_entries) { + if (browser->b.height >= browser->b.nr_entries) + top_idx = browser->b.nr_entries - browser->b.height; + else + top_idx = 0; + } + + if (browser->b.index >= top_idx + browser->b.height) + browser->b.index = top_idx + browser->b.index - browser->b.top_idx; + + if (browser->b.index >= browser->b.nr_entries) + browser->b.index = browser->b.nr_entries - 1; + + browser->b.top_idx = top_idx; + browser->b.seek(&browser->b, top_idx, SEEK_SET); } static void perf_top_browser__annotate(struct perf_top_browser *browser) |