diff --git a/lib/drmtest.c b/lib/drmtest.c index d217a1d3..da3c5047 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -542,13 +542,18 @@ void drmtest_permute_array(void *array, unsigned size, void drmtest_progress(const char *header, uint64_t i, uint64_t total) { + int div = 200; + if (i+1 >= total) { fprintf(stderr, "\r%s100%%\n", header); return; } + if (total / 200 == 0) + div = 1; + /* only bother updating about every 0.5% */ - if (i % (total / 200) == 0 || i+1 >= total) { + if (i % (total / div) == 0 || i+1 >= total) { fprintf(stderr, "\r%s%3llu%%", header, (long long unsigned) i * 100 / total); }