[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.52 and 1.53

version 1.52, 2004/07/09 16:32:54 version 1.53, 2004/09/23 21:10:21
Line 72 
Line 72 
         struct  vmtotal Total;          struct  vmtotal Total;
         struct  nchstats nchstats;          struct  nchstats nchstats;
         long    nchcount;          long    nchcount;
         int     *intrcnt;          u_quad_t *intrcnt;
 } s, s1, s2, z;  } s, s1, s2, z;
   
 #include "dkstats.h"  #include "dkstats.h"
Line 92 
Line 92 
 static void dinfo(int, int);  static void dinfo(int, int);
 static void getinfo(struct Info *, enum state);  static void getinfo(struct Info *, enum state);
 static void putint(int, int, int, int);  static void putint(int, int, int, int);
   static void putuint64(u_int64_t, int, int, int);
 static void putfloat(double, int, int, int, int, int);  static void putfloat(double, int, int, int, int, int);
 static int ucount(void);  static int ucount(void);
   
Line 308 
Line 309 
 showkre(void)  showkre(void)
 {  {
         float f1, f2;          float f1, f2;
         int psiz, inttotal;          int psiz;
           u_int64_t inttotal, intcnt;
         int i, l, c;          int i, l, c;
         static int failcnt = 0, first_run = 0;          static int failcnt = 0, first_run = 0;
   
Line 351 
Line 353 
                         mvprintw(intrloc[i], INTSCOL + 9, "%-8.8s",                          mvprintw(intrloc[i], INTSCOL + 9, "%-8.8s",
                             intrname[i]);                              intrname[i]);
                 }                  }
                 X(intrcnt);                  t = intcnt = s.intrcnt[i];
                 l = (int)((float)s.intrcnt[i]/etime + 0.5);                  s.intrcnt[i] -= s1.intrcnt[i];
                 inttotal += l;                  if (state == TIME)
                 putint(l, intrloc[i], INTSCOL, 8);                          s1.intrcnt[i] = intcnt;
                   intcnt = (u_int64_t)((float)s.intrcnt[i]/etime + 0.5);
                   inttotal += intcnt;
                   putuint64(intcnt, intrloc[i], INTSCOL, 8);
         }          }
         putint(inttotal, INTSROW + 1, INTSCOL, 8);          putuint64(inttotal, INTSROW + 1, INTSCOL, 8);
         Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);          Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss);
         Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes);          Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes);
         s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +          s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits +
Line 557 
Line 562 
 }  }
   
 static void  static void
   putuint64(u_int64_t n, int l, int c, int w)
   {
           char b[128];
   
           move(l, c);
           if (n == 0) {
                   while (w-- > 0)
                           addch(' ');
                   return;
           }
           snprintf(b, sizeof b, "%*llu", w, n);
           if (strlen(b) > w) {
                   while (w-- > 0)
                           addch('*');
                   return;
           }
           addstr(b);
   }
   
   static void
 putfloat(double f, int l, int c, int w, int d, int nz)  putfloat(double f, int l, int c, int w, int d, int nz)
 {  {
         char b[128];          char b[128];
Line 594 
Line 619 
                 mib[2] = KERN_INTRCNT_CNT;                  mib[2] = KERN_INTRCNT_CNT;
                 mib[3] = i;                  mib[3] = i;
                 size = sizeof(s->intrcnt[i]);                  size = sizeof(s->intrcnt[i]);
                 if (sysctl(mib, 4, &s->intrcnt[i], &size, NULL, 0) < 0)                  if (sysctl(mib, 4, &s->intrcnt[i], &size, NULL, 0) < 0) {
                         s->intrcnt[i] = 0;                          s->intrcnt[i] = 0;
                   }
         }          }
   
         size = sizeof(s->time);          size = sizeof(s->time);
Line 627 
Line 653 
 allocinfo(struct Info *s)  allocinfo(struct Info *s)
 {  {
   
         s->intrcnt = (int *) malloc(nintr * sizeof(int));          s->intrcnt = (u_quad_t *) malloc(nintr * sizeof(u_quad_t));
         if (s->intrcnt == NULL)          if (s->intrcnt == NULL)
                 errx(2, "out of memory");                  errx(2, "out of memory");
 }  }
Line 635 
Line 661 
 static void  static void
 copyinfo(struct Info *from, struct Info *to)  copyinfo(struct Info *from, struct Info *to)
 {  {
         int *intrcnt;          u_quad_t *intrcnt;
   
         intrcnt = to->intrcnt;          intrcnt = to->intrcnt;
         *to = *from;          *to = *from;
         bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (int));          bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (u_quad_t));
 }  }
   
 static void  static void

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53