1: #define MAINLINE
   2: 
   3: #ifdef  RCSIDENT
   4: static char rcsid[] = "$Header: nfstats.c,v 1.7 85/01/18 15:31:24 notes Rel $";
   5: #endif	RCSIDENT
   6: 
   7: /*
   8:  *	stats - print out the statistics for some notefiles.
   9:  *	Takes a list of notefiles, and prints the statistics that are
  10:  *	kept about that notefile.
  11:  *	A total summary is also presented.
  12:  *
  13:  *	Original coding:	Ray Essick	December 29, 1981
  14:  *	Modified for wildcards:	Ray Essick	April 8, 1982
  15:  */
  16: #include "parms.h"
  17: #include "structs.h"
  18: 
  19: struct when_f   ztime;
  20: char    fmtd[DATELEN];                  /* for time of report stuff */
  21: int     statsdone;
  22: int     summary;                    /* summary only flag */
  23: long    gnotwrit,
  24:         grspwrit,
  25:         gnotread,
  26:         grspread,
  27:         gnotxmit,
  28:         grspxmit,
  29:         gnotdrop,
  30:         grspdrop,
  31:         gorphans,
  32:         gadopted,
  33:         netwrkouts,
  34:         netwrkins,
  35:         gnotrcvd,
  36:         grsprcvd,
  37:         totaltime,
  38:         entries;
  39:                             /* global summaries */
  40: 
  41: statone (nfname)
  42: char   *nfname;
  43: {
  44: 
  45:     struct io_f io;
  46:     if (init (&io, nfname) < 0)
  47:     return;
  48: 
  49: 
  50:     gnotwrit += io.descr.d_notwrit;         /* add in global stats */
  51:     grspwrit += io.descr.d_rspwrit;
  52:     gnotread += io.descr.d_notread;
  53:     grspread += io.descr.d_rspread;
  54:     gnotxmit += io.descr.d_notxmit;
  55:     grspxmit += io.descr.d_rspxmit;
  56:     gnotrcvd += io.descr.d_notrcvd;
  57:     grsprcvd += io.descr.d_rsprcvd;
  58:     gnotdrop += io.descr.d_notdrop;
  59:     grspdrop += io.descr.d_rspdrop;
  60:     gorphans += io.descr.d_orphans;
  61:     gadopted += io.descr.d_adopted;
  62:     netwrkouts += io.descr.netwrkouts;
  63:     netwrkins += io.descr.netwrkins;
  64:     totaltime += io.descr.walltime;
  65:     entries += io.descr.entries;
  66:     gettime (&ztime);
  67:     sprdate (&ztime, fmtd);             /* get time now */
  68: 
  69:     if (summary == 0)
  70:     {
  71:     if (statsdone++ != 0)
  72:         printf ("\n");
  73:     printf ("             %s on %s at %s\n", nfname, io.descr.d_id.sys, fmtd);
  74:     printf ("                \tNOTES\tRESPS\tTOTALS\n");
  75:     printf ("Local Reads     \t%ld\t%ld\t%ld\n", io.descr.d_notread,
  76:         io.descr.d_rspread, io.descr.d_notread + io.descr.d_rspread);
  77:     printf ("Local Written   \t%ld\t%ld\t%ld\n",
  78:         io.descr.d_notwrit - io.descr.d_notrcvd,
  79:         io.descr.d_rspwrit - io.descr.d_rsprcvd,
  80:         io.descr.d_notwrit + io.descr.d_rspwrit - io.descr.d_notrcvd - io.descr.d_rsprcvd);
  81:     printf ("Networked in    \t%ld\t%ld\t%ld\n", io.descr.d_notrcvd, io.descr.d_rsprcvd,
  82:         io.descr.d_notrcvd + io.descr.d_rsprcvd);
  83:     printf ("Networked out   \t%ld\t%ld\t%ld\n", io.descr.d_notxmit, io.descr.d_rspxmit,
  84:         io.descr.d_notxmit + io.descr.d_rspxmit);
  85:     printf ("Network Dropped \t%ld\t%ld\t%ld\n", io.descr.d_notdrop, io.descr.d_rspdrop,
  86:         io.descr.d_notdrop + io.descr.d_rspdrop);
  87:     printf ("Network Transmissions: %ld   Network Receptions: %ld\n",
  88:         io.descr.netwrkouts, io.descr.netwrkins);
  89:     printf ("Orphaned Responses Received: %ld    Orphans Adopted: %ld\n",
  90:         io.descr.d_orphans, io.descr.d_adopted);
  91:     printf ("Entries into notesfile: %ld    Total time in notefile: %8.2f minutes\n",
  92:         io.descr.entries, ((float) io.descr.walltime / 60.0));
  93:     if (io.descr.entries)
  94:         printf ("Average Time/entry: %6.2f minutes\n",
  95:             ((float) io.descr.walltime / 60.0 / (float) io.descr.entries));
  96:     sprdate (&io.descr.d_created, fmtd);
  97:     printf ("Created at %s, Used on %ld days\n", fmtd, io.descr.d_daysused);
  98:     }
  99: 
 100:     closenf (&io);                  /* close this notefile */
 101: }
 102: 
 103: 
 104: main (argc, argv)
 105: char  **argv;
 106: {
 107:     int     i;
 108:     struct nflist_f *nfptr;
 109: 
 110:     startup (argc, argv);               /* common initialization */
 111: 
 112:     if (argc == 1)
 113:     {
 114:     printf ("Usage: %s [-s] notefile ...\n", argv[0]);
 115:     exit (BAD);
 116:     }
 117: 
 118:     gnotwrit = grspwrit = gnotread = grspread = 0;
 119:     gnotxmit = grspxmit = gnotrcvd = grsprcvd = 0;
 120:     gnotdrop = grspdrop = gorphans = gadopted = 0;
 121:     netwrkouts = netwrkins = 0;
 122:     totaltime = entries = 0;
 123:     statsdone = 0;                  /* number of notesfiles reported */
 124:     summary = 0;                    /* summary only flag */
 125: 
 126:     for (i = 1; i < argc; i++)
 127:     {
 128:     if (argv[i][0] == '-')
 129:         switch (argv[i][1])
 130:         {
 131:         case 's':               /* summary only */
 132:             summary = 1;
 133:             continue;
 134: 
 135:         default:
 136:             printf ("Bad switch `%c'\n", argv[i][1]);
 137:             exit (BAD);
 138:         }
 139:     expand (argv[i]);               /* load it */
 140:     }
 141: 
 142:     while ((nfptr = nextgroup ()) != (struct nflist_f *) NULL)
 143:     statone (nfptr -> nf_name);         /* print those stats */
 144: 
 145:     if ((statsdone > 1) || (summary == 1))
 146:     {
 147:     printf ("\n            Totals for all above notefiles\n");
 148:     printf ("                \tNOTES\tRESPS\tTOTALS\n");
 149:     printf ("Local Read      \t%ld\t%ld\t%ld\n", gnotread,
 150:         grspread, gnotread + grspread);
 151:     printf ("Local Written   \t%ld\t%ld\t%ld\n", gnotwrit - gnotrcvd,
 152:         grspwrit - grsprcvd, gnotwrit + grspwrit - gnotrcvd - grsprcvd);
 153:     printf ("Networked in    \t%ld\t%ld\t%ld\n", gnotrcvd, grsprcvd,
 154:         gnotrcvd + grsprcvd);
 155:     printf ("Networked out   \t%ld\t%ld\t%ld\n", gnotxmit, grspxmit,
 156:         gnotxmit + grspxmit);
 157:     printf ("Network Dropped \t%ld\t%ld\t%ld\n", gnotdrop, grspdrop,
 158:         gnotdrop + grspdrop);
 159:     printf ("Network Transmissions: %ld   Network Receptions: %ld\n",
 160:         netwrkouts, netwrkins);
 161:     printf ("Orphaned Responses Received: %ld    Orphans Adopted: %ld\n",
 162:         gorphans, gadopted);
 163:     printf ("Entries into notefile: %ld     Total time in notefile: %8.2f minutes\n",
 164:         entries, ((float) totaltime / 60.0));
 165:     if (entries)
 166:         printf ("Average Time/entry: %6.2f minutes\n",
 167:             ((float) totaltime / 60.0 / (float) entries));
 168: 
 169:     }
 170:     exit (GOOD);
 171: }

Defined functions

main defined in line 104; never used
statone defined in line 41; used 1 times

Defined variables

entries defined in line 38; used 9 times
fmtd defined in line 20; used 4 times
gadopted defined in line 32; used 3 times
gnotdrop defined in line 29; used 4 times
gnotrcvd defined in line 35; used 6 times
gnotread defined in line 25; used 4 times
gnotwrit defined in line 23; used 4 times
gnotxmit defined in line 27; used 4 times
gorphans defined in line 31; used 3 times
grspdrop defined in line 30; used 4 times
grsprcvd defined in line 36; used 6 times
grspread defined in line 26; used 4 times
grspwrit defined in line 24; used 4 times
grspxmit defined in line 28; used 4 times
netwrkins defined in line 34; used 5 times
netwrkouts defined in line 33; used 5 times
rcsid defined in line 4; never used
statsdone defined in line 21; used 3 times
summary defined in line 22; used 4 times
totaltime defined in line 37; used 4 times
ztime defined in line 19; used 2 times

Defined macros

MAINLINE defined in line 1; never used
Last modified: 1985-10-30
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1308
Valid CSS Valid XHTML 1.0 Strict