diff options
Diffstat (limited to 'tools/perf/ui')
-rw-r--r-- | tools/perf/ui/browsers/hists.c | 2 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 3 | ||||
-rw-r--r-- | tools/perf/ui/tui/setup.c | 26 |
3 files changed, 28 insertions, 3 deletions
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index e6bb04b5b09b..788506eef567 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c | |||
@@ -550,7 +550,7 @@ static int hist_browser__show_callchain(struct hist_browser *browser, | |||
550 | bool need_percent; | 550 | bool need_percent; |
551 | 551 | ||
552 | node = rb_first(root); | 552 | node = rb_first(root); |
553 | need_percent = !!rb_next(node); | 553 | need_percent = node && rb_next(node); |
554 | 554 | ||
555 | while (node) { | 555 | while (node) { |
556 | struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node); | 556 | struct callchain_node *child = rb_entry(node, struct callchain_node, rb_node); |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index dc0d095f318c..482adae3cc44 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -204,6 +204,9 @@ static int __hpp__sort_acc(struct hist_entry *a, struct hist_entry *b, | |||
204 | if (ret) | 204 | if (ret) |
205 | return ret; | 205 | return ret; |
206 | 206 | ||
207 | if (a->thread != b->thread || !symbol_conf.use_callchain) | ||
208 | return 0; | ||
209 | |||
207 | ret = b->callchain->max_depth - a->callchain->max_depth; | 210 | ret = b->callchain->max_depth - a->callchain->max_depth; |
208 | } | 211 | } |
209 | return ret; | 212 | return ret; |
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index 2f612562978c..3c38f25b1695 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c | |||
@@ -1,5 +1,8 @@ | |||
1 | #include <signal.h> | 1 | #include <signal.h> |
2 | #include <stdbool.h> | 2 | #include <stdbool.h> |
3 | #ifdef HAVE_BACKTRACE_SUPPORT | ||
4 | #include <execinfo.h> | ||
5 | #endif | ||
3 | 6 | ||
4 | #include "../../util/cache.h" | 7 | #include "../../util/cache.h" |
5 | #include "../../util/debug.h" | 8 | #include "../../util/debug.h" |
@@ -88,6 +91,25 @@ int ui__getch(int delay_secs) | |||
88 | return SLkp_getkey(); | 91 | return SLkp_getkey(); |
89 | } | 92 | } |
90 | 93 | ||
94 | #ifdef HAVE_BACKTRACE_SUPPORT | ||
95 | static void ui__signal_backtrace(int sig) | ||
96 | { | ||
97 | void *stackdump[32]; | ||
98 | size_t size; | ||
99 | |||
100 | ui__exit(false); | ||
101 | psignal(sig, "perf"); | ||
102 | |||
103 | printf("-------- backtrace --------\n"); | ||
104 | size = backtrace(stackdump, ARRAY_SIZE(stackdump)); | ||
105 | backtrace_symbols_fd(stackdump, size, STDOUT_FILENO); | ||
106 | |||
107 | exit(0); | ||
108 | } | ||
109 | #else | ||
110 | # define ui__signal_backtrace ui__signal | ||
111 | #endif | ||
112 | |||
91 | static void ui__signal(int sig) | 113 | static void ui__signal(int sig) |
92 | { | 114 | { |
93 | ui__exit(false); | 115 | ui__exit(false); |
@@ -122,8 +144,8 @@ int ui__init(void) | |||
122 | ui_browser__init(); | 144 | ui_browser__init(); |
123 | tui_progress__init(); | 145 | tui_progress__init(); |
124 | 146 | ||
125 | signal(SIGSEGV, ui__signal); | 147 | signal(SIGSEGV, ui__signal_backtrace); |
126 | signal(SIGFPE, ui__signal); | 148 | signal(SIGFPE, ui__signal_backtrace); |
127 | signal(SIGINT, ui__signal); | 149 | signal(SIGINT, ui__signal); |
128 | signal(SIGQUIT, ui__signal); | 150 | signal(SIGQUIT, ui__signal); |
129 | signal(SIGTERM, ui__signal); | 151 | signal(SIGTERM, ui__signal); |