ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/hd/rholo.c
(Generate patch)

Comparing ray/src/hd/rholo.c (file contents):
Revision 3.37 by gregl, Fri Jan 16 11:45:43 1998 UTC vs.
Revision 3.41 by gwlarson, Thu Oct 8 14:52:26 1998 UTC

# Line 26 | Line 26 | char   *progname;              /* our program name */
26   char    *hdkfile;               /* holodeck file name */
27   char    froot[256];             /* root file name */
28  
29 int     nowarn = 0;             /* turn warnings off? */
30
29   int     ncprocs = 0;            /* desired number of compute processes */
30  
31   char    *outdev = NULL;         /* output device name */
# Line 51 | Line 49 | long   nraysdone = 0L;         /* number of rays done */
49   long    npacksdone = 0L;        /* number of packets done */
50  
51   PACKET  *freepacks;             /* available packets */
52 < int     avgqlen;                /* average queue length when full */
52 > int     totqlen;                /* maximum queue length when full */
53  
54   char  *sigerr[NSIG];            /* signal error messages */
55  
56 + extern int      nowarn;         /* turn warnings off? */
57 +
58   extern time_t   time();
59  
60  
# Line 222 | Line 222 | initrholo()                    /* get our holodeck running */
222                  endtime = starttime + vflt(TIME)*3600. + .5;
223                                                  /* start rtrace */
224          if (ncprocs > 0) {
225 <                i = start_rtrace();
225 >                totqlen = i = start_rtrace();
226                  if (i < 1)
227                          error(USER, "cannot start rtrace process(es)");
228                  if (vdef(REPORT)) {             /* make first report */
# Line 233 | Line 233 | initrholo()                    /* get our holodeck running */
233                  freepacks = (PACKET *)bmalloc(i*sizeof(PACKET));
234                  if (freepacks == NULL)
235                          goto memerr;
236                if (!(avgqlen = i/nprocs))      /* record mean queue length */
237                        avgqlen = 1;
236                  freepacks[--i].nr = 0;
237                  freepacks[i].next = NULL;
238                  if (!vdef(OBSTRUCTIONS) || !vbool(OBSTRUCTIONS)) {
# Line 302 | Line 300 | rholo()                                /* holodeck main loop */
300                  report(t);
301                                          /* figure out good packet size */
302   #if MAXQTIME
303 <        pksiz = nraysdone*MAXQTIME/(avgqlen*(t - starttime + 1L));
303 >        pksiz = nraysdone*MAXQTIME/(totqlen*(t - starttime + 1L));
304          if (pksiz < 1)
305                  pksiz = 1;
306          else if (pksiz > RPACKSIZ)
# Line 455 | Line 453 | loadholo()                     /* start loading a holodeck from fname */
453          int4    nextloc;
454                                          /* open holodeck file */
455          if ((fp = fopen(hdkfile, ncprocs>0 ? "r+" : "r")) == NULL) {
456 <                sprintf(errmsg, "cannot open \"%s\" for %s", hdkfile,
457 <                                ncprocs>0 ? "appending" : "reading");
456 >                sprintf(errmsg, "cannot %s \"%s\"",
457 >                                ncprocs>0 ? "append" : "read", hdkfile);
458                  error(SYSTEM, errmsg);
459          }
460                                          /* load variables from header */
# Line 506 | Line 504 | PACKET *pl;
504                  p->next = freepacks;            /* push onto free list */
505                  freepacks = p;
506          }
507 <        if (n2flush > 300/MAXQTIME*avgqlen*nprocs) {
508 <                hdflush(NULL);                  /* flush holodeck buffers */
507 > #if MAXQTIME
508 >        if (n2flush > 300/MAXQTIME*totqlen) {
509 > #else
510 >        if (n2flush > 50*totqlen) {
511 > #endif
512 >                if (outdev == NULL)
513 >                        hdflush(NULL);          /* flush holodeck buffers */
514 >                else
515 >                        hdsync(NULL, 1);        /* sync holodeck file */
516                  n2flush = 0;
517          }
518   }
# Line 552 | Line 557 | register char  *s;
557                  fflush(stderr);
558                  midline = 0;
559          }
555 }
556
557
558 wputs(s)                        /* put warning string to stderr */
559 char    *s;
560 {
561        if (!nowarn)
562                eputs(s);
560   }
561  
562  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines