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

Comparing ray/src/rt/rpict.c (file contents):
Revision 1.23 by greg, Thu Nov 1 12:06:01 1990 UTC vs.
Revision 1.24 by greg, Tue Apr 9 09:31:01 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 53 | Line 53 | int  ralrm = 0;                                /* seconds between reports */
53  
54   double  pctdone = 0.0;                  /* percentage done */
55  
56 + long  tlastrept = 0L;                   /* time at last report */
57 +
58 + extern long  time();
59 + extern long  tstart;                    /* starting time */
60 +
61   extern long  nrays;                     /* number of rays traced */
62  
63   #define  MAXDIV         32              /* maximum sample size */
# Line 72 | Line 77 | int  code;
77   }
78  
79  
80 + #ifdef BSD
81   report()                /* report progress */
82   {
77 #ifdef BSD
83          struct rusage  rubuf;
84          double  t;
85  
# Line 87 | Line 92 | report()               /* report progress */
92  
93          sprintf(errmsg, "%ld rays, %4.2f%% done after %5.4f CPU hours\n",
94                          nrays, pctdone, t/3600.0);
95 +        eputs(errmsg);
96 +        tlastrept = time((long *)0);
97 + }
98   #else
99 + report()                /* report progress */
100 + {
101          signal(SIGALRM, report);
102 <        sprintf(errmsg, "%ld rays, %4.2f%% done\n", nrays, pctdone);
103 < #endif
102 >        tlastrept = time((long *)0);
103 >        sprintf(errmsg, "%ld rays, %4.2f%% done after %5.4f hours\n",
104 >                        nrays, pctdone, (tlastrept-tstart)/3600.0);
105          eputs(errmsg);
95
96        if (ralrm > 0)
97                alarm(ralrm);
106   }
107 + #endif
108  
109  
110   render(zfile, oldfile)                          /* render the scene */
# Line 144 | Line 153 | char  *zfile, *oldfile;
153          if (zfd != -1 && i > 0 &&
154                          lseek(zfd, (long)i*hresolu*sizeof(float), 0) == -1)
155                  error(SYSTEM, "z file seek error in render");
156 +        pctdone = 100.0*i/vresolu;
157 +        if (ralrm > 0)                  /* report init stats */
158 +                report();
159          ypos = vresolu-1 - i;
160          fillscanline(scanbar[0], zbar[0], hresolu, ypos, psample);
161          ystep = psample;
162                                                  /* compute scanlines */
163          for (ypos -= ystep; ypos > -ystep; ypos -= ystep) {
152                                                        /* record progress */
153                pctdone = 100.0*(vresolu-1-ypos-ystep)/vresolu;
164                                                          /* bottom adjust? */
165                  if (ypos < 0) {
166                          ystep += ypos;
# Line 177 | Line 187 | char  *zfile, *oldfile;
187                  }
188                  if (fflush(stdout) == EOF)
189                          goto writerr;
190 +                                                        /* record progress */
191 +                pctdone = 100.0*(vresolu-1-ypos)/vresolu;
192 +                if (ralrm > 0 && time((long *)0) >= tlastrept+ralrm)
193 +                        report();
194          }
195                                                  /* clean up */
196          if (zfd != -1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines