aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/tui/progress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/tui/progress.c')
-rw-r--r--tools/perf/ui/tui/progress.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/perf/ui/tui/progress.c b/tools/perf/ui/tui/progress.c
index 6c2184d53cbf..c61d14b101e0 100644
--- a/tools/perf/ui/tui/progress.c
+++ b/tools/perf/ui/tui/progress.c
@@ -2,9 +2,10 @@
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
7static void tui_progress__update(u64 curr, u64 total, const char *title) 8static void tui_progress__update(struct ui_progress *p)
8{ 9{
9 int bar, y; 10 int bar, y;
10 /* 11 /*
@@ -14,29 +15,30 @@ static void tui_progress__update(u64 curr, u64 total, const char *title)
14 if (use_browser <= 0) 15 if (use_browser <= 0)
15 return; 16 return;
16 17
17 if (total == 0) 18 if (p->total == 0)
18 return; 19 return;
19 20
20 ui__refresh_dimensions(true); 21 ui__refresh_dimensions(false);
21 pthread_mutex_lock(&ui__lock); 22 pthread_mutex_lock(&ui__lock);
22 y = SLtt_Screen_Rows / 2 - 2; 23 y = SLtt_Screen_Rows / 2 - 2;
23 SLsmg_set_color(0); 24 SLsmg_set_color(0);
24 SLsmg_draw_box(y, 0, 3, SLtt_Screen_Cols); 25 SLsmg_draw_box(y, 0, 3, SLtt_Screen_Cols);
25 SLsmg_gotorc(y++, 1); 26 SLsmg_gotorc(y++, 1);
26 SLsmg_write_string((char *)title); 27 SLsmg_write_string((char *)p->title);
28 SLsmg_fill_region(y, 1, 1, SLtt_Screen_Cols - 2, ' ');
27 SLsmg_set_color(HE_COLORSET_SELECTED); 29 SLsmg_set_color(HE_COLORSET_SELECTED);
28 bar = ((SLtt_Screen_Cols - 2) * curr) / total; 30 bar = ((SLtt_Screen_Cols - 2) * p->curr) / p->total;
29 SLsmg_fill_region(y, 1, 1, bar, ' '); 31 SLsmg_fill_region(y, 1, 1, bar, ' ');
30 SLsmg_refresh(); 32 SLsmg_refresh();
31 pthread_mutex_unlock(&ui__lock); 33 pthread_mutex_unlock(&ui__lock);
32} 34}
33 35
34static struct ui_progress tui_progress_fns = 36static struct ui_progress_ops tui_progress__ops =
35{ 37{
36 .update = tui_progress__update, 38 .update = tui_progress__update,
37}; 39};
38 40
39void ui_progress__init(void) 41void tui_progress__init(void)
40{ 42{
41 progress_fns = &tui_progress_fns; 43 ui_progress__ops = &tui_progress__ops;
42} 44}