diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-03-04 19:19:21 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-03-06 11:10:05 -0500 |
| commit | 60098917c06d154d06ce030c125266eab9e60768 (patch) | |
| tree | cc4f203256504ffd11696418f1ccbabd590ba8f9 /tools/perf/util/ui | |
| parent | d7603d5122d9700fb8f36fa08b04f4e900fef059 (diff) | |
perf hists browser: Handle browsing empty hists tree
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/ui')
| -rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index c27ab35042f..c98e6f81d28 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
| @@ -639,6 +639,9 @@ static void ui_browser__hists_seek(struct ui_browser *self, | |||
| 639 | struct rb_node *nd; | 639 | struct rb_node *nd; |
| 640 | bool first = true; | 640 | bool first = true; |
| 641 | 641 | ||
| 642 | if (self->nr_entries == 0) | ||
| 643 | return; | ||
| 644 | |||
| 642 | switch (whence) { | 645 | switch (whence) { |
| 643 | case SEEK_SET: | 646 | case SEEK_SET: |
| 644 | nd = hists__filter_entries(rb_first(self->entries)); | 647 | nd = hists__filter_entries(rb_first(self->entries)); |
| @@ -820,8 +823,8 @@ int hists__browse(struct hists *self, const char *helpline, | |||
| 820 | hists__browser_title(self, msg, sizeof(msg), ev_name, | 823 | hists__browser_title(self, msg, sizeof(msg), ev_name, |
| 821 | dso_filter, thread_filter); | 824 | dso_filter, thread_filter); |
| 822 | while (1) { | 825 | while (1) { |
| 823 | const struct thread *thread; | 826 | const struct thread *thread = NULL; |
| 824 | const struct dso *dso; | 827 | const struct dso *dso = NULL; |
| 825 | char *options[16]; | 828 | char *options[16]; |
| 826 | int nr_options = 0, choice = 0, i, | 829 | int nr_options = 0, choice = 0, i, |
| 827 | annotate = -2, zoom_dso = -2, zoom_thread = -2, | 830 | annotate = -2, zoom_dso = -2, zoom_thread = -2, |
| @@ -829,8 +832,10 @@ int hists__browse(struct hists *self, const char *helpline, | |||
| 829 | 832 | ||
| 830 | key = hist_browser__run(browser, msg); | 833 | key = hist_browser__run(browser, msg); |
| 831 | 834 | ||
| 832 | thread = hist_browser__selected_thread(browser); | 835 | if (browser->he_selection != NULL) { |
| 833 | dso = browser->selection->map ? browser->selection->map->dso : NULL; | 836 | thread = hist_browser__selected_thread(browser); |
| 837 | dso = browser->selection->map ? browser->selection->map->dso : NULL; | ||
| 838 | } | ||
| 834 | 839 | ||
| 835 | switch (key) { | 840 | switch (key) { |
| 836 | case NEWT_KEY_TAB: | 841 | case NEWT_KEY_TAB: |
| @@ -841,7 +846,8 @@ int hists__browse(struct hists *self, const char *helpline, | |||
| 841 | */ | 846 | */ |
| 842 | goto out_free_stack; | 847 | goto out_free_stack; |
| 843 | case 'a': | 848 | case 'a': |
| 844 | if (browser->selection->map == NULL && | 849 | if (browser->selection == NULL || |
| 850 | browser->selection->map == NULL || | ||
| 845 | browser->selection->map->dso->annotate_warned) | 851 | browser->selection->map->dso->annotate_warned) |
| 846 | continue; | 852 | continue; |
| 847 | goto do_annotate; | 853 | goto do_annotate; |
| @@ -887,7 +893,8 @@ int hists__browse(struct hists *self, const char *helpline, | |||
| 887 | goto out_free_stack; | 893 | goto out_free_stack; |
| 888 | } | 894 | } |
| 889 | 895 | ||
| 890 | if (browser->selection->sym != NULL && | 896 | if (browser->selection != NULL && |
| 897 | browser->selection->sym != NULL && | ||
| 891 | !browser->selection->map->dso->annotate_warned && | 898 | !browser->selection->map->dso->annotate_warned && |
| 892 | asprintf(&options[nr_options], "Annotate %s", | 899 | asprintf(&options[nr_options], "Annotate %s", |
| 893 | browser->selection->sym->name) > 0) | 900 | browser->selection->sym->name) > 0) |
| @@ -906,7 +913,8 @@ int hists__browse(struct hists *self, const char *helpline, | |||
| 906 | (dso->kernel ? "the Kernel" : dso->short_name)) > 0) | 913 | (dso->kernel ? "the Kernel" : dso->short_name)) > 0) |
| 907 | zoom_dso = nr_options++; | 914 | zoom_dso = nr_options++; |
| 908 | 915 | ||
| 909 | if (browser->selection->map != NULL && | 916 | if (browser->selection != NULL && |
| 917 | browser->selection->map != NULL && | ||
| 910 | asprintf(&options[nr_options], "Browse map details") > 0) | 918 | asprintf(&options[nr_options], "Browse map details") > 0) |
| 911 | browse_map = nr_options++; | 919 | browse_map = nr_options++; |
| 912 | 920 | ||
