14 |
|
#include <sys/types.h> |
15 |
|
#include <sys/stat.h> |
16 |
|
|
17 |
– |
#ifndef RTFLUSH |
18 |
– |
#define RTFLUSH 0 /* flush one at a time in batch */ |
19 |
– |
#endif |
17 |
|
#ifndef FRAGWARN |
18 |
|
#define FRAGWARN 20 /* fragmentation for warning (%) */ |
19 |
|
#endif |
20 |
|
#ifndef MAXQTIME |
21 |
|
#define MAXQTIME 5 /* target maximum seconds in queue */ |
22 |
|
#endif |
23 |
+ |
/* manual cache flushing frequency */ |
24 |
+ |
#ifndef RTFLUSH |
25 |
+ |
#if MAXQTIME |
26 |
+ |
#define RTFLUSH (300/MAXQTIME*totqlen) /* <= 5 minutes */ |
27 |
+ |
#else |
28 |
+ |
#define RTFLUSH (50*totqlen) /* just guess */ |
29 |
+ |
#endif |
30 |
+ |
#endif |
31 |
|
/* the following must be consistent with rholo.h */ |
32 |
|
int NVARS = NRHVARS; /* total number of variables */ |
33 |
|
|
60 |
|
long npacksdone = 0L; /* number of packets done */ |
61 |
|
|
62 |
|
PACKET *freepacks; /* available packets */ |
63 |
< |
int totqlen; /* maximum queue length when full */ |
63 |
> |
int totqlen; /* maximum queue length (number of packets) */ |
64 |
|
|
65 |
|
char *sigerr[NSIG]; /* signal error messages */ |
66 |
|
|
522 |
|
p->nr*sizeof(RAYVAL)); |
523 |
|
if (outdev != NULL) /* display it */ |
524 |
|
disp_packet((PACKHEAD *)p); |
525 |
< |
if (hdcachesize <= 0) { |
521 |
< |
#if RTFLUSH |
522 |
< |
if (outdev == NULL) |
523 |
< |
hdfreebeam(hdlist[p->hd], p->bi); |
524 |
< |
#endif |
525 |
> |
if (hdcachesize <= 0) |
526 |
|
n2flush++; |
526 |
– |
} |
527 |
|
nraysdone += p->nr; |
528 |
|
npacksdone++; |
529 |
|
p->nr = 0; |
531 |
|
p->next = freepacks; /* push onto free list */ |
532 |
|
freepacks = p; |
533 |
|
} |
534 |
< |
#if MAXQTIME |
535 |
< |
if (n2flush > 300/MAXQTIME*totqlen) { |
536 |
< |
#else |
537 |
< |
if (n2flush > 50*totqlen) { |
538 |
< |
#endif |
539 |
< |
#if RTFLUSH |
540 |
< |
hdsync(NULL, outdev!=NULL); /* sync beams & directories */ |
541 |
< |
#else |
534 |
> |
if (n2flush > RTFLUSH) { |
535 |
|
if (outdev != NULL) |
536 |
|
hdsync(NULL, 1); |
537 |
|
else |
538 |
|
hdflush(NULL); |
546 |
– |
#endif |
539 |
|
n2flush = 0; |
540 |
|
} |
541 |
|
} |