diff options
Diffstat (limited to 'tools/perf/ui/progress.c')
-rw-r--r-- | tools/perf/ui/progress.c | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c index 13aa64e50e11..3ec695607a4d 100644 --- a/tools/perf/ui/progress.c +++ b/tools/perf/ui/progress.c @@ -1,32 +1,26 @@ #include "../cache.h" #include "progress.h" -#include "libslang.h" -#include "ui.h" -#include "browser.h" -void ui_progress__update(u64 curr, u64 total, const char *title) +static void nop_progress_update(u64 curr __maybe_unused, + u64 total __maybe_unused, + const char *title __maybe_unused) { - int bar, y; - /* - * FIXME: We should have a per UI backend way of showing progress, - * stdio will just show a percentage as NN%, etc. - */ - if (use_browser <= 0) - return; +} - if (total == 0) - return; +static struct ui_progress default_progress_fns = +{ + .update = nop_progress_update, +}; - ui__refresh_dimensions(true); - pthread_mutex_lock(&ui__lock); - y = SLtt_Screen_Rows / 2 - 2; - SLsmg_set_color(0); - SLsmg_draw_box(y, 0, 3, SLtt_Screen_Cols); - SLsmg_gotorc(y++, 1); - SLsmg_write_string((char *)title); - SLsmg_set_color(HE_COLORSET_SELECTED); - bar = ((SLtt_Screen_Cols - 2) * curr) / total; - SLsmg_fill_region(y, 1, 1, bar, ' '); - SLsmg_refresh(); - pthread_mutex_unlock(&ui__lock); +struct ui_progress *progress_fns = &default_progress_fns; + +void ui_progress__update(u64 curr, u64 total, const char *title) +{ + return progress_fns->update(curr, total, title); +} + +void ui_progress__finish(void) +{ + if (progress_fns->finish) + progress_fns->finish(); } |