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

Diff for /src/usr.bin/top/machine.c between version 1.68 and 1.69

version 1.68, 2011/04/10 03:20:59 version 1.69, 2011/07/12 14:57:53
Line 41 
Line 41 
 #include <unistd.h>  #include <unistd.h>
 #include <sys/sysctl.h>  #include <sys/sysctl.h>
 #include <sys/dkstat.h>  #include <sys/dkstat.h>
   #include <sys/mount.h>
 #include <sys/swap.h>  #include <sys/swap.h>
 #include <err.h>  #include <err.h>
 #include <errno.h>  #include <errno.h>
Line 107 
Line 108 
 };  };
   
 /* these are for detailing the memory statistics */  /* these are for detailing the memory statistics */
 int memory_stats[8];  int memory_stats[10];
 char *memorynames[] = {  char *memorynames[] = {
         "Real: ", "K/", "K act/tot  ", "Free: ", "K  ",          "Real: ", "K/", "K act/tot ", "Free: ", "K ",
         "Swap: ", "K/", "K used/tot",          "Cache: ", "K ",
           "Swap: ", "K/", "K",
         NULL          NULL
 };  };
   
Line 206 
Line 208 
 {  {
         static int sysload_mib[] = {CTL_VM, VM_LOADAVG};          static int sysload_mib[] = {CTL_VM, VM_LOADAVG};
         static int vmtotal_mib[] = {CTL_VM, VM_METER};          static int vmtotal_mib[] = {CTL_VM, VM_METER};
           static int bcstats_mib[] = {CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT};
         struct loadavg sysload;          struct loadavg sysload;
         struct vmtotal vmtotal;          struct vmtotal vmtotal;
           struct bcachestats bcstats;
         double *infoloadp;          double *infoloadp;
         size_t size;          size_t size;
         int i;          int i;
Line 254 
Line 258 
                 warn("sysctl failed");                  warn("sysctl failed");
                 bzero(&vmtotal, sizeof(vmtotal));                  bzero(&vmtotal, sizeof(vmtotal));
         }          }
           size = sizeof(bcstats);
           if (sysctl(bcstats_mib, 3, &bcstats, &size, NULL, 0) < 0) {
                   warn("sysctl failed");
                   bzero(&bcstats, sizeof(bcstats));
           }
         /* convert memory stats to Kbytes */          /* convert memory stats to Kbytes */
         memory_stats[0] = -1;          memory_stats[0] = -1;
         memory_stats[1] = pagetok(vmtotal.t_arm);          memory_stats[1] = pagetok(vmtotal.t_arm);
Line 261 
Line 270 
         memory_stats[3] = -1;          memory_stats[3] = -1;
         memory_stats[4] = pagetok(vmtotal.t_free);          memory_stats[4] = pagetok(vmtotal.t_free);
         memory_stats[5] = -1;          memory_stats[5] = -1;
           memory_stats[6] = pagetok(bcstats.numbufpages);
           memory_stats[7] = -1;
   
         if (!swapmode(&memory_stats[6], &memory_stats[7])) {          if (!swapmode(&memory_stats[8], &memory_stats[9])) {
                 memory_stats[6] = 0;                  memory_stats[8] = 0;
                 memory_stats[7] = 0;                  memory_stats[9] = 0;
         }          }
   
         /* set arrays and strings */          /* set arrays and strings */

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.69