aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/annotate.c9
-rw-r--r--tools/perf/util/debug.h1
-rw-r--r--tools/perf/util/ui/browsers/annotate.c14
-rw-r--r--tools/perf/util/ui/setup.c8
-rw-r--r--tools/perf/util/ui/util.c110
-rw-r--r--tools/perf/util/ui/util.h2
6 files changed, 77 insertions, 67 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index bc8f4773d4d8..119e996035c8 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -310,9 +310,12 @@ fallback:
310 } 310 }
311 err = -ENOENT; 311 err = -ENOENT;
312 dso->annotate_warned = 1; 312 dso->annotate_warned = 1;
313 pr_err("Can't annotate %s: No vmlinux file%s was found in the " 313 pr_err("Can't annotate %s:\n\n"
314 "path.\nPlease use 'perf buildid-cache -av vmlinux' or " 314 "No vmlinux file%s\nwas found in the path.\n\n"
315 "--vmlinux vmlinux.\n", 315 "Please use:\n\n"
316 " perf buildid-cache -av vmlinux\n\n"
317 "or:\n\n"
318 " --vmlinux vmlinux",
316 sym->name, build_id_msg ?: ""); 319 sym->name, build_id_msg ?: "");
317 goto out_free_filename; 320 goto out_free_filename;
318 } 321 }
diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h
index 510adaccba84..9c59b9551ada 100644
--- a/tools/perf/util/debug.h
+++ b/tools/perf/util/debug.h
@@ -29,5 +29,6 @@ int ui_helpline__show_help(const char *format, va_list ap);
29 29
30void ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2))); 30void ui__warning(const char *format, ...) __attribute__((format(printf, 1, 2)));
31void ui__warning_paranoid(void); 31void ui__warning_paranoid(void);
32void ui__error(const char *format, ...) __attribute__((format(printf, 1, 2)));
32 33
33#endif /* __PERF_DEBUG_H */ 34#endif /* __PERF_DEBUG_H */
diff --git a/tools/perf/util/ui/browsers/annotate.c b/tools/perf/util/ui/browsers/annotate.c
index 4e0cb7fea7d9..0575905d1205 100644
--- a/tools/perf/util/ui/browsers/annotate.c
+++ b/tools/perf/util/ui/browsers/annotate.c
@@ -1,6 +1,9 @@
1#include "../../util.h"
1#include "../browser.h" 2#include "../browser.h"
2#include "../helpline.h" 3#include "../helpline.h"
3#include "../libslang.h" 4#include "../libslang.h"
5#include "../ui.h"
6#include "../util.h"
4#include "../../annotate.h" 7#include "../../annotate.h"
5#include "../../hist.h" 8#include "../../hist.h"
6#include "../../sort.h" 9#include "../../sort.h"
@@ -8,15 +11,6 @@
8#include <pthread.h> 11#include <pthread.h>
9#include <newt.h> 12#include <newt.h>
10 13
11static void ui__error_window(const char *fmt, ...)
12{
13 va_list ap;
14
15 va_start(ap, fmt);
16 newtWinMessagev((char *)"Error", (char *)"Ok", (char *)fmt, ap);
17 va_end(ap);
18}
19
20struct annotate_browser { 14struct annotate_browser {
21 struct ui_browser b; 15 struct ui_browser b;
22 struct rb_root entries; 16 struct rb_root entries;
@@ -400,7 +394,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
400 return -1; 394 return -1;
401 395
402 if (symbol__annotate(sym, map, sizeof(struct objdump_line_rb_node)) < 0) { 396 if (symbol__annotate(sym, map, sizeof(struct objdump_line_rb_node)) < 0) {
403 ui__error_window(ui_helpline__last_msg); 397 ui__error("%s", ui_helpline__last_msg);
404 return -1; 398 return -1;
405 } 399 }
406 400
diff --git a/tools/perf/util/ui/setup.c b/tools/perf/util/ui/setup.c
index c4e025fbd6b9..85a69faa09aa 100644
--- a/tools/perf/util/ui/setup.c
+++ b/tools/perf/util/ui/setup.c
@@ -146,10 +146,10 @@ void setup_browser(bool fallback_to_pager)
146void exit_browser(bool wait_for_ok) 146void exit_browser(bool wait_for_ok)
147{ 147{
148 if (use_browser > 0) { 148 if (use_browser > 0) {
149 if (wait_for_ok) { 149 if (wait_for_ok)
150 char title[] = "Fatal Error", ok[] = "Ok"; 150 ui__question_window("Fatal Error",
151 newtWinMessage(title, ok, ui_helpline__last_msg); 151 ui_helpline__last_msg,
152 } 152 "Press any key...", 0);
153 ui__exit(); 153 ui__exit();
154 } 154 }
155} 155}
diff --git a/tools/perf/util/ui/util.c b/tools/perf/util/ui/util.c
index 37e6fe081a58..ef9b79332fe8 100644
--- a/tools/perf/util/ui/util.c
+++ b/tools/perf/util/ui/util.c
@@ -1,6 +1,5 @@
1#include <newt.h> 1#include "../util.h"
2#include <signal.h> 2#include <signal.h>
3#include <stdio.h>
4#include <stdbool.h> 3#include <stdbool.h>
5#include <string.h> 4#include <string.h>
6#include <sys/ttydefaults.h> 5#include <sys/ttydefaults.h>
@@ -12,6 +11,7 @@
12#include "helpline.h" 11#include "helpline.h"
13#include "ui.h" 12#include "ui.h"
14#include "util.h" 13#include "util.h"
14#include "libslang.h"
15 15
16static void ui_browser__argv_write(struct ui_browser *browser, 16static void ui_browser__argv_write(struct ui_browser *browser,
17 void *entry, int row) 17 void *entry, int row)
@@ -56,23 +56,6 @@ static int popup_menu__run(struct ui_browser *menu)
56 return key; 56 return key;
57} 57}
58 58
59static void newt_form__set_exit_keys(newtComponent self)
60{
61 newtFormAddHotKey(self, NEWT_KEY_LEFT);
62 newtFormAddHotKey(self, NEWT_KEY_ESCAPE);
63 newtFormAddHotKey(self, 'Q');
64 newtFormAddHotKey(self, 'q');
65 newtFormAddHotKey(self, CTRL('c'));
66}
67
68static newtComponent newt_form__new(void)
69{
70 newtComponent self = newtForm(NULL, NULL, 0);
71 if (self)
72 newt_form__set_exit_keys(self);
73 return self;
74}
75
76int ui__popup_menu(int argc, char * const argv[]) 59int ui__popup_menu(int argc, char * const argv[])
77{ 60{
78 struct ui_browser menu = { 61 struct ui_browser menu = {
@@ -86,17 +69,13 @@ int ui__popup_menu(int argc, char * const argv[])
86 return popup_menu__run(&menu); 69 return popup_menu__run(&menu);
87} 70}
88 71
89int ui__help_window(const char *text) 72int ui__question_window(const char *title, const char *text,
73 const char *exit_msg, int delay_secs)
90{ 74{
91 struct newtExitStruct es; 75 int x, y;
92 newtComponent tb, form = newt_form__new();
93 int rc = -1;
94 int max_len = 0, nr_lines = 0; 76 int max_len = 0, nr_lines = 0;
95 const char *t; 77 const char *t;
96 78
97 if (form == NULL)
98 return -1;
99
100 t = text; 79 t = text;
101 while (1) { 80 while (1) {
102 const char *sep = strchr(t, '\n'); 81 const char *sep = strchr(t, '\n');
@@ -113,28 +92,56 @@ int ui__help_window(const char *text)
113 t = sep + 1; 92 t = sep + 1;
114 } 93 }
115 94
116 tb = newtTextbox(0, 0, max_len, nr_lines, 0); 95 max_len += 2;
117 if (tb == NULL) 96 nr_lines += 4;
118 goto out_destroy_form; 97 y = SLtt_Screen_Rows / 2 - nr_lines / 2,
119 98 x = SLtt_Screen_Cols / 2 - max_len / 2;
120 newtTextboxSetText(tb, text); 99
121 newtFormAddComponent(form, tb); 100 SLsmg_set_color(0);
122 newtCenteredWindow(max_len, nr_lines, NULL); 101 SLsmg_draw_box(y, x++, nr_lines, max_len);
123 newtFormRun(form, &es); 102 if (title) {
124 newtPopWindow(); 103 SLsmg_gotorc(y, x + 1);
125 rc = 0; 104 SLsmg_write_string((char *)title);
126out_destroy_form: 105 }
127 newtFormDestroy(form); 106 SLsmg_gotorc(++y, x);
128 return rc; 107 nr_lines -= 2;
108 max_len -= 2;