| 26 |
|
|
| 27 |
|
extern time_t time(); |
| 28 |
|
|
| 29 |
+ |
int chunkycmp = 0; /* clump beams together on disk */ |
| 30 |
+ |
|
| 31 |
|
static PACKHEAD *complist=NULL; /* list of beams to compute */ |
| 32 |
|
static int complen=0; /* length of complist */ |
| 33 |
|
static int listpos=0; /* current list position for next_packet */ |
| 34 |
|
static int lastin= -1; /* last ordered position in list */ |
| 33 |
– |
static int chunky=0; /* clump beams together on disk */ |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
int |
| 41 |
|
BEAMI *bip0, *bip1; |
| 42 |
|
register long c; |
| 43 |
|
/* first check desired quantities */ |
| 44 |
< |
if (chunky) |
| 44 |
> |
if (chunkycmp) |
| 45 |
|
c = rchunk(b1->nr)*(rchunk(b0->nc)+1L) - |
| 46 |
|
rchunk(b0->nr)*(rchunk(b1->nc)+1L); |
| 47 |
|
else |
| 103 |
|
error(CONSISTENCY, "unregistered holodeck in dispbeam"); |
| 104 |
|
p->bi = hb->b; |
| 105 |
|
disp_packet(p); /* display it */ |
| 106 |
+ |
if (n >= 1024) { /* free ridiculous packets */ |
| 107 |
+ |
free((char *)p); |
| 108 |
+ |
p = NULL; n = 0; |
| 109 |
+ |
} |
| 110 |
|
} |
| 111 |
|
|
| 112 |
|
|
| 335 |
|
|
| 336 |
|
if (complen <= 0) /* check to see if there is even a list */ |
| 337 |
|
return; |
| 338 |
< |
if (!chunky) /* check to see if fragment list is full */ |
| 338 |
> |
if (!chunkycmp) /* check to see if fragment list is full */ |
| 339 |
|
if (!hdfragOK(hdlist[0]->fd, &listlen, NULL) |
| 340 |
|
#if NFRAG2CHUNK |
| 341 |
|
|| listlen >= NFRAG2CHUNK |
| 342 |
|
#endif |
| 343 |
|
) { |
| 344 |
+ |
chunkycmp++; /* use "chunky" comparison */ |
| 345 |
+ |
lastin = -1; /* need to re-sort list */ |
| 346 |
|
#ifdef DEBUG |
| 347 |
|
error(WARNING, "using chunky comparison mode"); |
| 348 |
|
#endif |
| 342 |
– |
chunky++; /* use "chunky" comparison */ |
| 343 |
– |
lastin = -1; /* need to re-sort list */ |
| 349 |
|
} |
| 345 |
– |
#ifdef DEBUG |
| 346 |
– |
else |
| 347 |
– |
fprintf(stderr, "sortcomplist: %d fragments\n", |
| 348 |
– |
listlen); |
| 349 |
– |
#endif |
| 350 |
|
if (lastin < 0 || listpos*4 >= complen*3) |
| 351 |
|
qsort((char *)complist, complen, sizeof(PACKHEAD), beamcmp); |
| 352 |
|
else if (listpos) { /* else sort and merge sublist */ |