diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-14 08:31:53 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-10-14 11:48:14 -0400 |
commit | 437cfe7a37df07e2201036fb0903cadae6b08e74 (patch) | |
tree | 8967d5f800d2e5c918933e747b47c98ee85566a4 /tools | |
parent | 18eaf0b8e60a2fa54667b2192197970174f1c061 (diff) |
perf hists browser: Invalidate ui_browser->top after timer calls
With underlying dynamic data structures we need to invalidate pointers
to them after a timer, as that entry may have vanished (decayed in top,
for instance).
I forgot about browser_ui->top. Fix it by resetting it to null after a
timer. The seek operation from SEEK_SET will then set it to a valid
entry because it starts from rb_first(&hists->entries).
Reported-by: Ingo Molnar <mingo@elte.hu>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
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-2ssjm0ouh9tsz4dwkcu7c40n@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/ui/browser.c | 1 | ||||
-rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/tools/perf/util/ui/browser.c b/tools/perf/util/ui/browser.c index 2923c493fb6a..078ceaf5f8c1 100644 --- a/tools/perf/util/ui/browser.c +++ b/tools/perf/util/ui/browser.c | |||
@@ -249,6 +249,7 @@ void ui_browser__update_nr_entries(struct ui_browser *browser, u32 nr_entries) | |||
249 | browser->top_idx += offset; | 249 | browser->top_idx += offset; |
250 | } | 250 | } |
251 | 251 | ||
252 | browser->top = NULL; | ||
252 | browser->seek(browser, browser->top_idx, SEEK_SET); | 253 | browser->seek(browser, browser->top_idx, SEEK_SET); |
253 | } | 254 | } |
254 | 255 | ||
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index 4a3a7c96b9b6..b144b108029a 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
@@ -600,14 +600,23 @@ static int hist_browser__show_entry(struct hist_browser *self, | |||
600 | return printed; | 600 | return printed; |
601 | } | 601 | } |
602 | 602 | ||
603 | static void ui_browser__hists_init_top(struct ui_browser *browser) | ||
604 | { | ||
605 | if (browser->top == NULL) { | ||
606 | struct hist_browser *hb; | ||
607 | |||
608 | hb = container_of(browser, struct hist_browser, b); | ||
609 | browser->top = rb_first(&hb->hists->entries); | ||
610 | } | ||
611 | } | ||
612 | |||
603 | static unsigned int hist_browser__refresh(struct ui_browser *self) | 613 | static unsigned int hist_browser__refresh(struct ui_browser *self) |
604 | { | 614 | { |
605 | unsigned row = 0; | 615 | unsigned row = 0; |
606 | struct rb_node *nd; | 616 | struct rb_node *nd; |
607 | struct hist_browser *hb = container_of(self, struct hist_browser, b); | 617 | struct hist_browser *hb = container_of(self, struct hist_browser, b); |
608 | 618 | ||
609 | if (self->top == NULL) | 619 | ui_browser__hists_init_top(self); |
610 | self->top = rb_first(&hb->hists->entries); | ||
611 | 620 | ||
612 | for (nd = self->top; nd; nd = rb_next(nd)) { | 621 | for (nd = self->top; nd; nd = rb_next(nd)) { |
613 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); | 622 | struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node); |
@@ -659,6 +668,8 @@ static void ui_browser__hists_seek(struct ui_browser *self, | |||
659 | if (self->nr_entries == 0) | 668 | if (self->nr_entries == 0) |
660 | return; | 669 | return; |
661 | 670 | ||
671 | ui_browser__hists_init_top(self); | ||
672 | |||
662 | switch (whence) { | 673 | switch (whence) { |
663 | case SEEK_SET: | 674 | case SEEK_SET: |
664 | nd = hists__filter_entries(rb_first(self->entries)); | 675 | nd = hists__filter_entries(rb_first(self->entries)); |