--- ray/src/hd/rholo.c 1998/12/30 08:02:37 3.44 +++ ray/src/hd/rholo.c 1999/02/02 16:13:24 3.48 @@ -1,4 +1,4 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ +/* Copyright (c) 1999 Silicon Graphics, Inc. */ #ifndef lint static char SCCSid[] = "$SunId$ SGI"; @@ -14,6 +14,9 @@ static char SCCSid[] = "$SunId$ SGI"; #include #include +#ifndef RTFLUSH +#define RTFLUSH 0 /* flush one at a time in batch */ +#endif #ifndef FRAGWARN #define FRAGWARN 20 /* fragmentation for warning (%) */ #endif @@ -147,11 +150,13 @@ int signo; { static int gotsig = 0; - if (gotsig++) /* two signals and we're gone! */ + if (gotsig > 1) /* we're going as fast as we can! */ + return; + if (gotsig++) { /* two signals and we split */ + hdsync(NULL, 0); /* don't leave w/o saying goodbye */ _exit(signo); - - alarm(60); /* allow 60 seconds to clean up */ - signal(SIGALRM, SIG_DFL); /* make certain we do die */ + } + alarm(300); /* allow 5 minutes to clean up */ eputs("signal - "); eputs(sigerr[signo]); eputs("\n"); @@ -313,13 +318,14 @@ rholo() /* holodeck main loop */ if (reporttime > 0 && t >= reporttime) report(t); /* figure out good packet size */ + pksiz = RPACKSIZ; #if MAXQTIME - pksiz = nraysdone*MAXQTIME/(totqlen*(t - starttime + 1L)); - if (pksiz < 1) - pksiz = 1; - else if (pksiz > RPACKSIZ) + if (!chunkycmp) { + pksiz = nraysdone*MAXQTIME/(totqlen*(t - starttime + 1L)); + if (pksiz < 1) pksiz = 1; + else if (pksiz > RPACKSIZ) pksiz = RPACKSIZ; + } #endif - pksiz = RPACKSIZ; idle = 0; /* get packets to process */ while (freepacks != NULL) { p = freepacks; freepacks = p->next; p->next = NULL; @@ -511,8 +517,13 @@ PACKET *pl; p->nr*sizeof(RAYVAL)); if (outdev != NULL) /* display it */ disp_packet((PACKHEAD *)p); - if (hdcachesize <= 0) /* manual flushing */ + if (hdcachesize <= 0) { +#if RTFLUSH + if (outdev == NULL) + hdfreebeam(hdlist[p->hd], p->bi); +#endif n2flush++; + } nraysdone += p->nr; npacksdone++; p->nr = 0; @@ -525,10 +536,14 @@ PACKET *pl; #else if (n2flush > 50*totqlen) { #endif - if (outdev == NULL) - hdflush(NULL); /* flush holodeck buffers */ +#if RTFLUSH + hdsync(NULL, outdev!=NULL); /* sync beams & directories */ +#else + if (outdev != NULL) + hdsync(NULL, 1); else - hdsync(NULL, 1); /* sync holodeck file */ + hdflush(NULL); +#endif n2flush = 0; } }