estimated time implementiert. Bild weist schwarze artefakte auf

This commit is contained in:
any
2026-08-29 01:31:10 +02:00
parent 09d2587ef2
commit 5dd39a360e
4 changed files with 12 additions and 3 deletions
+10 -1
View File
@@ -68,14 +68,23 @@ void *workerLoop(void *arg) {
}
void* monitorProgress(void *arg) {
double oldProgress = 0.0000001;
MonitorArgs *args = (MonitorArgs*)arg;
double actualTime = 0;
while (1){
clock_t startTime = clock();
int pixelId = *atomic_load(&args->nextPixelId);
if (pixelId >= args->pixelCount) break;
double progress = 100.0 * pixelId / args->pixelCount;
printf("progress: %lf%%\n", progress);
double progressDiff = progress - oldProgress;
double estimatedTime = actualTime * 100/progressDiff;
double estimatedRestTime = actualTime * 1 / progressDiff * (100-progress);
printf("progress: %lf%%; et rest: %lfs; et gesamt: %lfs\n", progress, estimatedRestTime, estimatedTime);
oldProgress = progress;
SLEEP_SECONDS(1);
clock_t endTime = clock();
actualTime = (double)(endTime - startTime) / CLOCKS_PER_SEC;
}
return NULL;
}