diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-10-09 17:50:40 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-10-09 17:50:40 +0200 |
commit | b8e384a4d5b9910f655dc532636978d0c0e24054 (patch) | |
tree | b42730d4e290110d81858cc09ab06a997b3cd964 | |
parent | e5722bac9cfd5a643141117d1899bcd6aa7c3731 (diff) |
lib: make drmtest_progress more robust
-rw-r--r-- | lib/drmtest.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index d217a1d..da3c504 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); } |