summaryrefslogtreecommitdiff
path: root/lib/drmtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/drmtest.c')
-rw-r--r--lib/drmtest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index b2ac7621..eda012c8 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -358,6 +358,21 @@ void drmtest_permute_array(void *array, unsigned size,
}
}
+void drmtest_progress(const char *header, uint64_t i, uint64_t total)
+{
+ if (i+1 >= total) {
+ fprintf(stderr, "\r%s100%%\n", header,
+ (long long unsigned) i * 100 / total);
+ return;
+ }
+
+ /* only bother updating about every 0.5% */
+ if (i % (total / 200) == 0 || i+1 >= total) {
+ fprintf(stderr, "\r%s%3llu%%", header,
+ (long long unsigned) i * 100 / total);
+ }
+}
+
/* mappable aperture trasher helper */
drm_intel_bo **trash_bos;
int num_trash_bos;