| 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"; |
| 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 */ |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
|
| 80 |
+ |
#ifdef BSD |
| 81 |
|
report() /* report progress */ |
| 82 |
|
{ |
| 77 |
– |
#ifdef BSD |
| 83 |
|
struct rusage rubuf; |
| 84 |
|
double t; |
| 85 |
|
|
| 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 */ |
| 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; |
| 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) { |