mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 23:06:29 +00:00
lib: make drmtest_progress more robust
This commit is contained in:
parent
e5722bac9c
commit
b8e384a4d5
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user