Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[linux/fpc-iii.git] / tools / perf / ui / progress.c
bloba0f24c7115c59f891fa894739ef4da157a9e33cf
1 #include "../cache.h"
2 #include "progress.h"
4 static void null_progress__update(struct ui_progress *p __maybe_unused)
8 static struct ui_progress_ops null_progress__ops =
10 .update = null_progress__update,
13 struct ui_progress_ops *ui_progress__ops = &null_progress__ops;
15 void ui_progress__update(struct ui_progress *p, u64 adv)
17 p->curr += adv;
19 if (p->curr >= p->next) {
20 p->next += p->step;
21 ui_progress__ops->update(p);
25 void ui_progress__init(struct ui_progress *p, u64 total, const char *title)
27 p->curr = 0;
28 p->next = p->step = total / 16;
29 p->total = total;
30 p->title = title;
34 void ui_progress__finish(void)
36 if (ui_progress__ops->finish)
37 ui_progress__ops->finish();