mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-24 06:43:01 +00:00
lib: make drmtest_progress more robust
This commit is contained in:
+6
-1
@@ -542,13 +542,18 @@ void drmtest_permute_array(void *array, unsigned size,
|
|||||||
|
|
||||||
void drmtest_progress(const char *header, uint64_t i, uint64_t total)
|
void drmtest_progress(const char *header, uint64_t i, uint64_t total)
|
||||||
{
|
{
|
||||||
|
int div = 200;
|
||||||
|
|
||||||
if (i+1 >= total) {
|
if (i+1 >= total) {
|
||||||
fprintf(stderr, "\r%s100%%\n", header);
|
fprintf(stderr, "\r%s100%%\n", header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (total / 200 == 0)
|
||||||
|
div = 1;
|
||||||
|
|
||||||
/* only bother updating about every 0.5% */
|
/* 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,
|
fprintf(stderr, "\r%s%3llu%%", header,
|
||||||
(long long unsigned) i * 100 / total);
|
(long long unsigned) i * 100 / total);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user