X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=tools%2Fperf%2Fui%2Fprogress.c;h=3ec695607a4d074f844f4922805d52556b2ec645;hb=3c2e81ef344a90bb0a39d84af6878b4aeff568a2;hp=13aa64e50e11cd6ee5978d5d3f8674907fc2475d;hpb=a4d3621e0d3ecf191961dc9214e4a378a7186780;p=~andy%2Flinux diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c index 13aa64e50e1..3ec695607a4 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(); }