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()); |
91 |
|
if (nprocs > 0) /* already running? */ |
92 |
|
return; |
93 |
|
wputs("restarting rtrace process...\n"); |
94 |
+ |
starttime = time(NULL); /* reset start time and counts */ |
95 |
+ |
npacksdone = nraysdone = 0L; |
96 |
+ |
if (vdef(TIME)) /* reset end time */ |
97 |
+ |
endtime = starttime + vflt(TIME)*3600. + .5; |
98 |
|
if (vdef(RIF)) { /* rerun rad to update octree */ |
99 |
|
sprintf(combuf, "rad -v 0 -s -w %s", vval(RIF)); |
100 |
|
if (system(combuf)) |
152 |
|
} |
153 |
|
rtargc += wordfile(rtargv+rtargc, tf1); /* get rtrace options */ |
154 |
|
unlink(tf1); /* clean up */ |
155 |
+ |
} |
156 |
+ |
|
157 |
+ |
|
158 |
+ |
report(t) /* report progress so far */ |
159 |
+ |
time_t t; |
160 |
+ |
{ |
161 |
+ |
static time_t seconds2go = 1000000; |
162 |
+ |
|
163 |
+ |
if (t == 0L) |
164 |
+ |
t = time(NULL); |
165 |
+ |
sprintf(errmsg, "%ld packets (%ld rays) done after %.2f hours\n", |
166 |
+ |
npacksdone, nraysdone, (t-starttime)/3600.); |
167 |
+ |
eputs(errmsg); |
168 |
+ |
if (seconds2go == 1000000) |
169 |
+ |
seconds2go = vdef(REPORT) ? (long)(vflt(REPORT)*60. + .5) : 0L; |
170 |
+ |
if (seconds2go) |
171 |
+ |
reporttime = t + seconds2go; |
172 |
|
} |