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
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

+10 -1
View File
@@ -68,14 +68,23 @@ void *workerLoop(void *arg) {
} }
void* monitorProgress(void *arg) { void* monitorProgress(void *arg) {
double oldProgress = 0.0000001;
MonitorArgs *args = (MonitorArgs*)arg; MonitorArgs *args = (MonitorArgs*)arg;
double actualTime = 0;
while (1){ while (1){
clock_t startTime = clock();
int pixelId = *atomic_load(&args->nextPixelId); int pixelId = *atomic_load(&args->nextPixelId);
if (pixelId >= args->pixelCount) break; if (pixelId >= args->pixelCount) break;
double progress = 100.0 * pixelId / args->pixelCount; 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); SLEEP_SECONDS(1);
clock_t endTime = clock();
actualTime = (double)(endTime - startTime) / CLOCKS_PER_SEC;
} }
return NULL; return NULL;
} }
+2 -2
View File
@@ -7,8 +7,8 @@
#include "helper.h" #include "helper.h"
#include <math.h> #include <math.h>
#define epsilon 1e-8 #define epsilon 1e-8
#define RAYSPERPIXEL 100 #define RAYSPERPIXEL 400
#define lightBounces 6 #define lightBounces 16
#define GLOBALILLUMINATION 0.3 #define GLOBALILLUMINATION 0.3
enum objectType { enum objectType {
SPHERETYPE, SPHERETYPE,
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB