estimated time implementiert. Bild weist schwarze artefakte auf
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
+10
-1
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@
|
||||
#include "helper.h"
|
||||
#include <math.h>
|
||||
#define epsilon 1e-8
|
||||
#define RAYSPERPIXEL 100
|
||||
#define lightBounces 6
|
||||
#define RAYSPERPIXEL 400
|
||||
#define lightBounces 16
|
||||
#define GLOBALILLUMINATION 0.3
|
||||
enum objectType {
|
||||
SPHERETYPE,
|
||||
|
||||
Reference in New Issue
Block a user