summaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/progress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/ui/progress.c')
-rw-r--r--tools/perf/ui/progress.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/perf/ui/progress.c b/tools/perf/ui/progress.c
index a9c15804b1f6..ae91c8148edf 100644
--- a/tools/perf/ui/progress.c
+++ b/tools/perf/ui/progress.c
@@ -1,3 +1,4 @@
+#include <linux/kernel.h>
#include "../cache.h"
#include "progress.h"
@@ -14,10 +15,14 @@ struct ui_progress_ops *ui_progress__ops = &null_progress__ops;
void ui_progress__update(struct ui_progress *p, u64 adv)
{
+ u64 last = p->curr;
+
p->curr += adv;
if (p->curr >= p->next) {
- p->next += p->step;
+ u64 nr = DIV_ROUND_UP(p->curr - last, p->step);
+
+ p->next += nr * p->step;
ui_progress__ops->update(p);
}
}