[BACK]Return to vmstat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / systat

Diff for /src/usr.bin/systat/vmstat.c between version 1.2 and 1.3

version 1.2, 1996/05/22 11:35:39 version 1.3, 1996/06/25 20:47:00
Line 65 
Line 65 
 #include <utmp.h>  #include <utmp.h>
 #include <unistd.h>  #include <unistd.h>
   
   #if defined(i386)
   #define _KERNEL
   #include <machine/psl.h>
   #undef _KERNEL
   #endif
   
 #include "systat.h"  #include "systat.h"
 #include "extern.h"  #include "extern.h"
   
Line 161 
Line 167 
         { "_intrcnt" },          { "_intrcnt" },
 #define X_EINTRCNT      12  #define X_EINTRCNT      12
         { "_eintrcnt" },          { "_eintrcnt" },
   #if defined(i386)
   #define X_INTRHAND      13
           { "_intrhand" },
   #endif
         { "" },          { "" },
 };  };
   
Line 226 
Line 236 
 #undef allocate  #undef allocate
         }          }
         if (nintr == 0) {          if (nintr == 0) {
   #if defined(i386)
                   struct intrhand *intrhand[16], *ihp, ih;
                   char iname[16];
                   int namelen, n;
   
                   NREAD(X_INTRHAND, intrhand, sizeof(intrhand));
                   for (namelen = 0, i = 0; i < 16; i++) {
                           ihp = intrhand[i];
                           while (ihp) {
                                   nintr++;
                                   KREAD(ihp, &ih, sizeof(ih));
                                   KREAD(ih.ih_what, iname, 16);
                                   namelen += 1 + strlen(iname);
                                   ihp = ih.ih_next;
                           }
                   }
                   intrloc = calloc(nintr, sizeof (long));
                   intrname = calloc(nintr, sizeof (char *));
                   cp = intrnamebuf = malloc(namelen);
                   for (namelen = 0, i = 0, n = 0; i < 16; i++) {
                           ihp = intrhand[i];
                           while (ihp) {
                                   KREAD(ihp, &ih, sizeof(ih));
                                   KREAD(ih.ih_what, iname, 16);
                                   strcpy(intrname[n++] = intrnamebuf + namelen, iname);
                                   namelen += 1 + strlen(iname);
                                   ihp = ih.ih_next;
                           }
                   }
   #else
                 nintr = (namelist[X_EINTRCNT].n_value -                  nintr = (namelist[X_EINTRCNT].n_value -
                         namelist[X_INTRCNT].n_value) / sizeof (long);                          namelist[X_INTRCNT].n_value) / sizeof (long);
                 intrloc = calloc(nintr, sizeof (long));                  intrloc = calloc(nintr, sizeof (long));
Line 249 
Line 289 
                         intrname[i] = cp;                          intrname[i] = cp;
                         cp += strlen(cp) + 1;                          cp += strlen(cp) + 1;
                 }                  }
   #endif
                 nextintsrow = INTSROW + 2;                  nextintsrow = INTSROW + 2;
                 allocinfo(&s);                  allocinfo(&s);
                 allocinfo(&s1);                  allocinfo(&s1);
Line 611 
Line 652 
         int mib[2];          int mib[2];
         size_t size;          size_t size;
         extern int errno;          extern int errno;
   #if defined(i386)
           struct intrhand *intrhand[16], *ihp, ih;
           int i, n;
   #endif
   
         dkreadstats();          dkreadstats();
         NREAD(X_CPTIME, s->time, sizeof s->time);          NREAD(X_CPTIME, s->time, sizeof s->time);
         NREAD(X_CNT, &s->Cnt, sizeof s->Cnt);          NREAD(X_CNT, &s->Cnt, sizeof s->Cnt);
         NREAD(X_NCHSTATS, &s->nchstats, sizeof s->nchstats);          NREAD(X_NCHSTATS, &s->nchstats, sizeof s->nchstats);
   #if defined(i386)
           NREAD(X_INTRHAND, intrhand, sizeof(intrhand));
           for (i = 0, n = 0; i < 16; i++) {
                   ihp = intrhand[i];
                   while (ihp) {
                           KREAD(ihp, &ih, sizeof(ih));
                           s->intrcnt[n++] = ih.ih_count;
                           ihp = ih.ih_next;
                   }
           }
   #else
         NREAD(X_INTRCNT, s->intrcnt, nintr * LONG);          NREAD(X_INTRCNT, s->intrcnt, nintr * LONG);
   #endif
         size = sizeof(s->Total);          size = sizeof(s->Total);
         mib[0] = CTL_VM;          mib[0] = CTL_VM;
         mib[1] = VM_METER;          mib[1] = VM_METER;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3