aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/newt.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/newt.c')
-rw-r--r--tools/perf/util/newt.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 23f3b7d31bff..c0986d342954 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -39,62 +39,6 @@
39 39
40newtComponent newt_form__new(void); 40newtComponent newt_form__new(void);
41 41
42struct ui_progress {
43 newtComponent form, scale;
44};
45
46struct ui_progress *ui_progress__new(const char *title, u64 total)
47{
48 struct ui_progress *self = malloc(sizeof(*self));
49
50 if (self != NULL) {
51 int cols;
52
53 if (use_browser <= 0)
54 return self;
55 newtGetScreenSize(&cols, NULL);
56 cols -= 4;
57 newtCenteredWindow(cols, 1, title);
58 self->form = newtForm(NULL, NULL, 0);
59 if (self->form == NULL)
60 goto out_free_self;
61 self->scale = newtScale(0, 0, cols, total);
62 if (self->scale == NULL)
63 goto out_free_form;
64 newtFormAddComponent(self->form, self->scale);
65 newtRefresh();
66 }
67
68 return self;
69
70out_free_form:
71 newtFormDestroy(self->form);
72out_free_self:
73 free(self);
74 return NULL;
75}
76
77void ui_progress__update(struct ui_progress *self, u64 curr)
78{
79 /*
80 * FIXME: We should have a per UI backend way of showing progress,
81 * stdio will just show a percentage as NN%, etc.
82 */
83 if (use_browser <= 0)
84 return;
85 newtScaleSet(self->scale, curr);
86 newtRefresh();
87}
88
89void ui_progress__delete(struct ui_progress *self)
90{
91 if (use_browser > 0) {
92 newtFormDestroy(self->form);
93 newtPopWindow();
94 }
95 free(self);
96}
97
98static int ui_entry__read(const char *title, char *bf, size_t size, int width) 42static int ui_entry__read(const char *title, char *bf, size_t size, int width)
99{ 43{
100 struct newtExitStruct es; 44 struct newtExitStruct es;