aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/gtk/helpline.c26
-rw-r--r--tools/perf/ui/gtk/util.c5
-rw-r--r--tools/perf/ui/helpline.h23
-rw-r--r--tools/perf/ui/setup.c4
-rw-r--r--tools/perf/ui/tui/setup.c2
5 files changed, 53 insertions, 7 deletions
diff --git a/tools/perf/ui/gtk/helpline.c b/tools/perf/ui/gtk/helpline.c
index 2511b3746797..5db4432ff12a 100644
--- a/tools/perf/ui/gtk/helpline.c
+++ b/tools/perf/ui/gtk/helpline.c
@@ -1,5 +1,10 @@
1#include <stdio.h>
2#include <string.h>
3
1#include "gtk.h" 4#include "gtk.h"
5#include "../ui.h"
2#include "../helpline.h" 6#include "../helpline.h"
7#include "../../util/debug.h"
3 8
4static void gtk_helpline_pop(void) 9static void gtk_helpline_pop(void)
5{ 10{
@@ -28,3 +33,24 @@ void perf_gtk__init_helpline(void)
28{ 33{
29 helpline_fns = &gtk_helpline_fns; 34 helpline_fns = &gtk_helpline_fns;
30} 35}
36
37int perf_gtk__show_helpline(const char *fmt, va_list ap)
38{
39 int ret;
40 char *ptr;
41 static int backlog;
42
43 ret = vscnprintf(ui_helpline__current + backlog,
44 sizeof(ui_helpline__current) - backlog, fmt, ap);
45 backlog += ret;
46
47 /* only first line can be displayed */
48 ptr = strchr(ui_helpline__current, '\n');
49 if (ptr && (ptr - ui_helpline__current) <= backlog) {
50 *ptr = '\0';
51 ui_helpline__puts(ui_helpline__current);
52 backlog = 0;
53 }
54
55 return ret;
56}
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index 0ead373c0dfb..b8efb966f94c 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -117,11 +117,6 @@ struct perf_error_ops perf_gtk_eops = {
117 * For now, just add stubs for NO_NEWT=1 build. 117 * For now, just add stubs for NO_NEWT=1 build.
118 */ 118 */
119#ifdef NO_NEWT_SUPPORT 119#ifdef NO_NEWT_SUPPORT
120int ui_helpline__show_help(const char *format __used, va_list ap __used)
121{
122 return 0;
123}
124
125void ui_progress__update(u64 curr __used, u64 total __used, 120void ui_progress__update(u64 curr __used, u64 total __used,
126 const char *title __used) 121 const char *title __used)
127{ 122{
diff --git a/tools/perf/ui/helpline.h b/tools/perf/ui/helpline.h
index 61118b2bc242..a2487f93aa48 100644
--- a/tools/perf/ui/helpline.h
+++ b/tools/perf/ui/helpline.h
@@ -4,6 +4,8 @@
4#include <stdio.h> 4#include <stdio.h>
5#include <stdarg.h> 5#include <stdarg.h>
6 6
7#include "../util/cache.h"
8
7struct ui_helpline { 9struct ui_helpline {
8 void (*pop)(void); 10 void (*pop)(void);
9 void (*push)(const char *msg); 11 void (*push)(const char *msg);
@@ -21,4 +23,25 @@ void ui_helpline__puts(const char *msg);
21 23
22extern char ui_helpline__current[512]; 24extern char ui_helpline__current[512];
23 25
26#ifdef NO_NEWT_SUPPORT
27static inline int ui_helpline__show_help(const char *format __used,
28 va_list ap __used)
29{
30 return 0;
31}
32#else
33extern char ui_helpline__last_msg[];
34int ui_helpline__show_help(const char *format, va_list ap);
35#endif /* NO_NEWT_SUPPORT */
36
37#ifdef NO_GTK2_SUPPORT
38static inline int perf_gtk__show_helpline(const char *format __used,
39 va_list ap __used)
40{
41 return 0;
42}
43#else
44int perf_gtk__show_helpline(const char *format, va_list ap);
45#endif /* NO_GTK2_SUPPORT */
46
24#endif /* _PERF_UI_HELPLINE_H_ */ 47#endif /* _PERF_UI_HELPLINE_H_ */
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 791fb15ce350..c7820e569660 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -1,7 +1,11 @@
1#include <pthread.h>
2
1#include "../cache.h" 3#include "../cache.h"
2#include "../debug.h" 4#include "../debug.h"
3 5
4 6
7pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
8
5void setup_browser(bool fallback_to_pager) 9void setup_browser(bool fallback_to_pager)
6{ 10{
7 if (!isatty(1) || dump_trace) 11 if (!isatty(1) || dump_trace)
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index e813c1d17346..4c936e09931c 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -11,8 +11,6 @@
11#include "../libslang.h" 11#include "../libslang.h"
12#include "../keysyms.h" 12#include "../keysyms.h"
13 13
14pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
15
16static volatile int ui__need_resize; 14static volatile int ui__need_resize;
17 15
18extern struct perf_error_ops perf_tui_eops; 16extern struct perf_error_ops perf_tui_eops;