]> Pileus Git - ~andy/linux/blobdiff - tools/perf/ui/progress.c
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
[~andy/linux] / tools / perf / ui / progress.c
index 13aa64e50e11cd6ee5978d5d3f8674907fc2475d..3ec695607a4d074f844f4922805d52556b2ec645 100644 (file)
@@ -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();
 }