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.6 by greg, Tue Sep 1 16:27:52 2015 UTC vs.
Revision 2.7 by rschregle, Tue May 17 17:39:47 2016 UTC

# Line 1 | Line 1
1   #ifndef lint
2   static const char RCSid[] = "$Id$";
3   #endif
4 +
5   /*
6     ==================================================================
7     Photon map diagnostic output and progress reports
# Line 11 | Line 12 | static const char RCSid[] = "$Id$";
12     supported by the Swiss National Science Foundation (SNSF, #147053)
13     ==================================================================
14    
15 +   $Id$
16   */
17  
18  
# Line 23 | Line 25 | static const char RCSid[] = "$Id$";
25  
26   time_t repStartTime, repLastTime = 0;   /* Time at start & last report */
27   unsigned long repProgress,              /* Report progress counter */
28 <              repComplete;              /* Report completion count */
28 >              repComplete,              /* Report completion count */
29 >              repEmitted;               /* Num emitted photons */
30  
31  
29
32   static char* biasCompStats (const PhotonMap *pmap, PhotonMapType type,
33                              char *stats)
34   /* Dump bias compensation statistics */
# Line 34 | Line 36 | static char* biasCompStats (const PhotonMap *pmap, Pho
36     unsigned avgBwidth;
37     float avgErr;
38    
39 +   stats [0] = '\0';
40 +  
41     /* Check if photon map is valid and bias compensated */
42     if (pmap && pmap -> maxGather > pmap -> minGather) {      
43        avgBwidth = pmap -> numDensity
# Line 41 | Line 45 | static char* biasCompStats (const PhotonMap *pmap, Pho
45        avgErr = pmap -> numDensity
46                 ? sqrt(pmap -> rmsError / pmap -> numDensity) : 0;
47                                                
48 <      sprintf(stats, "%d/%d/%d %s (%.1f/%.1f/%.1f%% error), ",
48 >      sprintf(stats, "%d/%d/%d %s photon bwidth (%.1f/%.1f/%.1f%% error), ",
49                pmap -> minGathered, pmap -> maxGathered, avgBwidth,
50                pmapName [type],
51                100 * pmap -> minError, 100 * pmap -> maxError, 100 * avgErr);
# Line 70 | Line 74 | void pmapBiasCompReport (char *stats)
74  
75  
76  
77 + #ifdef PMAP_OOC
78 +   static char* oocCacheStats (const PhotonMap *pmap, PhotonMapType type,
79 +                               char *stats)
80 +   /* Dump OOC I/O cache statistics */
81 +   {
82 +      const OOC_Cache   *cache;
83 +      stats [0] = '\0';
84 +
85 +      
86 +      /* Check for photon map is valid and caching enabled */
87 +      if (pmap && (cache = pmap -> store.cache) && cache -> numReads) {
88 +         sprintf(stats, "%ld %s photons cached in %d/%d pages "
89 +                 "(%.1f%% hit, %.1f%% rept, %.1f coll), ",
90 +                 (unsigned long)cache -> pageCnt * cache -> recPerPage,
91 +                 pmapName [type], cache -> pageCnt, cache -> numPages,
92 +                 100.0 * cache -> numHits / cache -> numReads,
93 +                 100.0 * cache -> numRept / cache -> numReads,
94 +                 (float)cache -> numColl / cache -> numReads);
95 +                    
96 +         return stats;
97 +      }
98 +      
99 +      return NULL;
100 +   }
101 +
102 +
103 +
104 +   void pmapOOCCacheReport (char *stats)
105 +   /* Append full OOC I/O cache statistics to stats; interface to rpict's
106 +    * report() */
107 +   {
108 +      char tmp [512];
109 +      unsigned t;
110 +      
111 +      stats [0] = '\0';
112 +      
113 +      for (t = 0; t < NUM_PMAP_TYPES; t++)
114 +         if (oocCacheStats(photonMaps [t], t, tmp))
115 +            strcat(stats, tmp);
116 +   }
117 + #endif
118 +
119 +
120 +
121   #ifndef NON_POSIX
122     void pmapPreCompReport()
123     /* Report global photon precomputation progress */
# Line 165 | Line 213 | void pmapBiasCompReport (char *stats)
213           s = (tbuf.tms_stime + tbuf.tms_cstime) * period;
214        #endif
215  
216 <      sprintf(errmsg, "%lu emitted, ", repProgress);
216 >      sprintf(errmsg, "%lu emitted, ", repEmitted);
217        
218        for (t = 0; t < NUM_PMAP_TYPES; t++)
219           if (photonMaps [t]) {
220 <            sprintf(tmp, "%lu %s, ",
221 <                    photonMaps [t] -> heapEnd, pmapName [t]);
220 >            sprintf(tmp, "%lu %s, ", photonMaps [t] -> numPhotons,
221 >                    pmapName [t]);
222              strcat(errmsg, tmp);
223           }
224        
# Line 219 | Line 267 | void pmapBiasCompReport (char *stats)
267        unsigned t;
268        
269        repLastTime = time(NULL);
270 <      sprintf(errmsg, "%lu emitted, ", repProgress);
270 >      sprintf(errmsg, "%lu emitted, ", repEmitted);
271  
272        for (t = 0; t < NUM_PMAP_TYPES; t++)
273           if (photonMaps [t]) {
274 <            sprintf(tmp, "%lu %s, ",
275 <                    photonMaps [t] -> heapEnd, pmapName [t]);
274 >            sprintf(tmp, "%lu %s, ", photonMaps [t] -> numPhotons,
275 >                    pmapName [t]);
276              strcat(errmsg, tmp);
277           }      
278        

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines