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

Comparing ray/src/hd/rhinfo.c (file contents):
Revision 3.6 by greg, Thu May 29 16:26:22 2003 UTC vs.
Revision 3.12 by greg, Thu Sep 30 14:45:10 2010 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Get general information on holodeck file
6   */
7  
8 + #include <stdio.h>
9 +
10 + #include "platform.h"
11 + #include "resolu.h"
12   #include "holo.h"
13  
14   #ifndef NHBINS
# Line 15 | Line 19 | char   *progname;              /* global argv[0] */
19  
20   long    beamtot, samptot;       /* total beams and samples */
21  
22 + static void gethdinfo(char      *fname, FILE    *fout);
23 + static void psectstats(HOLO     *hp, FILE       *fp);
24  
19 main(argc, argv)
20 int     argc;
21 char    *argv[];
22 {
23        int     sect;
25  
26 + int
27 + main(
28 +        int     argc,
29 +        char    *argv[]
30 + )
31 + {
32          progname = argv[0];
33          if (argc != 2)
34                  goto userr;
# Line 33 | Line 40 | userr:
40   }
41  
42  
43 < gethdinfo(fname, fout)          /* get information on holodeck */
44 < char    *fname;
45 < FILE    *fout;
43 > static void
44 > gethdinfo(              /* get information on holodeck */
45 >        char    *fname,
46 >        FILE    *fout
47 > )
48   {
49          FILE    *fp;
50          HOLO    *hdsect;
51          int     fd;
52 <        int4    nextloc;
52 >        int32   nextloc;
53 >        off_t   fsiz;
54          int     n;
55                                          /* open holodeck file */
56          if ((fp = fopen(fname, "r")) == NULL) {
# Line 56 | Line 66 | FILE   *fout;
66          nextloc = ftell(fp);                    /* get stdio position */
67          fclose(fp);                             /* done with stdio */
68          for (n = 0; nextloc > 0L; n++) {        /* get the section(s) */
69 <                lseek(fd, (off_t)nextloc, 0);
69 >                lseek(fd, (off_t)nextloc, SEEK_SET);
70                  read(fd, (char *)&nextloc, sizeof(nextloc));
71                  fprintf(fout, "Section %d:\n", n);
72                  hdsect = hdinit(fd, NULL);      /* load section directory */
73                  psectstats(hdsect, fout);       /* print section statistics */
74          }
75 <        nextloc = hdfilen(fd);                  /* print global statistics */
75 >        fsiz = hdfilen(fd);                     /* print global statistics */
76          fputs("=====================================================\n", fout);
77          fprintf(fout, "Total samples/beams: %ld/%ld (%.2f samples/beam)\n",
78                          samptot, beamtot, (double)samptot/beamtot);
79          fprintf(fout, "%.1f Mbyte file, %.1f%% fragmentation\n",
80 <                        nextloc/(1024.*1024.),
81 <                        100.*(nextloc-hdfiluse(fd,1))/nextloc);
80 >                        fsiz/(1024.*1024.),
81 >                        100.*(fsiz-hdfiluse(fd))/fsiz);
82                                                  /* don't bother with cleanup */
83   #if 0
84          hddone(NULL);                           /* free sections */
# Line 77 | Line 87 | FILE   *fout;
87   }
88  
89  
90 < psectstats(hp, fp)              /* print statistical information for section */
91 < register HOLO   *hp;
92 < FILE    *fp;
90 > static void
91 > psectstats(             /* print statistical information for section */
92 >        register HOLO   *hp,
93 >        FILE    *fp
94 > )
95   {
96          int     scount[NHBINS];
97          int     minsamp = 10000, maxsamp = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines