aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/progress.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-12-08 15:18:41 +0100
committerIngo Molnar <mingo@kernel.org>2012-12-08 15:18:41 +0100
commitadc1ef1e37358d3c17d1a74a58b2e104fc0bda15 (patch)
tree6f43107a76ed87f2b817594d2d62246ab82cfba6 /tools/perf/ui/progress.c
parentMerge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace into perf/core (diff)
parentperf evsel: Introduce is_group_member method (diff)
downloadlinux-dev-adc1ef1e37358d3c17d1a74a58b2e104fc0bda15.tar.xz
linux-dev-adc1ef1e37358d3c17d1a74a58b2e104fc0bda15.zip
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo: - UAPI fixes, from David Howels - Separate perf tests into multiple objects, one per test, from Jiri Olsa. - Fixes to /proc/pid/maps parsing, preparatory to supporting data maps, from Namhyung Kim - Fix compile error for non-NEWT builds, from Namhyung Kim - Implement ui_progress for GTK, from Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/ui/progress.c')
-rw-r--r--tools/perf/ui/progress.c44
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();
}