diff options
| -rw-r--r-- | tools/perf/Makefile.perf | 1 | ||||
| -rw-r--r-- | tools/perf/ui/gtk/gtk.h | 2 | ||||
| -rw-r--r-- | tools/perf/ui/gtk/progress.c | 14 | ||||
| -rw-r--r-- | tools/perf/ui/gtk/setup.c | 2 | ||||
| -rw-r--r-- | tools/perf/ui/progress.c | 18 | ||||
| -rw-r--r-- | tools/perf/ui/progress.h | 6 | ||||
| -rw-r--r-- | tools/perf/ui/tui/progress.c | 7 | ||||
| -rw-r--r-- | tools/perf/ui/tui/setup.c | 3 | ||||
| -rw-r--r-- | tools/perf/ui/tui/tui.h | 6 |
9 files changed, 33 insertions, 26 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 326a26e5fc1c..8a9ca3836043 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
| @@ -487,6 +487,7 @@ ifndef NO_SLANG | |||
| 487 | LIB_OBJS += $(OUTPUT)ui/tui/util.o | 487 | LIB_OBJS += $(OUTPUT)ui/tui/util.o |
| 488 | LIB_OBJS += $(OUTPUT)ui/tui/helpline.o | 488 | LIB_OBJS += $(OUTPUT)ui/tui/helpline.o |
| 489 | LIB_OBJS += $(OUTPUT)ui/tui/progress.o | 489 | LIB_OBJS += $(OUTPUT)ui/tui/progress.o |
| 490 | LIB_H += ui/tui/tui.h | ||
| 490 | LIB_H += ui/browser.h | 491 | LIB_H += ui/browser.h |
| 491 | LIB_H += ui/browsers/map.h | 492 | LIB_H += ui/browsers/map.h |
| 492 | LIB_H += ui/keysyms.h | 493 | LIB_H += ui/keysyms.h |
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h index 8576cf194872..0a9173ff9a61 100644 --- a/tools/perf/ui/gtk/gtk.h +++ b/tools/perf/ui/gtk/gtk.h | |||
| @@ -34,7 +34,7 @@ struct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window); | |||
| 34 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); | 34 | int perf_gtk__deactivate_context(struct perf_gtk_context **ctx); |
| 35 | 35 | ||
| 36 | void perf_gtk__init_helpline(void); | 36 | void perf_gtk__init_helpline(void); |
| 37 | void perf_gtk__init_progress(void); | 37 | void gtk_ui_progress__init(void); |
| 38 | void perf_gtk__init_hpp(void); | 38 | void perf_gtk__init_hpp(void); |
| 39 | 39 | ||
| 40 | void perf_gtk__signal(int sig); | 40 | void perf_gtk__signal(int sig); |
diff --git a/tools/perf/ui/gtk/progress.c b/tools/perf/ui/gtk/progress.c index 482bcf3df9b7..195c7f94f98e 100644 --- a/tools/perf/ui/gtk/progress.c +++ b/tools/perf/ui/gtk/progress.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | static GtkWidget *dialog; | 7 | static GtkWidget *dialog; |
| 8 | static GtkWidget *progress; | 8 | static GtkWidget *progress; |
| 9 | 9 | ||
| 10 | static void gtk_progress_update(u64 curr, u64 total, const char *title) | 10 | static void gtk_ui_progress__update(u64 curr, u64 total, const char *title) |
| 11 | { | 11 | { |
| 12 | double fraction = total ? 1.0 * curr / total : 0.0; | 12 | double fraction = total ? 1.0 * curr / total : 0.0; |
| 13 | char buf[1024]; | 13 | char buf[1024]; |
| @@ -40,7 +40,7 @@ static void gtk_progress_update(u64 curr, u64 total, const char *title) | |||
| 40 | gtk_main_iteration(); | 40 | gtk_main_iteration(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | static void gtk_progress_finish(void) | 43 | static void gtk_ui_progress__finish(void) |
| 44 | { | 44 | { |
| 45 | /* this will also destroy all of its children */ | 45 | /* this will also destroy all of its children */ |
| 46 | gtk_widget_destroy(dialog); | 46 | gtk_widget_destroy(dialog); |
| @@ -48,12 +48,12 @@ static void gtk_progress_finish(void) | |||
| 48 | dialog = NULL; | 48 | dialog = NULL; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | static struct ui_progress gtk_progress_fns = { | 51 | static struct ui_progress_ops gtk_ui_progress__ops = { |
| 52 | .update = gtk_progress_update, | 52 | .update = gtk_ui_progress__update, |
| 53 | .finish = gtk_progress_finish, | 53 | .finish = gtk_ui_progress__finish, |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | void perf_gtk__init_progress(void) | 56 | void gtk_ui_progress__init(void) |
| 57 | { | 57 | { |
| 58 | progress_fns = >k_progress_fns; | 58 | ui_progress__ops = >k_ui_progress__ops; |
| 59 | } | 59 | } |
diff --git a/tools/perf/ui/gtk/setup.c b/tools/perf/ui/gtk/setup.c index 6c2dd2e423f3..1d57676f8212 100644 --- a/tools/perf/ui/gtk/setup.c +++ b/tools/perf/ui/gtk/setup.c | |||
| @@ -8,7 +8,7 @@ int perf_gtk__init(void) | |||
| 8 | { | 8 | { |
| 9 | perf_error__register(&perf_gtk_eops); | 9 | perf_error__register(&perf_gtk_eops); |
| 10 | perf_gtk__init_helpline(); | 10 | perf_gtk__init_helpline(); |
| 11 | perf_gtk__init_progress(); | 11 | gtk_ui_progress__init(); |
| 12 | perf_gtk__init_hpp(); | 12 | perf_gtk__init_hpp(); |
| 13 | 13 | ||
| 14 | return gtk_init_check(NULL, NULL) ? 0 : -1; | 14 | return gtk_init_check(NULL, NULL) ? 0 : -1; |
diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c index 3ec695607a4d..d753821b6e0b 100644 --- a/tools/perf/ui/progress.c +++ b/tools/perf/ui/progress.c | |||
| @@ -1,26 +1,26 @@ | |||
| 1 | #include "../cache.h" | 1 | #include "../cache.h" |
| 2 | #include "progress.h" | 2 | #include "progress.h" |
| 3 | 3 | ||
| 4 | static void nop_progress_update(u64 curr __maybe_unused, | 4 | static void null_progress__update(u64 curr __maybe_unused, |
| 5 | u64 total __maybe_unused, | 5 | u64 total __maybe_unused, |
| 6 | const char *title __maybe_unused) | 6 | const char *title __maybe_unused) |
| 7 | { | 7 | { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | static struct ui_progress default_progress_fns = | 10 | static struct ui_progress_ops null_progress__ops = |
| 11 | { | 11 | { |
| 12 | .update = nop_progress_update, | 12 | .update = null_progress__update, |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | struct ui_progress *progress_fns = &default_progress_fns; | 15 | struct ui_progress_ops *ui_progress__ops = &null_progress__ops; |
| 16 | 16 | ||
| 17 | void ui_progress__update(u64 curr, u64 total, const char *title) | 17 | void ui_progress__update(u64 curr, u64 total, const char *title) |
| 18 | { | 18 | { |
| 19 | return progress_fns->update(curr, total, title); | 19 | return ui_progress__ops->update(curr, total, title); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | void ui_progress__finish(void) | 22 | void ui_progress__finish(void) |
| 23 | { | 23 | { |
| 24 | if (progress_fns->finish) | 24 | if (ui_progress__ops->finish) |
| 25 | progress_fns->finish(); | 25 | ui_progress__ops->finish(); |
| 26 | } | 26 | } |
diff --git a/tools/perf/ui/progress.h b/tools/perf/ui/progress.h index 257cc224f9cf..d41bde5908a6 100644 --- a/tools/perf/ui/progress.h +++ b/tools/perf/ui/progress.h | |||
| @@ -3,14 +3,12 @@ | |||
| 3 | 3 | ||
| 4 | #include <../types.h> | 4 | #include <../types.h> |
| 5 | 5 | ||
| 6 | struct ui_progress { | 6 | struct ui_progress_ops { |
| 7 | void (*update)(u64, u64, const char *); | 7 | void (*update)(u64, u64, const char *); |
| 8 | void (*finish)(void); | 8 | void (*finish)(void); |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | extern struct ui_progress *progress_fns; | 11 | extern struct ui_progress_ops *ui_progress__ops; |
| 12 | |||
| 13 | void ui_progress__init(void); | ||
| 14 | 12 | ||
| 15 | void ui_progress__update(u64 curr, u64 total, const char *title); | 13 | void ui_progress__update(u64 curr, u64 total, const char *title); |
| 16 | void ui_progress__finish(void); | 14 | void ui_progress__finish(void); |
diff --git a/tools/perf/ui/tui/progress.c b/tools/perf/ui/tui/progress.c index 6c2184d53cbf..0fcc5a1f525a 100644 --- a/tools/perf/ui/tui/progress.c +++ b/tools/perf/ui/tui/progress.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #include "../progress.h" | 2 | #include "../progress.h" |
| 3 | #include "../libslang.h" | 3 | #include "../libslang.h" |
| 4 | #include "../ui.h" | 4 | #include "../ui.h" |
| 5 | #include "tui.h" | ||
| 5 | #include "../browser.h" | 6 | #include "../browser.h" |
| 6 | 7 | ||
| 7 | static void tui_progress__update(u64 curr, u64 total, const char *title) | 8 | static void tui_progress__update(u64 curr, u64 total, const char *title) |
| @@ -31,12 +32,12 @@ static void tui_progress__update(u64 curr, u64 total, const char *title) | |||
| 31 | pthread_mutex_unlock(&ui__lock); | 32 | pthread_mutex_unlock(&ui__lock); |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | static struct ui_progress tui_progress_fns = | 35 | static struct ui_progress_ops tui_progress__ops = |
| 35 | { | 36 | { |
| 36 | .update = tui_progress__update, | 37 | .update = tui_progress__update, |
| 37 | }; | 38 | }; |
| 38 | 39 | ||
| 39 | void ui_progress__init(void) | 40 | void tui_progress__init(void) |
| 40 | { | 41 | { |
| 41 | progress_fns = &tui_progress_fns; | 42 | ui_progress__ops = &tui_progress__ops; |
| 42 | } | 43 | } |
diff --git a/tools/perf/ui/tui/setup.c b/tools/perf/ui/tui/setup.c index b9401482d110..2f612562978c 100644 --- a/tools/perf/ui/tui/setup.c +++ b/tools/perf/ui/tui/setup.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "../util.h" | 9 | #include "../util.h" |
| 10 | #include "../libslang.h" | 10 | #include "../libslang.h" |
| 11 | #include "../keysyms.h" | 11 | #include "../keysyms.h" |
| 12 | #include "tui.h" | ||
| 12 | 13 | ||
| 13 | static volatile int ui__need_resize; | 14 | static volatile int ui__need_resize; |
| 14 | 15 | ||
| @@ -119,7 +120,7 @@ int ui__init(void) | |||
| 119 | 120 | ||
| 120 | ui_helpline__init(); | 121 | ui_helpline__init(); |
| 121 | ui_browser__init(); | 122 | ui_browser__init(); |
| 122 | ui_progress__init(); | 123 | tui_progress__init(); |
| 123 | 124 | ||
| 124 | signal(SIGSEGV, ui__signal); | 125 | signal(SIGSEGV, ui__signal); |
| 125 | signal(SIGFPE, ui__signal); | 126 | signal(SIGFPE, ui__signal); |
diff --git a/tools/perf/ui/tui/tui.h b/tools/perf/ui/tui/tui.h new file mode 100644 index 000000000000..18961c7b6ec5 --- /dev/null +++ b/tools/perf/ui/tui/tui.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef _PERF_TUI_H_ | ||
| 2 | #define _PERF_TUI_H_ 1 | ||
| 3 | |||
| 4 | void tui_progress__init(void); | ||
| 5 | |||
| 6 | #endif /* _PERF_TUI_H_ */ | ||
