ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/pmapdiag.c
(Generate patch)

Comparing ray/src/rt/pmapdiag.c (file contents):
Revision 2.7 by rschregle, Tue May 17 17:39:47 2016 UTC vs.
Revision 2.8 by rschregle, Fri Mar 26 23:47:03 2021 UTC

# Line 17 | Line 17 | static const char RCSid[] = "$Id$";
17  
18  
19  
20 + #include "pmap.h"
21   #include "pmapdiag.h"
22   #include "pmapdata.h"
23   #include "standard.h"
# Line 123 | Line 124 | void pmapBiasCompReport (char *stats)
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
# Line 160 | Line 161 | void pmapBiasCompReport (char *stats)
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);
# Line 180 | Line 186 | void pmapBiasCompReport (char *stats)
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        
# Line 222 | Line 228 | void pmapBiasCompReport (char *stats)
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);
# Line 240 | Line 251 | void pmapBiasCompReport (char *stats)
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);
# Line 249 | Line 261 | void pmapBiasCompReport (char *stats)
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);
# Line 263 | Line 280 | void pmapBiasCompReport (char *stats)
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);
# Line 275 | Line 293 | void pmapBiasCompReport (char *stats)
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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines