30 |
|
|
31 |
|
FILE *sstdin, *sstdout; /* server's standard input and output */ |
32 |
|
|
33 |
+ |
#ifdef DEBUG |
34 |
+ |
#include <sys/types.h> |
35 |
+ |
extern time_t time(); |
36 |
+ |
static time_t tmodesw; |
37 |
+ |
static time_t timm, tadd; |
38 |
+ |
static long nimmrays, naddrays; |
39 |
+ |
#endif |
40 |
+ |
|
41 |
|
#define RDY_SRV 01 |
42 |
|
#define RDY_DEV 02 |
43 |
|
#define RDY_SIN 04 |
63 |
|
sstdin = fdopen(inp, "r"); |
64 |
|
/* set command error vector */ |
65 |
|
erract[COMMAND].pf = eputs; |
66 |
+ |
#ifdef DEBUG |
67 |
+ |
tmodesw = time(NULL); |
68 |
+ |
#endif |
69 |
|
/* enter main loop */ |
70 |
|
do { |
71 |
|
rdy = disp_wait(); |
121 |
|
break; |
122 |
|
} |
123 |
|
} while (res != DS_SHUTDOWN); |
124 |
+ |
#ifdef DEBUG |
125 |
+ |
if (timm && nimmrays) |
126 |
+ |
fprintf(stderr, |
127 |
+ |
"%s: %.1f rays recalled/second (%ld rays total)\n", |
128 |
+ |
progname, (double)nimmrays/timm, nimmrays); |
129 |
+ |
if (tadd && naddrays) |
130 |
+ |
fprintf(stderr, |
131 |
+ |
"%s: %.1f rays calculated/second (%ld rays total)\n", |
132 |
+ |
progname, (double)naddrays/tadd, naddrays); |
133 |
+ |
#endif |
134 |
|
/* all done */ |
135 |
|
quit(0); |
136 |
|
} |
233 |
|
VSUM(wp, ro, rd, d); /* might be behind viewpoint */ |
234 |
|
dev_value(packra(p)[i].v, wp, rd); |
235 |
|
} |
236 |
+ |
#ifdef DEBUG |
237 |
+ |
if (imm_mode) nimmrays += p->nr; |
238 |
+ |
else naddrays += p->nr; |
239 |
+ |
#endif |
240 |
|
} |
241 |
|
|
242 |
|
|
391 |
|
break; |
392 |
|
case DS_STARTIMM: |
393 |
|
case DS_ENDIMM: |
394 |
+ |
#ifdef DEBUG |
395 |
+ |
if (imm_mode != (msg.type==DS_STARTIMM)) { |
396 |
+ |
time_t tnow = time(NULL); |
397 |
+ |
if (imm_mode) timm += tnow - tmodesw; |
398 |
+ |
else tadd += tnow - tmodesw; |
399 |
+ |
tmodesw = tnow; |
400 |
+ |
} |
401 |
+ |
#endif |
402 |
|
imm_mode = msg.type==DS_STARTIMM; |
403 |
|
/* fall through */ |
404 |
|
case DS_ACKNOW: |