vmstat.c revision 69529
11590Srgrimes/*- 21590Srgrimes * Copyright (c) 1983, 1989, 1992, 1993 31590Srgrimes * The Regents of the University of California. All rights reserved. 41590Srgrimes * 51590Srgrimes * Redistribution and use in source and binary forms, with or without 61590Srgrimes * modification, are permitted provided that the following conditions 71590Srgrimes * are met: 81590Srgrimes * 1. Redistributions of source code must retain the above copyright 91590Srgrimes * notice, this list of conditions and the following disclaimer. 101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111590Srgrimes * notice, this list of conditions and the following disclaimer in the 121590Srgrimes * documentation and/or other materials provided with the distribution. 131590Srgrimes * 3. All advertising materials mentioning features or use of this software 141590Srgrimes * must display the following acknowledgement: 151590Srgrimes * This product includes software developed by the University of 161590Srgrimes * California, Berkeley and its contributors. 171590Srgrimes * 4. Neither the name of the University nor the names of its contributors 181590Srgrimes * may be used to endorse or promote products derived from this software 191590Srgrimes * without specific prior written permission. 201590Srgrimes * 211590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241590Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311590Srgrimes * SUCH DAMAGE. 321590Srgrimes */ 331590Srgrimes 341590Srgrimes#ifndef lint 3528149Scharnier#if 0 361590Srgrimesstatic char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94"; 3728149Scharnier#endif 3828149Scharnierstatic const char rcsid[] = 3950477Speter "$FreeBSD: head/usr.bin/systat/vmstat.c 69529 2000-12-02 20:08:33Z gallatin $"; 401590Srgrimes#endif /* not lint */ 411590Srgrimes 421590Srgrimes/* 431590Srgrimes * Cursed vmstat -- from Robert Elz. 441590Srgrimes */ 451590Srgrimes 461590Srgrimes#include <sys/param.h> 471590Srgrimes#include <sys/stat.h> 481590Srgrimes#include <sys/time.h> 491590Srgrimes#include <sys/proc.h> 5012811Sbde#include <sys/uio.h> 511590Srgrimes#include <sys/namei.h> 521590Srgrimes#include <sys/sysctl.h> 5339230Sgibbs#include <sys/dkstat.h> 5412805Speter#include <sys/vmmeter.h> 551590Srgrimes 5612811Sbde#include <vm/vm_param.h> 5712811Sbde 5828149Scharnier#include <ctype.h> 5928149Scharnier#include <err.h> 6059217Simp#include <errno.h> 611590Srgrimes#include <nlist.h> 621590Srgrimes#include <paths.h> 6328149Scharnier#include <signal.h> 6428149Scharnier#include <stdlib.h> 651590Srgrimes#include <string.h> 6614953Sache#include <time.h> 671590Srgrimes#include <unistd.h> 6828149Scharnier#include <utmp.h> 6939230Sgibbs#include <devstat.h> 701590Srgrimes#include "systat.h" 711590Srgrimes#include "extern.h" 7240060Sobrien#include "devs.h" 731590Srgrimes 741590Srgrimesstatic struct Info { 751590Srgrimes long time[CPUSTATES]; 761590Srgrimes struct vmmeter Cnt; 771590Srgrimes struct vmtotal Total; 781590Srgrimes struct nchstats nchstats; 791590Srgrimes long nchcount; 801590Srgrimes long *intrcnt; 8129842Speter int bufspace; 8229842Speter int desiredvnodes; 8369529Sgallatin long numvnodes; 8469529Sgallatin long freevnodes; 8549245Sdes long numdirtybuffers; 861590Srgrimes} s, s1, s2, z; 871590Srgrimes 8839230Sgibbsstruct statinfo cur, last, run; 8939230Sgibbs 901590Srgrimes#define cnt s.Cnt 911590Srgrimes#define oldcnt s1.Cnt 921590Srgrimes#define total s.Total 931590Srgrimes#define nchtotal s.nchstats 941590Srgrimes#define oldnchtotal s1.nchstats 951590Srgrimes 961590Srgrimesstatic enum state { BOOT, TIME, RUN } state = TIME; 971590Srgrimes 981590Srgrimesstatic void allocinfo __P((struct Info *)); 991590Srgrimesstatic void copyinfo __P((struct Info *, struct Info *)); 1001590Srgrimesstatic float cputime __P((int)); 10139230Sgibbsstatic void dinfo __P((int, int, struct statinfo *, struct statinfo *)); 1021590Srgrimesstatic void getinfo __P((struct Info *, enum state)); 1031590Srgrimesstatic void putint __P((int, int, int, int)); 1041590Srgrimesstatic void putfloat __P((double, int, int, int, int, int)); 10539230Sgibbsstatic void putlongdouble __P((long double, int, int, int, int, int)); 1061590Srgrimesstatic int ucount __P((void)); 1071590Srgrimes 10836430Sjhaystatic int ncpu; 1091590Srgrimesstatic int ut; 1101590Srgrimesstatic char buf[26]; 1111590Srgrimesstatic time_t t; 1121590Srgrimesstatic double etime; 1131590Srgrimesstatic int nintr; 1141590Srgrimesstatic long *intrloc; 1151590Srgrimesstatic char **intrname; 1161590Srgrimesstatic int nextintsrow; 11743756Sdillonstatic int extended_vm_stats; 1181590Srgrimes 1191590Srgrimesstruct utmp utmp; 1201590Srgrimes 1211590Srgrimes 1221590SrgrimesWINDOW * 1231590Srgrimesopenkre() 1241590Srgrimes{ 1251590Srgrimes 1261590Srgrimes ut = open(_PATH_UTMP, O_RDONLY); 1271590Srgrimes if (ut < 0) 1281590Srgrimes error("No utmp"); 1291590Srgrimes return (stdscr); 1301590Srgrimes} 1311590Srgrimes 1321590Srgrimesvoid 1331590Srgrimesclosekre(w) 1341590Srgrimes WINDOW *w; 1351590Srgrimes{ 1361590Srgrimes 1371590Srgrimes (void) close(ut); 1381590Srgrimes if (w == NULL) 1391590Srgrimes return; 1401590Srgrimes wclear(w); 1411590Srgrimes wrefresh(w); 1421590Srgrimes} 1431590Srgrimes 1441590Srgrimes 1451590Srgrimesstatic struct nlist namelist[] = { 14669143Srwatson#define X_CNT 0 1471590Srgrimes { "_cnt" }, 14869143Srwatson#define X_INTRNAMES 1 1491590Srgrimes { "_intrnames" }, 15069143Srwatson#define X_EINTRNAMES 2 1511590Srgrimes { "_eintrnames" }, 15269143Srwatson#define X_INTRCNT 3 1531590Srgrimes { "_intrcnt" }, 15469143Srwatson#define X_EINTRCNT 4 1551590Srgrimes { "_eintrcnt" }, 1561590Srgrimes { "" }, 1571590Srgrimes}; 1581590Srgrimes 1591590Srgrimes/* 1601590Srgrimes * These constants define where the major pieces are laid out 1611590Srgrimes */ 1621590Srgrimes#define STATROW 0 /* uses 1 row and 68 cols */ 1631590Srgrimes#define STATCOL 2 1641590Srgrimes#define MEMROW 2 /* uses 4 rows and 31 cols */ 1651590Srgrimes#define MEMCOL 0 1661590Srgrimes#define PAGEROW 2 /* uses 4 rows and 26 cols */ 16719687Sjkh#define PAGECOL 46 16819687Sjkh#define INTSROW 6 /* uses all rows to bottom and 17 cols */ 1697455Sdg#define INTSCOL 61 1701590Srgrimes#define PROCSROW 7 /* uses 2 rows and 20 cols */ 1711590Srgrimes#define PROCSCOL 0 1721590Srgrimes#define GENSTATROW 7 /* uses 2 rows and 30 cols */ 1731590Srgrimes#define GENSTATCOL 20 1744808Sdg#define VMSTATROW 6 /* uses 17 rows and 12 cols */ 1751590Srgrimes#define VMSTATCOL 48 1761590Srgrimes#define GRAPHROW 10 /* uses 3 rows and 51 cols */ 1771590Srgrimes#define GRAPHCOL 0 1781590Srgrimes#define NAMEIROW 14 /* uses 3 rows and 38 cols */ 1791590Srgrimes#define NAMEICOL 0 1801590Srgrimes#define DISKROW 18 /* uses 5 rows and 50 cols (for 9 drives) */ 1811590Srgrimes#define DISKCOL 0 1821590Srgrimes 18339230Sgibbs#define DRIVESPACE 7 /* max # for space */ 1841590Srgrimes 1851590Srgrimes#define MAXDRIVES DRIVESPACE /* max # to display */ 1861590Srgrimes 1871590Srgrimesint 1881590Srgrimesinitkre() 1891590Srgrimes{ 1901590Srgrimes char *intrnamebuf, *cp; 1911590Srgrimes int i; 1921590Srgrimes 1931590Srgrimes if (namelist[0].n_type == 0) { 1941590Srgrimes if (kvm_nlist(kd, namelist)) { 1951590Srgrimes nlisterr(namelist); 1961590Srgrimes return(0); 1971590Srgrimes } 1981590Srgrimes if (namelist[0].n_type == 0) { 1991590Srgrimes error("No namelist"); 2001590Srgrimes return(0); 2011590Srgrimes } 2021590Srgrimes } 20339230Sgibbs 20439230Sgibbs if (num_devices = getnumdevs() < 0) { 20539230Sgibbs warnx("%s", devstat_errbuf); 2061590Srgrimes return(0); 2071590Srgrimes } 20839230Sgibbs 20939230Sgibbs cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); 21039230Sgibbs last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); 21139230Sgibbs run.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo)); 21239230Sgibbs bzero(cur.dinfo, sizeof(struct devinfo)); 21339230Sgibbs bzero(last.dinfo, sizeof(struct devinfo)); 21439230Sgibbs bzero(run.dinfo, sizeof(struct devinfo)); 21539230Sgibbs 21639230Sgibbs if (dsinit(MAXDRIVES, &cur, &last, &run) != 1) 21739230Sgibbs return(0); 21839230Sgibbs 2191590Srgrimes if (nintr == 0) { 2201590Srgrimes nintr = (namelist[X_EINTRCNT].n_value - 2211590Srgrimes namelist[X_INTRCNT].n_value) / sizeof (long); 2221590Srgrimes intrloc = calloc(nintr, sizeof (long)); 2231590Srgrimes intrname = calloc(nintr, sizeof (long)); 2241590Srgrimes intrnamebuf = malloc(namelist[X_EINTRNAMES].n_value - 2251590Srgrimes namelist[X_INTRNAMES].n_value); 2261590Srgrimes if (intrnamebuf == 0 || intrname == 0 || intrloc == 0) { 2271590Srgrimes error("Out of memory\n"); 2281590Srgrimes if (intrnamebuf) 2291590Srgrimes free(intrnamebuf); 2301590Srgrimes if (intrname) 2311590Srgrimes free(intrname); 2321590Srgrimes if (intrloc) 2331590Srgrimes free(intrloc); 2341590Srgrimes nintr = 0; 2351590Srgrimes return(0); 2361590Srgrimes } 2371590Srgrimes NREAD(X_INTRNAMES, intrnamebuf, NVAL(X_EINTRNAMES) - 2381590Srgrimes NVAL(X_INTRNAMES)); 2391590Srgrimes for (cp = intrnamebuf, i = 0; i < nintr; i++) { 2401590Srgrimes intrname[i] = cp; 2411590Srgrimes cp += strlen(cp) + 1; 2421590Srgrimes } 2431590Srgrimes nextintsrow = INTSROW + 2; 2441590Srgrimes allocinfo(&s); 2451590Srgrimes allocinfo(&s1); 2461590Srgrimes allocinfo(&s2); 2471590Srgrimes allocinfo(&z); 2481590Srgrimes } 2491590Srgrimes getinfo(&s2, RUN); 2501590Srgrimes copyinfo(&s2, &s1); 2511590Srgrimes return(1); 2521590Srgrimes} 2531590Srgrimes 2541590Srgrimesvoid 2551590Srgrimesfetchkre() 2561590Srgrimes{ 2571590Srgrimes time_t now; 25814953Sache struct tm *tp; 2591590Srgrimes 2601590Srgrimes time(&now); 26114953Sache tp = localtime(&now); 26214953Sache (void) strftime(buf, sizeof(buf), "%c", tp); 2631590Srgrimes buf[16] = '\0'; 2641590Srgrimes getinfo(&s, state); 2651590Srgrimes} 2661590Srgrimes 2671590Srgrimesvoid 2681590Srgrimeslabelkre() 2691590Srgrimes{ 2701590Srgrimes register int i, j; 2711590Srgrimes 2721590Srgrimes clear(); 2731590Srgrimes mvprintw(STATROW, STATCOL + 4, "users Load"); 27419687Sjkh mvprintw(MEMROW, MEMCOL, "Mem:KB REAL VIRTUAL"); 27519687Sjkh mvprintw(MEMROW + 1, MEMCOL, " Tot Share Tot Share"); 2761590Srgrimes mvprintw(MEMROW + 2, MEMCOL, "Act"); 2771590Srgrimes mvprintw(MEMROW + 3, MEMCOL, "All"); 2781590Srgrimes 27919687Sjkh mvprintw(MEMROW + 1, MEMCOL + 41, "Free"); 2801590Srgrimes 2813614Sdg mvprintw(PAGEROW, PAGECOL, " VN PAGER SWAP PAGER "); 2823614Sdg mvprintw(PAGEROW + 1, PAGECOL, " in out in out "); 2831590Srgrimes mvprintw(PAGEROW + 2, PAGECOL, "count"); 2841590Srgrimes mvprintw(PAGEROW + 3, PAGECOL, "pages"); 2851590Srgrimes 2861590Srgrimes mvprintw(INTSROW, INTSCOL + 3, " Interrupts"); 2871590Srgrimes mvprintw(INTSROW + 1, INTSCOL + 9, "total"); 2881590Srgrimes 28943756Sdillon mvprintw(VMSTATROW + 1, VMSTATCOL + 10, "cow"); 2907351Sdg mvprintw(VMSTATROW + 2, VMSTATCOL + 10, "wire"); 2917351Sdg mvprintw(VMSTATROW + 3, VMSTATCOL + 10, "act"); 2927351Sdg mvprintw(VMSTATROW + 4, VMSTATCOL + 10, "inact"); 2937351Sdg mvprintw(VMSTATROW + 5, VMSTATCOL + 10, "cache"); 2947351Sdg mvprintw(VMSTATROW + 6, VMSTATCOL + 10, "free"); 2957351Sdg mvprintw(VMSTATROW + 7, VMSTATCOL + 10, "daefr"); 2967351Sdg mvprintw(VMSTATROW + 8, VMSTATCOL + 10, "prcfr"); 2977351Sdg mvprintw(VMSTATROW + 9, VMSTATCOL + 10, "react"); 2987351Sdg mvprintw(VMSTATROW + 10, VMSTATCOL + 10, "pdwake"); 2997351Sdg mvprintw(VMSTATROW + 11, VMSTATCOL + 10, "pdpgs"); 3007351Sdg mvprintw(VMSTATROW + 12, VMSTATCOL + 10, "intrn"); 3017351Sdg mvprintw(VMSTATROW + 13, VMSTATCOL + 10, "buf"); 30249245Sdes mvprintw(VMSTATROW + 14, VMSTATCOL + 10, "dirtybuf"); 3031590Srgrimes 30449245Sdes mvprintw(VMSTATROW + 15, VMSTATCOL + 10, "desiredvnodes"); 30549245Sdes mvprintw(VMSTATROW + 16, VMSTATCOL + 10, "numvnodes"); 30649245Sdes mvprintw(VMSTATROW + 17, VMSTATCOL + 10, "freevnodes"); 30729842Speter 3081590Srgrimes mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt"); 3091590Srgrimes 3101590Srgrimes mvprintw(GRAPHROW, GRAPHCOL, 3114930Sbde " . %%Sys . %%Intr . %%User . %%Nice . %%Idle"); 3121590Srgrimes mvprintw(PROCSROW, PROCSCOL, "Proc:r p d s w"); 3131590Srgrimes mvprintw(GRAPHROW + 1, GRAPHCOL, 3141590Srgrimes "| | | | | | | | | | |"); 3151590Srgrimes 31614918Sbde mvprintw(NAMEIROW, NAMEICOL, "Namei Name-cache Dir-cache"); 3171590Srgrimes mvprintw(NAMEIROW + 1, NAMEICOL, 31814918Sbde " Calls hits %% hits %%"); 31951421Sgreen mvprintw(DISKROW, DISKCOL, "Disks"); 32039230Sgibbs mvprintw(DISKROW + 1, DISKCOL, "KB/t"); 32139230Sgibbs mvprintw(DISKROW + 2, DISKCOL, "tps"); 32239230Sgibbs mvprintw(DISKROW + 3, DISKCOL, "MB/s"); 32349245Sdes mvprintw(DISKROW + 4, DISKCOL, "%% busy"); 32439230Sgibbs /* 32539230Sgibbs * For now, we don't support a fourth disk statistic. So there's 32639230Sgibbs * no point in providing a label for it. If someone can think of a 32739230Sgibbs * fourth useful disk statistic, there is room to add it. 32839230Sgibbs */ 32939230Sgibbs /* mvprintw(DISKROW + 4, DISKCOL, " msps"); */ 3301590Srgrimes j = 0; 33139230Sgibbs for (i = 0; i < num_devices && j < MAXDRIVES; i++) 33239230Sgibbs if (dev_select[i].selected) { 33339230Sgibbs char tmpstr[80]; 33439230Sgibbs sprintf(tmpstr, "%s%d", dev_select[i].device_name, 33539230Sgibbs dev_select[i].unit_number); 33639230Sgibbs mvprintw(DISKROW, DISKCOL + 5 + 6 * j, 33739230Sgibbs " %5.5s", tmpstr); 3381590Srgrimes j++; 3391590Srgrimes } 34043756Sdillon 34143756Sdillon if (j <= 4) { 34243756Sdillon /* 34343756Sdillon * room for extended VM stats 34443756Sdillon */ 34543756Sdillon mvprintw(VMSTATROW + 11, VMSTATCOL - 6, "zfod"); 34643757Sdillon mvprintw(VMSTATROW + 12, VMSTATCOL - 6, "ofod"); 34743757Sdillon mvprintw(VMSTATROW + 13, VMSTATCOL - 6, "%%slo-z"); 34843757Sdillon mvprintw(VMSTATROW + 14, VMSTATCOL - 6, "tfree"); 34943756Sdillon extended_vm_stats = 1; 35043756Sdillon } else { 35143756Sdillon extended_vm_stats = 0; 35243756Sdillon mvprintw(VMSTATROW + 0, VMSTATCOL + 10, "zfod"); 35343756Sdillon } 35443756Sdillon 3551590Srgrimes for (i = 0; i < nintr; i++) { 3561590Srgrimes if (intrloc[i] == 0) 3571590Srgrimes continue; 3587455Sdg mvprintw(intrloc[i], INTSCOL + 9, "%-10.10s", intrname[i]); 3591590Srgrimes } 3601590Srgrimes} 3611590Srgrimes 3621590Srgrimes#define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;} 36339230Sgibbs#define Q(fld) {t=cur.fld[i]; cur.fld[i]-=last.fld[i]; if(state==TIME) last.fld[i]=t;} 3641590Srgrimes#define Y(fld) {t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;} 3651590Srgrimes#define Z(fld) {t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \ 3661590Srgrimes if(state == TIME) s1.nchstats.fld = t;} 3671590Srgrimes#define PUTRATE(fld, l, c, w) \ 3681590Srgrimes Y(fld); \ 3691590Srgrimes putint((int)((float)s.fld/etime + 0.5), l, c, w) 3701590Srgrimes#define MAXFAIL 5 3711590Srgrimes 3724930Sbdestatic char cpuchar[CPUSTATES] = { '=' , '+', '>', '-', ' ' }; 3734930Sbdestatic char cpuorder[CPUSTATES] = { CP_SYS, CP_INTR, CP_USER, CP_NICE, 3744930Sbde CP_IDLE }; 3751590Srgrimes 3761590Srgrimesvoid 3771590Srgrimesshowkre() 3781590Srgrimes{ 3791590Srgrimes float f1, f2; 3801590Srgrimes int psiz, inttotal; 3811590Srgrimes int i, l, c; 3821590Srgrimes static int failcnt = 0; 3831590Srgrimes 3841590Srgrimes etime = 0; 3851590Srgrimes for(i = 0; i < CPUSTATES; i++) { 3861590Srgrimes X(time); 38739230Sgibbs Q(cp_time); 3881590Srgrimes etime += s.time[i]; 3891590Srgrimes } 3901590Srgrimes if (etime < 5.0) { /* < 5 ticks - ignore this trash */ 3911590Srgrimes if (failcnt++ >= MAXFAIL) { 3921590Srgrimes clear(); 3931590Srgrimes mvprintw(2, 10, "The alternate system clock has died!"); 3941590Srgrimes mvprintw(3, 10, "Reverting to ``pigs'' display."); 3951590Srgrimes move(CMDLINE, 0); 3961590Srgrimes refresh(); 3971590Srgrimes failcnt = 0; 3981590Srgrimes sleep(5); 3991590Srgrimes command("pigs"); 4001590Srgrimes } 4011590Srgrimes return; 4021590Srgrimes } 4031590Srgrimes failcnt = 0; 4041590Srgrimes etime /= hertz; 40536430Sjhay etime /= ncpu; 4061590Srgrimes inttotal = 0; 4071590Srgrimes for (i = 0; i < nintr; i++) { 4081590Srgrimes if (s.intrcnt[i] == 0) 4091590Srgrimes continue; 4101590Srgrimes if (intrloc[i] == 0) { 4111590Srgrimes if (nextintsrow == LINES) 4121590Srgrimes continue; 4131590Srgrimes intrloc[i] = nextintsrow++; 4147455Sdg mvprintw(intrloc[i], INTSCOL + 9, "%-10.10s", 4151590Srgrimes intrname[i]); 4161590Srgrimes } 4171590Srgrimes X(intrcnt); 4181590Srgrimes l = (int)((float)s.intrcnt[i]/etime + 0.5); 4191590Srgrimes inttotal += l; 4207455Sdg putint(l, intrloc[i], INTSCOL + 2, 6); 4211590Srgrimes } 4227455Sdg putint(inttotal, INTSROW + 1, INTSCOL + 2, 6); 4231590Srgrimes Z(ncs_goodhits); Z(ncs_badhits); Z(ncs_miss); 4247138Sphk Z(ncs_long); Z(ncs_pass2); Z(ncs_2passes); Z(ncs_neghits); 4251590Srgrimes s.nchcount = nchtotal.ncs_goodhits + nchtotal.ncs_badhits + 4267012Sphk nchtotal.ncs_miss + nchtotal.ncs_long + nchtotal.ncs_neghits; 4271590Srgrimes if (state == TIME) 4281590Srgrimes s1.nchcount = s.nchcount; 4291590Srgrimes 4301590Srgrimes psiz = 0; 4311590Srgrimes f2 = 0.0; 4324930Sbde for (c = 0; c < CPUSTATES; c++) { 4331590Srgrimes i = cpuorder[c]; 4341590Srgrimes f1 = cputime(i); 4351590Srgrimes f2 += f1; 4361590Srgrimes l = (int) ((f2 + 1.0) / 2.0) - psiz; 4374930Sbde if (f1 > 99.9) 4384930Sbde f1 = 99.9; /* no room to display 100.0 */ 4394930Sbde putfloat(f1, GRAPHROW, GRAPHCOL + 10 * c, 4, 1, 0); 4401590Srgrimes move(GRAPHROW + 2, psiz); 4411590Srgrimes psiz += l; 4421590Srgrimes while (l-- > 0) 4431590Srgrimes addch(cpuchar[c]); 4441590Srgrimes } 4451590Srgrimes 4461590Srgrimes putint(ucount(), STATROW, STATCOL, 3); 4471590Srgrimes putfloat(avenrun[0], STATROW, STATCOL + 17, 6, 2, 0); 4481590Srgrimes putfloat(avenrun[1], STATROW, STATCOL + 23, 6, 2, 0); 4491590Srgrimes putfloat(avenrun[2], STATROW, STATCOL + 29, 6, 2, 0); 4501590Srgrimes mvaddstr(STATROW, STATCOL + 53, buf); 4511590Srgrimes#define pgtokb(pg) ((pg) * cnt.v_page_size / 1024) 45219687Sjkh putint(pgtokb(total.t_arm), MEMROW + 2, MEMCOL + 3, 8); 45319687Sjkh putint(pgtokb(total.t_armshr), MEMROW + 2, MEMCOL + 11, 8); 45419687Sjkh putint(pgtokb(total.t_avm), MEMROW + 2, MEMCOL + 19, 9); 45519687Sjkh putint(pgtokb(total.t_avmshr), MEMROW + 2, MEMCOL + 28, 9); 45619687Sjkh putint(pgtokb(total.t_rm), MEMROW + 3, MEMCOL + 3, 8); 45719687Sjkh putint(pgtokb(total.t_rmshr), MEMROW + 3, MEMCOL + 11, 8); 45819687Sjkh putint(pgtokb(total.t_vm), MEMROW + 3, MEMCOL + 19, 9); 45919687Sjkh putint(pgtokb(total.t_vmshr), MEMROW + 3, MEMCOL + 28, 9); 46019687Sjkh putint(pgtokb(total.t_free), MEMROW + 2, MEMCOL + 37, 8); 4611590Srgrimes putint(total.t_rq - 1, PROCSROW + 1, PROCSCOL + 3, 3); 4621590Srgrimes putint(total.t_pw, PROCSROW + 1, PROCSCOL + 6, 3); 4631590Srgrimes putint(total.t_dw, PROCSROW + 1, PROCSCOL + 9, 3); 4641590Srgrimes putint(total.t_sl, PROCSROW + 1, PROCSCOL + 12, 3); 4651590Srgrimes putint(total.t_sw, PROCSROW + 1, PROCSCOL + 15, 3); 46643756Sdillon if (extended_vm_stats == 0) { 46743756Sdillon PUTRATE(Cnt.v_zfod, VMSTATROW + 0, VMSTATCOL + 4, 5); 46843756Sdillon } 46943756Sdillon PUTRATE(Cnt.v_cow_faults, VMSTATROW + 1, VMSTATCOL + 3, 6); 4707351Sdg putint(pgtokb(cnt.v_wire_count), VMSTATROW + 2, VMSTATCOL, 9); 4717351Sdg putint(pgtokb(cnt.v_active_count), VMSTATROW + 3, VMSTATCOL, 9); 4727351Sdg putint(pgtokb(cnt.v_inactive_count), VMSTATROW + 4, VMSTATCOL, 9); 4737351Sdg putint(pgtokb(cnt.v_cache_count), VMSTATROW + 5, VMSTATCOL, 9); 4747351Sdg putint(pgtokb(cnt.v_free_count), VMSTATROW + 6, VMSTATCOL, 9); 4757351Sdg PUTRATE(Cnt.v_dfree, VMSTATROW + 7, VMSTATCOL, 9); 4767351Sdg PUTRATE(Cnt.v_pfree, VMSTATROW + 8, VMSTATCOL, 9); 4777351Sdg PUTRATE(Cnt.v_reactivated, VMSTATROW + 9, VMSTATCOL, 9); 4787351Sdg PUTRATE(Cnt.v_pdwakeups, VMSTATROW + 10, VMSTATCOL, 9); 4797351Sdg PUTRATE(Cnt.v_pdpages, VMSTATROW + 11, VMSTATCOL, 9); 4807351Sdg PUTRATE(Cnt.v_intrans, VMSTATROW + 12, VMSTATCOL, 9); 48143756Sdillon 48243756Sdillon if (extended_vm_stats) { 48343756Sdillon PUTRATE(Cnt.v_zfod, VMSTATROW + 11, VMSTATCOL - 16, 9); 48443757Sdillon PUTRATE(Cnt.v_ozfod, VMSTATROW + 12, VMSTATCOL - 16, 9); 48543756Sdillon putint( 48643756Sdillon ((s.Cnt.v_ozfod < s.Cnt.v_zfod) ? 48743756Sdillon s.Cnt.v_ozfod * 100 / s.Cnt.v_zfod : 48843756Sdillon 0 48943756Sdillon ), 49043757Sdillon VMSTATROW + 13, 49143756Sdillon VMSTATCOL - 16, 49243756Sdillon 9 49343756Sdillon ); 49443757Sdillon PUTRATE(Cnt.v_tfree, VMSTATROW + 14, VMSTATCOL - 16, 9); 49543756Sdillon } 49643756Sdillon 4977351Sdg putint(s.bufspace/1024, VMSTATROW + 13, VMSTATCOL, 9); 49849245Sdes putint(s.numdirtybuffers, VMSTATROW + 14, VMSTATCOL, 9); 49949245Sdes putint(s.desiredvnodes, VMSTATROW + 15, VMSTATCOL, 9); 50049245Sdes putint(s.numvnodes, VMSTATROW + 16, VMSTATCOL, 9); 50149245Sdes putint(s.freevnodes, VMSTATROW + 17, VMSTATCOL, 9); 5023614Sdg PUTRATE(Cnt.v_vnodein, PAGEROW + 2, PAGECOL + 5, 5); 5033614Sdg PUTRATE(Cnt.v_vnodeout, PAGEROW + 2, PAGECOL + 10, 5); 5043614Sdg PUTRATE(Cnt.v_swapin, PAGEROW + 2, PAGECOL + 17, 5); 5053614Sdg PUTRATE(Cnt.v_swapout, PAGEROW + 2, PAGECOL + 22, 5); 5063614Sdg PUTRATE(Cnt.v_vnodepgsin, PAGEROW + 3, PAGECOL + 5, 5); 5073614Sdg PUTRATE(Cnt.v_vnodepgsout, PAGEROW + 3, PAGECOL + 10, 5); 5083614Sdg PUTRATE(Cnt.v_swappgsin, PAGEROW + 3, PAGECOL + 17, 5); 5093614Sdg PUTRATE(Cnt.v_swappgsout, PAGEROW + 3, PAGECOL + 22, 5); 5101590Srgrimes PUTRATE(Cnt.v_swtch, GENSTATROW + 1, GENSTATCOL, 5); 5111590Srgrimes PUTRATE(Cnt.v_trap, GENSTATROW + 1, GENSTATCOL + 5, 5); 5121590Srgrimes PUTRATE(Cnt.v_syscall, GENSTATROW + 1, GENSTATCOL + 10, 5); 5131590Srgrimes PUTRATE(Cnt.v_intr, GENSTATROW + 1, GENSTATCOL + 15, 5); 5141590Srgrimes PUTRATE(Cnt.v_soft, GENSTATROW + 1, GENSTATCOL + 20, 5); 5153614Sdg PUTRATE(Cnt.v_vm_faults, GENSTATROW + 1, GENSTATCOL + 25, 5); 5161590Srgrimes mvprintw(DISKROW, DISKCOL + 5, " "); 51739230Sgibbs for (i = 0, c = 0; i < num_devices && c < MAXDRIVES; i++) 51839230Sgibbs if (dev_select[i].selected) { 51939230Sgibbs char tmpstr[80]; 52039230Sgibbs sprintf(tmpstr, "%s%d", dev_select[i].device_name, 52139230Sgibbs dev_select[i].unit_number); 52239230Sgibbs mvprintw(DISKROW, DISKCOL + 5 + 6 * c, 52339230Sgibbs " %5.5s", tmpstr); 52439230Sgibbs switch(state) { 52539230Sgibbs case TIME: 52639230Sgibbs dinfo(i, ++c, &cur, &last); 52739230Sgibbs break; 52839230Sgibbs case RUN: 52939230Sgibbs dinfo(i, ++c, &cur, &run); 53039230Sgibbs break; 53139230Sgibbs case BOOT: 53239230Sgibbs dinfo(i, ++c, &cur, NULL); 53339230Sgibbs break; 53439230Sgibbs } 5351590Srgrimes } 5361590Srgrimes putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9); 5377012Sphk putint((nchtotal.ncs_goodhits + nchtotal.ncs_neghits), 5387012Sphk NAMEIROW + 2, NAMEICOL + 9, 9); 5391590Srgrimes#define nz(x) ((x) ? (x) : 1) 5408874Srgrimes putfloat((nchtotal.ncs_goodhits+nchtotal.ncs_neghits) * 5417012Sphk 100.0 / nz(s.nchcount), 5421590Srgrimes NAMEIROW + 2, NAMEICOL + 19, 4, 0, 1); 5431590Srgrimes putint(nchtotal.ncs_pass2, NAMEIROW + 2, NAMEICOL + 23, 9); 5441590Srgrimes putfloat(nchtotal.ncs_pass2 * 100.0 / nz(s.nchcount), 54514918Sbde NAMEIROW + 2, NAMEICOL + 33, 4, 0, 1); 5461590Srgrimes#undef nz 5471590Srgrimes} 5481590Srgrimes 5491590Srgrimesint 5501590Srgrimescmdkre(cmd, args) 5511590Srgrimes char *cmd, *args; 5521590Srgrimes{ 55339230Sgibbs int retval; 5541590Srgrimes 5551590Srgrimes if (prefix(cmd, "run")) { 55639230Sgibbs retval = 1; 5571590Srgrimes copyinfo(&s2, &s1); 55839230Sgibbs switch (getdevs(&run)) { 55939230Sgibbs case -1: 56039230Sgibbs errx(1, "%s", devstat_errbuf); 56139230Sgibbs break; 56239230Sgibbs case 1: 56339230Sgibbs num_devices = run.dinfo->numdevs; 56439230Sgibbs generation = run.dinfo->generation; 56539230Sgibbs retval = dscmd("refresh", NULL, MAXDRIVES, &cur); 56639230Sgibbs if (retval == 2) 56739230Sgibbs labelkre(); 56839230Sgibbs break; 56939230Sgibbs default: 57039230Sgibbs break; 57139230Sgibbs } 5721590Srgrimes state = RUN; 57339230Sgibbs return (retval); 5741590Srgrimes } 5751590Srgrimes if (prefix(cmd, "boot")) { 5761590Srgrimes state = BOOT; 5771590Srgrimes copyinfo(&z, &s1); 5781590Srgrimes return (1); 5791590Srgrimes } 5801590Srgrimes if (prefix(cmd, "time")) { 5811590Srgrimes state = TIME; 5821590Srgrimes return (1); 5831590Srgrimes } 5841590Srgrimes if (prefix(cmd, "zero")) { 58539230Sgibbs retval = 1; 58639230Sgibbs if (state == RUN) { 5871590Srgrimes getinfo(&s1, RUN); 58839230Sgibbs switch (getdevs(&run)) { 58939230Sgibbs case -1: 59039230Sgibbs errx(1, "%s", devstat_errbuf); 59139230Sgibbs break; 59239230Sgibbs case 1: 59339230Sgibbs num_devices = run.dinfo->numdevs; 59439230Sgibbs generation = run.dinfo->generation; 59539230Sgibbs retval = dscmd("refresh",NULL, MAXDRIVES, &cur); 59639230Sgibbs if (retval == 2) 59739230Sgibbs labelkre(); 59839230Sgibbs break; 59939230Sgibbs default: 60039230Sgibbs break; 60139230Sgibbs } 60239230Sgibbs } 60339230Sgibbs return (retval); 6041590Srgrimes } 60539230Sgibbs retval = dscmd(cmd, args, MAXDRIVES, &cur); 60639230Sgibbs 60739230Sgibbs if (retval == 2) 60839230Sgibbs labelkre(); 60939230Sgibbs 61039230Sgibbs return(retval); 6111590Srgrimes} 6121590Srgrimes 6131590Srgrimes/* calculate number of users on the system */ 6141590Srgrimesstatic int 6151590Srgrimesucount() 6161590Srgrimes{ 6171590Srgrimes register int nusers = 0; 6181590Srgrimes 6191590Srgrimes if (ut < 0) 6201590Srgrimes return (0); 6211590Srgrimes while (read(ut, &utmp, sizeof(utmp))) 6221590Srgrimes if (utmp.ut_name[0] != '\0') 6231590Srgrimes nusers++; 6241590Srgrimes 6251590Srgrimes lseek(ut, 0L, L_SET); 6261590Srgrimes return (nusers); 6271590Srgrimes} 6281590Srgrimes 6291590Srgrimesstatic float 6301590Srgrimescputime(indx) 6311590Srgrimes int indx; 6321590Srgrimes{ 6331590Srgrimes double t; 6341590Srgrimes register int i; 6351590Srgrimes 6361590Srgrimes t = 0; 6371590Srgrimes for (i = 0; i < CPUSTATES; i++) 6381590Srgrimes t += s.time[i]; 6391590Srgrimes if (t == 0.0) 6401590Srgrimes t = 1.0; 6411590Srgrimes return (s.time[indx] * 100.0 / t); 6421590Srgrimes} 6431590Srgrimes 6441590Srgrimesstatic void 6451590Srgrimesputint(n, l, c, w) 6461590Srgrimes int n, l, c, w; 6471590Srgrimes{ 6481590Srgrimes char b[128]; 6491590Srgrimes 6501590Srgrimes move(l, c); 6511590Srgrimes if (n == 0) { 6521590Srgrimes while (w-- > 0) 6531590Srgrimes addch(' '); 6541590Srgrimes return; 6551590Srgrimes } 65636789Simp snprintf(b, sizeof(b), "%*d", w, n); 6571590Srgrimes if (strlen(b) > w) { 6581590Srgrimes while (w-- > 0) 6591590Srgrimes addch('*'); 6601590Srgrimes return; 6611590Srgrimes } 6621590Srgrimes addstr(b); 6631590Srgrimes} 6641590Srgrimes 6651590Srgrimesstatic void 6661590Srgrimesputfloat(f, l, c, w, d, nz) 6671590Srgrimes double f; 6681590Srgrimes int l, c, w, d, nz; 6691590Srgrimes{ 6701590Srgrimes char b[128]; 6711590Srgrimes 6721590Srgrimes move(l, c); 6731590Srgrimes if (nz && f == 0.0) { 6741590Srgrimes while (--w >= 0) 6751590Srgrimes addch(' '); 6761590Srgrimes return; 6771590Srgrimes } 67836789Simp snprintf(b, sizeof(b), "%*.*f", w, d, f); 67944935Sbde if (strlen(b) > w) 68044935Sbde snprintf(b, sizeof(b), "%*.0f", w, f); 6811590Srgrimes if (strlen(b) > w) { 6821590Srgrimes while (--w >= 0) 6831590Srgrimes addch('*'); 6841590Srgrimes return; 6851590Srgrimes } 6861590Srgrimes addstr(b); 6871590Srgrimes} 6881590Srgrimes 6891590Srgrimesstatic void 69039230Sgibbsputlongdouble(f, l, c, w, d, nz) 69139230Sgibbs long double f; 69239230Sgibbs int l, c, w, d, nz; 69339230Sgibbs{ 69439230Sgibbs char b[128]; 69539230Sgibbs 69639230Sgibbs move(l, c); 69739230Sgibbs if (nz && f == 0.0) { 69839230Sgibbs while (--w >= 0) 69939230Sgibbs addch(' '); 70039230Sgibbs return; 70139230Sgibbs } 70239230Sgibbs sprintf(b, "%*.*Lf", w, d, f); 70344935Sbde if (strlen(b) > w) 70444935Sbde sprintf(b, "%*.0Lf", w, f); 70539230Sgibbs if (strlen(b) > w) { 70639230Sgibbs while (--w >= 0) 70739230Sgibbs addch('*'); 70839230Sgibbs return; 70939230Sgibbs } 71039230Sgibbs addstr(b); 71139230Sgibbs} 71239230Sgibbs 71339230Sgibbsstatic void 7141590Srgrimesgetinfo(s, st) 7151590Srgrimes struct Info *s; 7161590Srgrimes enum state st; 7171590Srgrimes{ 71839230Sgibbs struct devinfo *tmp_dinfo; 71969492Sgallatin size_t len, size; 72069492Sgallatin int mib[2], err; 7211590Srgrimes 72269143Srwatson len = sizeof(s->time); 72369143Srwatson err = sysctlbyname("kern.cp_time", &s->time, &len, NULL, 0); 72469143Srwatson if (err || len != sizeof(s->time)) 72569143Srwatson perror("kern.cp_time"); 72669143Srwatson 72769143Srwatson len = sizeof(cur.cp_time); 72869143Srwatson err = sysctlbyname("kern.cp_time", &cur.cp_time, &len, NULL, 0); 72969143Srwatson if (err || len != sizeof(cur.cp_time)) 73069143Srwatson perror("kern.cp_time"); 73169143Srwatson 7321590Srgrimes NREAD(X_CNT, &s->Cnt, sizeof s->Cnt); 73369143Srwatson 73469143Srwatson len = sizeof(s->bufspace); 73569143Srwatson err = sysctlbyname("vfs.bufspace", &s->bufspace, &len, NULL, 0); 73669143Srwatson if (err || len != sizeof(s->bufspace)) 73769143Srwatson perror("vfs.bufspace"); 73869143Srwatson 73969143Srwatson len = sizeof(s->desiredvnodes); 74069143Srwatson err = sysctlbyname("kern.maxvnodes", &s->desiredvnodes, &len, NULL, 0); 74169143Srwatson if (err || len != sizeof(s->desiredvnodes)) 74269143Srwatson perror("kern.maxvnodes"); 74369143Srwatson 74469143Srwatson len = sizeof(s->numvnodes); 74569143Srwatson err = sysctlbyname("debug.numvnodes", &s->numvnodes, &len, NULL, 0); 74669143Srwatson if (err || len != sizeof(s->numvnodes)) 74769143Srwatson perror("debug.numvnodes"); 74869143Srwatson 74969143Srwatson len = sizeof(s->freevnodes); 75069143Srwatson err = sysctlbyname("debug.freevnodes", &s->freevnodes, &len, NULL, 0); 75169143Srwatson if (err || len != sizeof(s->freevnodes)) 75269143Srwatson perror("debug.freevnodes"); 75369143Srwatson 75469143Srwatson len = sizeof(s->nchstats); 75569143Srwatson err = sysctlbyname("vfs.cache.nchstats", &s->nchstats, &len, NULL, 0); 75669143Srwatson if (err || len != sizeof(s->nchstats)) 75769143Srwatson perror("vfs.cache.nchstats"); 75869143Srwatson 7591590Srgrimes NREAD(X_INTRCNT, s->intrcnt, nintr * LONG); 76069143Srwatson 76169143Srwatson len = sizeof(s->numdirtybuffers); 76269143Srwatson err = sysctlbyname("vfs.numdirtybuffers", &s->numdirtybuffers, &len, 76369143Srwatson NULL, 0); 76469143Srwatson 7651590Srgrimes size = sizeof(s->Total); 7661590Srgrimes mib[0] = CTL_VM; 7671590Srgrimes mib[1] = VM_METER; 7681590Srgrimes if (sysctl(mib, 2, &s->Total, &size, NULL, 0) < 0) { 7691590Srgrimes error("Can't get kernel info: %s\n", strerror(errno)); 7701590Srgrimes bzero(&s->Total, sizeof(s->Total)); 7711590Srgrimes } 77236430Sjhay size = sizeof(ncpu); 77369143Srwatson if (sysctlbyname("hw.ncpu", &ncpu, &size, NULL, 0) < 0 || 77469143Srwatson size != sizeof(ncpu)) 77536430Sjhay ncpu = 1; 77639230Sgibbs 77739230Sgibbs tmp_dinfo = last.dinfo; 77839230Sgibbs last.dinfo = cur.dinfo; 77939230Sgibbs cur.dinfo = tmp_dinfo; 78039230Sgibbs 78139230Sgibbs last.busy_time = cur.busy_time; 78239230Sgibbs switch (getdevs(&cur)) { 78339230Sgibbs case -1: 78439230Sgibbs errx(1, "%s", devstat_errbuf); 78539230Sgibbs break; 78639230Sgibbs case 1: 78739230Sgibbs num_devices = cur.dinfo->numdevs; 78839230Sgibbs generation = cur.dinfo->generation; 78939230Sgibbs cmdkre("refresh", NULL); 79039230Sgibbs break; 79139230Sgibbs default: 79239230Sgibbs break; 79339230Sgibbs } 7941590Srgrimes} 7951590Srgrimes 7961590Srgrimesstatic void 7971590Srgrimesallocinfo(s) 7981590Srgrimes struct Info *s; 7991590Srgrimes{ 8001590Srgrimes 80119598Sbde s->intrcnt = (long *) calloc(nintr, sizeof(long)); 80228149Scharnier if (s->intrcnt == NULL) 80328149Scharnier errx(2, "out of memory"); 8041590Srgrimes} 8051590Srgrimes 8061590Srgrimesstatic void 8071590Srgrimescopyinfo(from, to) 8081590Srgrimes register struct Info *from, *to; 8091590Srgrimes{ 8101590Srgrimes long *intrcnt; 8111590Srgrimes 8121590Srgrimes /* 8131590Srgrimes * time, wds, seek, and xfer are malloc'd so we have to 8148874Srgrimes * save the pointers before the structure copy and then 8151590Srgrimes * copy by hand. 8161590Srgrimes */ 81739230Sgibbs intrcnt = to->intrcnt; 8181590Srgrimes *to = *from; 81939230Sgibbs 8201590Srgrimes bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (int)); 8211590Srgrimes} 8221590Srgrimes 8231590Srgrimesstatic void 82439230Sgibbsdinfo(dn, c, now, then) 8251590Srgrimes int dn, c; 82639230Sgibbs struct statinfo *now, *then; 8271590Srgrimes{ 82839230Sgibbs long double transfers_per_second; 82939230Sgibbs long double kb_per_transfer, mb_per_second; 83049245Sdes long double elapsed_time, device_busy; 83139230Sgibbs int di; 8321590Srgrimes 83339230Sgibbs di = dev_select[dn].position; 83439230Sgibbs 83549245Sdes elapsed_time = compute_etime(now->busy_time, then ? 83639230Sgibbs then->busy_time : 83739967Sken now->dinfo->devices[di].dev_creation_time); 83839230Sgibbs 83949245Sdes device_busy = compute_etime(now->dinfo->devices[di].busy_time, then ? 84049245Sdes then->dinfo->devices[di].busy_time : 84149245Sdes now->dinfo->devices[di].dev_creation_time); 84249245Sdes 84339230Sgibbs if (compute_stats(&now->dinfo->devices[di], then ? 84449245Sdes &then->dinfo->devices[di] : NULL, elapsed_time, 84539230Sgibbs NULL, NULL, NULL, 84639230Sgibbs &kb_per_transfer, &transfers_per_second, 84739230Sgibbs &mb_per_second, NULL, NULL) != 0) 84839230Sgibbs errx(1, "%s", devstat_errbuf); 84939230Sgibbs 85049245Sdes if ((device_busy == 0) && (transfers_per_second > 5)) 85149245Sdes /* the device has been 100% busy, fake it because 85249245Sdes * as long as the device is 100% busy the busy_time 85349245Sdes * field in the devstat struct is not updated */ 85449245Sdes device_busy = elapsed_time; 85549245Sdes if (device_busy > elapsed_time) 85649245Sdes /* this normally happens after one or more periods 85749245Sdes * where the device has been 100% busy, correct it */ 85849245Sdes device_busy = elapsed_time; 85949245Sdes 86039230Sgibbs c = DISKCOL + c * 6; 86139230Sgibbs putlongdouble(kb_per_transfer, DISKROW + 1, c, 5, 2, 0); 86239230Sgibbs putlongdouble(transfers_per_second, DISKROW + 2, c, 5, 0, 0); 86339230Sgibbs putlongdouble(mb_per_second, DISKROW + 3, c, 5, 2, 0); 86449245Sdes putlongdouble(device_busy * 100 / elapsed_time, DISKROW + 4, c, 5, 0, 0); 8651590Srgrimes} 866