aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-11-13 08:30:32 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-11-14 14:52:39 -0500
commit688f2f5b99311b127ea43efdbf47bb2e3c7a2e32 (patch)
tree56dd40bff09afb0c276bbacf2a5624c1e5f8118b /tools
parent7da5c85dd34dd67846fec965e4bf1f761eecca05 (diff)
perf ui: Introduce generic ui_progress helper
Make ui_progress functions generic so that UI frontend code will add its callbacks. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1352813436-14173-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Makefile1
-rw-r--r--tools/perf/ui/gtk/util.c11
-rw-r--r--tools/perf/ui/progress.c20
-rw-r--r--tools/perf/ui/progress.h8
-rw-r--r--tools/perf/ui/tui/progress.c12
-rw-r--r--tools/perf/ui/tui/setup.c1
6 files changed, 41 insertions, 12 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 50e85c852656..f8466b49b922 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -423,6 +423,7 @@ LIB_OBJS += $(OUTPUT)util/vdso.o
423LIB_OBJS += $(OUTPUT)util/stat.o 423LIB_OBJS += $(OUTPUT)util/stat.o
424 424
425LIB_OBJS += $(OUTPUT)ui/helpline.o 425LIB_OBJS += $(OUTPUT)ui/helpline.o
426LIB_OBJS += $(OUTPUT)ui/progress.o
426LIB_OBJS += $(OUTPUT)ui/hist.o 427LIB_OBJS += $(OUTPUT)ui/hist.o
427LIB_OBJS += $(OUTPUT)ui/stdio/hist.o 428LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
428 429
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index ccb046aac98b..c06942a41c78 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -111,14 +111,3 @@ struct perf_error_ops perf_gtk_eops = {
111 .warning = perf_gtk__warning_statusbar, 111 .warning = perf_gtk__warning_statusbar,
112#endif 112#endif
113}; 113};
114
115/*
116 * FIXME: Functions below should be implemented properly.
117 * For now, just add stubs for NO_NEWT=1 build.
118 */
119#ifndef NEWT_SUPPORT
120void ui_progress__update(u64 curr __maybe_unused, u64 total __maybe_unused,
121 const char *title __maybe_unused)
122{
123}
124#endif
diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c
new file mode 100644
index 000000000000..f5e4d1b95c75
--- /dev/null
+++ b/tools/perf/ui/progress.c
@@ -0,0 +1,20 @@
1#include "../cache.h"
2#include "progress.h"
3
4static void nop_progress_update(u64 curr __maybe_unused,
5 u64 total __maybe_unused,
6 const char *title __maybe_unused)
7{
8}
9
10static struct ui_progress default_progress_fns =
11{
12 .update = nop_progress_update,
13};
14
15struct ui_progress *progress_fns = &default_progress_fns;
16
17void ui_progress__update(u64 curr, u64 total, const char *title)
18{
19 return progress_fns->update(curr, total, title);
20}
diff --git a/tools/perf/ui/progress.h b/tools/perf/ui/progress.h
index d9c205b59aa1..717814b32169 100644
--- a/tools/perf/ui/progress.h
+++ b/tools/perf/ui/progress.h
@@ -3,6 +3,14 @@
3 3
4#include <../types.h> 4#include <../types.h>
5 5
6struct ui_progress {
7 void (*update)(u64, u64, const char *);
8};
9
10extern struct ui_progress *progress_fns;
11
12void ui_progress__init(void);
13
6void ui_progress__update(u64 curr, u64 total, const char *title); 14void ui_progress__update(u64 curr, u64 total, const char *title);
7 15
8#endif 16#endif
diff --git a/tools/perf/ui/tui/progress.c b/tools/perf/ui/tui/progress.c
index f8dc986e427d..6c2184d53cbf 100644
--- a/tools/perf/ui/tui/progress.c
+++ b/tools/perf/ui/tui/progress.c
@@ -4,7 +4,7 @@
4#include "../ui.h" 4#include "../ui.h"
5#include "../browser.h" 5#include "../browser.h"
6 6
7void ui_progress__update(u64 curr, u64 total, const char *title) 7static void tui_progress__update(u64 curr, u64 total, const char *title)
8{ 8{
9 int bar, y; 9 int bar, y;
10 /* 10 /*
@@ -30,3 +30,13 @@ void ui_progress__update(u64 curr, u64 total, const char *title)
30 SLsmg_refresh(); 30 SLsmg_refresh();
31 pthread_mutex_unlock(&ui__lock); 31 pthread_mutex_unlock(&ui__lock);
32} 32}
33
34static struct ui_progress tui_progress_fns =
35{
36 .update = tui_progress__update,
37};
38
39void ui_progress__init(void)
40{
41 progress_fns = &tui_progress_fns;
42}
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c
index 60debb81537a..81efa192e86c 100644
--- a/tools/perf/ui/tui/setup.c
+++ b/tools/perf/ui/tui/setup.c
@@ -118,6 +118,7 @@ int ui__init(void)
118 newtSetSuspendCallback(newt_suspend, NULL); 118 newtSetSuspendCallback(newt_suspend, NULL);
119 ui_helpline__init(); 119 ui_helpline__init();
120 ui_browser__init(); 120 ui_browser__init();
121 ui_progress__init();
121 122
122 signal(SIGSEGV, ui__signal); 123 signal(SIGSEGV, ui__signal);
123 signal(SIGFPE, ui__signal); 124 signal(SIGFPE, ui__signal);