17 |
|
|
18 |
|
|
19 |
|
|
20 |
+ |
#include "pmap.h" |
21 |
|
#include "pmapdiag.h" |
22 |
|
#include "pmapdata.h" |
23 |
|
#include "standard.h" |
124 |
|
/* Report global photon precomputation progress */ |
125 |
|
{ |
126 |
|
extern char *myhostname(); |
127 |
< |
float u, s; |
127 |
> |
float u, s, rtime, eta, progress; |
128 |
|
char tmp [512]; |
129 |
|
|
130 |
|
#ifdef BSD |
161 |
|
/* Append bias compensation stats */ |
162 |
|
biasCompStats(preCompPmap, PMAP_TYPE_PRECOMP, tmp); |
163 |
|
strcat(errmsg, tmp); |
164 |
< |
|
165 |
< |
sprintf(tmp, "%4.2f%% after %.3fu %.3fs %.3fr hours on %s\n", |
166 |
< |
100.0 * repProgress / repComplete, u / 3600, s / 3600, |
167 |
< |
(repLastTime - repStartTime) / 3600.0, myhostname()); |
164 |
> |
|
165 |
> |
rtime = (repLastTime - repStartTime) / 3600.0; |
166 |
> |
progress = (float)repProgress / repComplete; |
167 |
> |
eta = max(0, rtime * (progress > FTINY ? 1 / progress - 1 : 0)); |
168 |
> |
|
169 |
> |
sprintf( |
170 |
> |
tmp, "%4.2f%% after %.3fu %.3fs %.3fr hours on %s, ETA=%.3fh\n", |
171 |
> |
100 * progress, u / 3600, s / 3600, rtime, myhostname(), eta |
172 |
> |
); |
173 |
|
strcat(errmsg, tmp); |
174 |
|
|
175 |
|
eputs(errmsg); |
186 |
|
/* Report photon distribution progress */ |
187 |
|
{ |
188 |
|
extern char *myhostname(); |
189 |
< |
float u, s; |
189 |
> |
float u, s, rtime, eta, progress; |
190 |
|
unsigned t; |
191 |
|
char tmp [512]; |
192 |
|
|
228 |
|
strcat(errmsg, tmp); |
229 |
|
} |
230 |
|
|
231 |
< |
sprintf(tmp, "%4.2f%% after %.3fu %.3fs %.3fr hours on %s\n", |
232 |
< |
100.0 * repProgress / repComplete, u / 3600, s / 3600, |
233 |
< |
(repLastTime - repStartTime) / 3600.0, myhostname()); |
234 |
< |
|
231 |
> |
rtime = (repLastTime - repStartTime) / 3600.0; |
232 |
> |
progress = (float)repProgress / repComplete; |
233 |
> |
eta = max(0, rtime * (progress > FTINY ? 1 / progress - 1 : 0)); |
234 |
> |
|
235 |
> |
sprintf( |
236 |
> |
tmp, "%4.2f%% after %.3fu %.3fs %.3fr hours on %s, ETA=%.3fh\n", |
237 |
> |
100 * progress, u / 3600, s / 3600, rtime, myhostname(), eta |
238 |
> |
); |
239 |
> |
|
240 |
|
strcat(errmsg, tmp); |
241 |
|
eputs(errmsg); |
242 |
|
fflush(stderr); |
251 |
|
void pmapPreCompReport() |
252 |
|
/* Report global photon precomputation progress */ |
253 |
|
{ |
254 |
< |
char tmp [512]; |
254 |
> |
char tmp [512]; |
255 |
> |
float rtime, progress, eta; |
256 |
|
|
257 |
|
repLastTime = time(NULL); |
258 |
|
sprintf(errmsg, "%lu precomputed, ", repProgress); |
261 |
|
biasCompStats(preCompPmap, PMAP_TYPE_PRECOMP, tmp); |
262 |
|
strcat(errmsg, tmp); |
263 |
|
|
264 |
< |
sprintf(tmp, "%4.2f%% after %5.4f hours\n", |
265 |
< |
100.0 * repProgress / repComplete, |
266 |
< |
(repLastTime - repStartTime) / 3600.0); |
264 |
> |
rtime = (repLastTime - repStartTime) / 3600.0; |
265 |
> |
progress = (float)repProgress / repComplete; |
266 |
> |
eta = max(0, rtime * (progress > FTINY ? 1 / progress - 1 : 0)); |
267 |
> |
|
268 |
> |
sprintf( |
269 |
> |
tmp, "%4.2f%% after %5.4f hours, ETA=%.3fh\n", |
270 |
> |
100 * progress, rtime, eta |
271 |
> |
); |
272 |
|
strcat(errmsg, tmp); |
273 |
|
|
274 |
|
eputs(errmsg); |
280 |
|
void pmapDistribReport() |
281 |
|
/* Report photon distribution progress */ |
282 |
|
{ |
283 |
< |
char tmp [512]; |
283 |
> |
char tmp [512]; |
284 |
|
unsigned t; |
285 |
+ |
float rtime, progress, eta; |
286 |
|
|
287 |
|
repLastTime = time(NULL); |
288 |
|
sprintf(errmsg, "%lu emitted, ", repEmitted); |
293 |
|
pmapName [t]); |
294 |
|
strcat(errmsg, tmp); |
295 |
|
} |
296 |
< |
|
297 |
< |
sprintf(tmp, "%4.2f%% after %5.4f hours\n", |
298 |
< |
100.0 * repProgress / repComplete, |
299 |
< |
(repLastTime - repStartTime) / 3600.0); |
296 |
> |
|
297 |
> |
rtime = (repLastTime - repStartTime) / 3600.0; |
298 |
> |
progress = (float)repProgress / repComplete; |
299 |
> |
eta = max(0, rtime * (progress > FTINY ? 1 / progress - 1 : 0)); |
300 |
> |
|
301 |
> |
sprintf( |
302 |
> |
tmp, "%4.2f%% after %5.4f hours, ETA=%.3fh\n", |
303 |
> |
100 * progress, rtime, eta |
304 |
> |
); |
305 |
|
strcat(errmsg, tmp); |
306 |
|
|
307 |
|
eputs(errmsg); |