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

Diff for /src/usr.bin/vmstat/vmstat.c between version 1.100 and 1.101

version 1.100, 2006/02/23 06:32:11 version 1.101, 2006/03/13 19:29:26
Line 120 
Line 120 
 #define VMSTAT          0x20  #define VMSTAT          0x20
   
 void    cpustats(void);  void    cpustats(void);
   time_t  getuptime(void);
 void    dkstats(void);  void    dkstats(void);
 void    dointr(void);  void    dointr(void);
 void    domem(void);  void    domem(void);
Line 131 
Line 132 
 void    usage(void);  void    usage(void);
 void    dotimes(void);  void    dotimes(void);
 void    doforkst(void);  void    doforkst(void);
   void    needhdr(int);
   int     pct(long, long);
 void    printhdr(void);  void    printhdr(void);
   
 char    **choosedrives(char **);  char    **choosedrives(char **);
Line 148 
Line 151 
 int  int
 main(int argc, char *argv[])  main(int argc, char *argv[])
 {  {
         extern int optind;  
         extern char *optarg;  
         int mib[2];          int mib[2];
         size_t size;          size_t size;
         int c, todo;          int c, todo;
Line 367 
Line 368 
 {  {
         struct vmtotal total;          struct vmtotal total;
         time_t uptime, halfuptime;          time_t uptime, halfuptime;
         void needhdr(int);  
         int mib[2];          int mib[2];
         struct clockinfo clkinfo;          struct clockinfo clkinfo;
         size_t size;          size_t size;
Line 692 
Line 692 
 cpustats(void)  cpustats(void)
 {  {
         int state;          int state;
         double pct, total;          double percent, total;
   
         total = 0;          total = 0;
         for (state = 0; state < CPUSTATES; ++state)          for (state = 0; state < CPUSTATES; ++state)
                 total += cur.cp_time[state];                  total += cur.cp_time[state];
         if (total)          if (total)
                 pct = 100 / total;                  percent = 100 / total;
         else          else
                 pct = 0;                  percent = 0;
         (void)printf("%2.0f ", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * pct);          (void)printf("%2.0f ", (cur.cp_time[CP_USER] + cur.cp_time[CP_NICE]) * percent);
         (void)printf("%2.0f ", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * pct);          (void)printf("%2.0f ", (cur.cp_time[CP_SYS] + cur.cp_time[CP_INTR]) * percent);
         (void)printf("%2.0f", cur.cp_time[CP_IDLE] * pct);          (void)printf("%2.0f", cur.cp_time[CP_IDLE] * percent);
 }  }
   
 void  void
Line 786 
Line 786 
 /*  /*
  * These names are defined in <sys/malloc.h>.   * These names are defined in <sys/malloc.h>.
  */   */
 char *kmemnames[] = INITKMEMNAMES;  const char *kmemnames[] = INITKMEMNAMES;
   
 void  void
 domem(void)  domem(void)
Line 797 
Line 797 
         int len, size, first;          int len, size, first;
         u_long totuse = 0, totfree = 0;          u_long totuse = 0, totfree = 0;
         quad_t totreq = 0;          quad_t totreq = 0;
         char *name;          const char *name;
         struct kmemstats kmemstats[M_LAST];          struct kmemstats kmemstats[M_LAST];
         struct kmembuckets buckets[MINBUCKET + 16];          struct kmembuckets buckets[MINBUCKET + 16];
         int mib[4];          int mib[4];

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.101