72 |
|
/* already closed? */ |
73 |
|
if (!nprocs) |
74 |
|
return; |
75 |
– |
/* report activity */ |
75 |
|
wputs("closing rtrace process...\n"); |
76 |
|
/* flush beam queue */ |
77 |
|
done_packets(flush_queue()); |
78 |
+ |
/* sync holodeck */ |
79 |
+ |
hdsync(NULL, 1); |
80 |
|
/* close rtrace */ |
81 |
|
if ((status = end_rtrace())) |
82 |
|
error(WARNING, "bad exit status from rtrace"); |
93 |
|
if (nprocs > 0) /* already running? */ |
94 |
|
return; |
95 |
|
wputs("restarting rtrace process...\n"); |
96 |
+ |
starttime = time(NULL); /* reset start time and counts */ |
97 |
+ |
npacksdone = nraysdone = 0L; |
98 |
+ |
if (vdef(TIME)) /* reset end time */ |
99 |
+ |
endtime = starttime + vflt(TIME)*3600. + .5; |
100 |
|
if (vdef(RIF)) { /* rerun rad to update octree */ |
101 |
|
sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF)); |
102 |
|
if (system(combuf)) |
154 |
|
} |
155 |
|
rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */ |
156 |
|
unlink(tf1); /* clean up */ |
157 |
+ |
} |
158 |
+ |
|
159 |
+ |
|
160 |
+ |
report(t) /* report progress so far */ |
161 |
+ |
time_t t; |
162 |
+ |
{ |
163 |
+ |
static time_t seconds2go = 1000000; |
164 |
+ |
|
165 |
+ |
if (t == 0L) |
166 |
+ |
t = time(NULL); |
167 |
+ |
sprintf(errmsg, "%ld packets (%ld rays) done after %.2f hours\n", |
168 |
+ |
npacksdone, nraysdone, (t-starttime)/3600.); |
169 |
+ |
eputs(errmsg); |
170 |
+ |
if (seconds2go == 1000000) |
171 |
+ |
seconds2go = vdef(REPORT) ? (long)(vflt(REPORT)*60. + .5) : 0L; |
172 |
+ |
if (seconds2go) |
173 |
+ |
reporttime = t + seconds2go; |
174 |
|
} |