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

Diff for /src/usr.bin/systat/iostat.c between version 1.22 and 1.23

version 1.22, 2004/02/15 02:45:47 version 1.23, 2004/02/15 22:56:12
Line 55 
Line 55 
 static  double etime;  static  double etime;
 static  int numbers = 0;                /* default display bar graphs */  static  int numbers = 0;                /* default display bar graphs */
 static  int secs = 0;                   /* default seconds shown */  static  int secs = 0;                   /* default seconds shown */
   static  int split = 0;                  /* whether to split r/w stats */
   
 static int barlabels(int);  static int barlabels(int);
 static void histogram(double, int, double);  static void histogram(double, int, double);
Line 126 
Line 127 
                 mvwaddstr(wnd, row++, INSET, "No drives attached.");                  mvwaddstr(wnd, row++, INSET, "No drives attached.");
                 return (row);                  return (row);
         }          }
 #define COLWIDTH        17  #define COLWIDTH        (split ? 30 : 17)
 #define DRIVESPERLINE   ((wnd->_maxx - INSET) / COLWIDTH)  #define DRIVESPERLINE   ((wnd->_maxx - INSET) / COLWIDTH)
         for (ndrives = 0, i = 0; i < cur.dk_ndrive; i++)          for (ndrives = 0, i = 0; i < cur.dk_ndrive; i++)
                 if (cur.dk_select[i])                  if (cur.dk_select[i])
Line 151 
Line 152 
                                         break;                                          break;
                         }                          }
                         mvwaddstr(wnd, row, col + 4, cur.dk_name[i]);                          mvwaddstr(wnd, row, col + 4, cur.dk_name[i]);
                         mvwaddstr(wnd, row + 1, col, " KBps tps  sec");                          if (split)
                                   mvwaddstr(wnd, row + 1, col, " rKBps wKBps "
                                       "rtps wtps  sec");
                           else
                                   mvwaddstr(wnd, row + 1, col, " KBps tps  sec");
                         col += COLWIDTH;                          col += COLWIDTH;
                 }                  }
         if (col)          if (col)
Line 175 
Line 180 
                 if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {                  if (cur.dk_select[i] /*&& cur.dk_bytes[i] != 0.0*/) {
                         if (row > wnd->_maxy - linesperregion)                          if (row > wnd->_maxy - linesperregion)
                                 break;                                  break;
                         mvwprintw(wnd, row++, 0, "%4.4s  Kps|", cur.dk_name[i]);                          if (split) {
                         mvwaddstr(wnd, row++, 0, "      tps|");                                  mvwprintw(wnd, row++, 0, "%4.4s rKps|",
                                       cur.dk_name[i]);
                                   mvwaddstr(wnd, row++, 0, "     wKps|");
                                   mvwaddstr(wnd, row++, 0, "     rtps|");
                                   mvwaddstr(wnd, row++, 0, "     wtps|");
                           } else {
                                   mvwprintw(wnd, row++, 0, "%4.4s  Kps|",
                                       cur.dk_name[i]);
                                   mvwaddstr(wnd, row++, 0, "      tps|");
                           }
                         if (secs)                          if (secs)
                                 mvwaddstr(wnd, row++, 0, "     msec|");                                  mvwaddstr(wnd, row++, 0, "     msec|");
                 }                  }
Line 246 
Line 260 
 static int  static int
 stats(int row, int col, int dn)  stats(int row, int col, int dn)
 {  {
         double atime, words;          double atime, rwords, wwords;
   
         /* time busy in disk activity */          /* time busy in disk activity */
         atime = (double)cur.dk_time[dn].tv_sec +          atime = (double)cur.dk_time[dn].tv_sec +
                 ((double)cur.dk_time[dn].tv_usec / (double)1000000);                  ((double)cur.dk_time[dn].tv_usec / (double)1000000);
   
         /* # of K transferred */          rwords = cur.dk_rbytes[dn] / 1024.0;    /* # of K read */
         words = (cur.dk_rbytes[dn] + cur.dk_wbytes[dn]) / 1024.0;          wwords = cur.dk_wbytes[dn] / 1024.0;    /* # of K written */
         if (numbers) {          if (numbers) {
                 mvwprintw(wnd, row, col, "%5.0f%4.0f%5.1f",                  if (split)
                     words / etime, (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) /                          mvwprintw(wnd, row, col, "%6.0f%6.0f%5.0f%5.0f%5.1f",
                     etime, atime / etime);                              rwords / etime, wwords / etime, cur.dk_rxfer[dn] /
                               etime, cur.dk_wxfer[dn] / etime, atime / etime);
                   else
                           mvwprintw(wnd, row, col, "%5.0f%4.0f%5.1f",
                               (rwords + wwords) / etime,
                               (cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime,
                               atime / etime);
                 return (row);                  return (row);
         }          }
         wmove(wnd, row++, col);          if (split) {
         histogram(words / etime, 50, 0.5);                  wmove(wnd, row++, col);
         wmove(wnd, row++, col);                  histogram(rwords / etime, 50, 0.5);
         histogram((cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime, 50, 0.5);                  wmove(wnd, row++, col);
                   histogram(wwords / etime, 50, 0.5);
                   wmove(wnd, row++, col);
                   histogram(cur.dk_rxfer[dn] / etime, 50, 0.5);
                   wmove(wnd, row++, col);
                   histogram(cur.dk_wxfer[dn] / etime, 50, 0.5);
           } else {
                   wmove(wnd, row++, col);
                   histogram((rwords + wwords) / etime, 50, 0.5);
                   wmove(wnd, row++, col);
                   histogram((cur.dk_rxfer[dn] + cur.dk_wxfer[dn]) / etime, 50,
                       0.5);
           }
         if (secs) {          if (secs) {
                 wmove(wnd, row++, col);                  wmove(wnd, row++, col);
                 atime *= 1000;  /* In milliseconds */                  atime *= 1000;  /* In milliseconds */
Line 316 
Line 348 
                 numbers = 1;                  numbers = 1;
         else if (prefix(cmd, "bars"))          else if (prefix(cmd, "bars"))
                 numbers = 0;                  numbers = 0;
           else if (prefix(cmd, "split"))
                   split = ~split;
         else if (!dkcmd(cmd, args))          else if (!dkcmd(cmd, args))
                 return (0);                  return (0);
         wclear(wnd);          wclear(wnd);

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23