summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorgibbs <gibbs@FreeBSD.org>1998-09-15 08:16:45 +0000
committergibbs <gibbs@FreeBSD.org>1998-09-15 08:16:45 +0000
commitb954e9c2642216af00a08bacef1878dbfff8107d (patch)
treecc0e40580a3f167713ca8f61ac0e10a9c27433cc /usr.bin/systat
parent78f0dc839b3d746460e6fd2f0ffbb260bf45504c (diff)
downloadFreeBSD-src-b954e9c2642216af00a08bacef1878dbfff8107d.zip
FreeBSD-src-b954e9c2642216af00a08bacef1878dbfff8107d.tar.gz
Update system to new device statistics code.
Submitted by: "Kenneth D. Merry" <ken@plutotech.com>
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/devs.c320
-rw-r--r--usr.bin/systat/extern.h7
-rw-r--r--usr.bin/systat/iostat.c255
-rw-r--r--usr.bin/systat/systat.140
-rw-r--r--usr.bin/systat/vmstat.c272
5 files changed, 681 insertions, 213 deletions
diff --git a/usr.bin/systat/devs.c b/usr.bin/systat/devs.c
new file mode 100644
index 0000000..42cc88a
--- /dev/null
+++ b/usr.bin/systat/devs.c
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 1998 Kenneth D. Merry.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+/*
+ * Some code and ideas taken from the old disks.c.
+ * static char sccsid[] = "@(#)disks.c 8.1 (Berkeley) 6/6/93";
+ */
+/*-
+ * Copyright (c) 1980, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/devicestat.h>
+#include <sys/dkstat.h>
+
+#include <string.h>
+#include <devstat.h>
+#include "systat.h"
+#include "extern.h"
+
+typedef enum {
+ DS_MATCHTYPE_NONE,
+ DS_MATCHTYPE_SPEC,
+ DS_MATCHTYPE_PATTERN
+} last_match_type;
+
+last_match_type last_type;
+struct device_selection *dev_select;
+int generation, num_devices, num_selected;
+int num_selections, select_generation;
+struct devstat_match *matches = NULL;
+int num_matches = 0;
+char **specified_devices;
+int num_devices_specified = 0;
+
+static int dsmatchselect(char *args, devstat_select_mode select_mode,
+ int maxshowdevs, struct statinfo *s1);
+static int dsselect(char *args, devstat_select_mode select_mode,
+ int maxshowdevs, struct statinfo *s1);
+
+int
+dsinit(int maxshowdevs, struct statinfo *s1, struct statinfo *s2,
+ struct statinfo *s3)
+{
+
+ /*
+ * Make sure that the userland devstat version matches the kernel
+ * devstat version. If not, exit and print a message informing
+ * the user of his mistake.
+ */
+ if (checkversion() < 0)
+ errx(1, "%s", devstat_errbuf);
+
+ generation = 0;
+ num_devices = 0;
+ num_selected = 0;
+ num_selections = 0;
+ select_generation = 0;
+ last_type = DS_MATCHTYPE_NONE;
+
+ if (getdevs(s1) == -1)
+ errx(1, "%s", devstat_errbuf);
+
+ num_devices = s1->dinfo->numdevs;
+ generation = s1->dinfo->generation;
+
+ dev_select = NULL;
+
+ /*
+ * At this point, selectdevs will almost surely indicate that the
+ * device list has changed, so we don't look for return values of 0
+ * or 1. If we get back -1, though, there is an error.
+ */
+ if (selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation, s1->dinfo->devices,
+ num_devices, NULL, 0, NULL, 0, DS_SELECT_ADD,
+ maxshowdevs, 0) == -1)
+ errx(1, "%s", devstat_errbuf);
+
+ return(1);
+}
+
+int
+dscmd(char *cmd, char *args, int maxshowdevs, struct statinfo *s1)
+{
+ int retval;
+
+ if (prefix(cmd, "display") || prefix(cmd, "add"))
+ return(dsselect(args, DS_SELECT_ADDONLY, maxshowdevs, s1));
+ if (prefix(cmd, "ignore") || prefix(cmd, "delete"))
+ return(dsselect(args, DS_SELECT_REMOVE, maxshowdevs, s1));
+ if (prefix(cmd, "show") || prefix(cmd, "only"))
+ return(dsselect(args, DS_SELECT_ONLY, maxshowdevs, s1));
+ if (prefix(cmd, "type") || prefix(cmd, "match"))
+ return(dsmatchselect(args, DS_SELECT_ONLY, maxshowdevs, s1));
+ if (prefix(cmd, "refresh")) {
+ retval = selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation,
+ s1->dinfo->devices, num_devices,
+ (last_type == DS_MATCHTYPE_PATTERN) ?
+ matches : NULL,
+ (last_type == DS_MATCHTYPE_PATTERN) ?
+ num_matches : 0,
+ (last_type == DS_MATCHTYPE_SPEC) ?
+ specified_devices : NULL,
+ (last_type == DS_MATCHTYPE_SPEC) ?
+ num_devices_specified : 0,
+ (last_type == DS_MATCHTYPE_NONE) ?
+ DS_SELECT_ADD : DS_SELECT_ADDONLY,
+ maxshowdevs, 0);
+ if (retval == -1) {
+ warnx("%s", devstat_errbuf);
+ return(0);
+ } else if (retval == 1)
+ return(2);
+ }
+ if (prefix(cmd, "drives")) {
+ register int i;
+ move(CMDLINE, 0);
+ clrtoeol();
+ for (i = 0; i < num_devices; i++) {
+ printw("%s%d ", s1->dinfo->devices[i].device_name,
+ s1->dinfo->devices[i].unit_number);
+ }
+ return(1);
+ }
+ return(0);
+}
+
+static int
+dsmatchselect(char *args, devstat_select_mode select_mode, int maxshowdevs,
+ struct statinfo *s1)
+{
+ char **tempstr;
+ char *tstr[100];
+ char *err_str;
+ int num_args = 0;
+ register int i;
+ int retval = 0;
+
+ /*
+ * Break the (pipe delimited) input string out into separate
+ * strings.
+ */
+ for (tempstr = tstr, num_args = 0;
+ (*tempstr = strsep(&args, "|")) != NULL && (num_args < 100);
+ num_args++)
+ if (**tempstr != '\0')
+ if (++tempstr >= &tstr[100])
+ break;
+
+ if (num_args > 99) {
+ warnx("dsmatchselect: too many match arguments");
+ return(0);
+ }
+
+ /*
+ * If we've gone through the matching code before, clean out
+ * previously used memory.
+ */
+ if (num_matches > 0) {
+ free(matches);
+ matches = NULL;
+ num_matches = 0;
+ }
+
+ for (i = 0; i < num_args; i++) {
+ if (buildmatch(tstr[i], &matches, &num_matches) != 0) {
+ warnx("%s", devstat_errbuf);
+ return(0);
+ }
+ }
+ if (num_args > 0) {
+
+ last_type = DS_MATCHTYPE_PATTERN;
+
+ retval = selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation,
+ s1->dinfo->devices, num_devices, matches,
+ num_matches, NULL, 0, select_mode,
+ maxshowdevs, 0);
+ if (retval == -1)
+ err(1, "device selection error");
+ else if (retval == 1)
+ return(2);
+ }
+ return(1);
+}
+
+static int
+dsselect(char *args, devstat_select_mode select_mode, int maxshowdevs,
+ struct statinfo *s1)
+{
+ register char *cp;
+ register int i;
+ int retval = 0;
+ char *index();
+
+ /*
+ * If we've gone through this code before, free previously
+ * allocated resources.
+ */
+ if (num_devices_specified > 0) {
+ for (i = 0; i < num_devices_specified; i++)
+ free(specified_devices[i]);
+ free(specified_devices);
+ specified_devices = NULL;
+ num_devices_specified = 0;
+ }
+
+ /* do an initial malloc */
+ specified_devices = (char **)malloc(sizeof(char *));
+
+ cp = index(args, '\n');
+ if (cp)
+ *cp = '\0';
+ for (;;) {
+ for (cp = args; *cp && isspace(*cp); cp++)
+ ;
+ args = cp;
+ for (; *cp && !isspace(*cp); cp++)
+ ;
+ if (*cp)
+ *cp++ = '\0';
+ if (cp - args == 0)
+ break;
+ for (i = 0; i < num_devices; i++) {
+ char tmpstr[80];
+
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ if (strcmp(args, tmpstr) == 0) {
+
+ num_devices_specified++;
+
+ specified_devices =(char **)realloc(
+ specified_devices,
+ sizeof(char *) *
+ num_devices_specified);
+ specified_devices[num_devices_specified -1]=
+ strdup(args);
+
+ break;
+ }
+ }
+ if (i >= num_devices)
+ error("%s: unknown drive", args);
+ args = cp;
+ }
+
+ if (num_devices_specified > 0) {
+ last_type = DS_MATCHTYPE_SPEC;
+
+ retval = selectdevs(&dev_select, &num_selected, &num_selections,
+ &select_generation, generation,
+ s1->dinfo->devices, num_devices, NULL, 0,
+ specified_devices, num_devices_specified,
+ select_mode, maxshowdevs, 0);
+ if (retval == -1)
+ err(1, "%s", devstat_errbuf);
+ else if (retval == 1)
+ return(2);
+ }
+ return(1);
+}
diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h
index c6d5812..3b44cd9 100644
--- a/usr.bin/systat/extern.h
+++ b/usr.bin/systat/extern.h
@@ -60,6 +60,13 @@ extern int verbose;
struct inpcb;
+extern struct device_selection *dev_select;
+extern int generation;
+extern int num_devices;
+extern int num_selected;
+extern int num_selections;
+extern int select_generation;
+
int checkhost __P((struct inpcb *));
int checkport __P((struct inpcb *));
void closeiostat __P((WINDOW *));
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index b2bd40d..5e6112c 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -1,4 +1,33 @@
/*
+ * Copyright (c) 1998 Kenneth D. Merry.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+/*
* Copyright (c) 1980, 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -36,28 +65,19 @@ static char sccsid[] = "@(#)iostat.c 8.1 (Berkeley) 6/6/93";
#endif not lint
#include <sys/param.h>
-#include <sys/dkstat.h>
#include <sys/buf.h>
+#include <sys/dkstat.h>
#include <string.h>
#include <stdlib.h>
#include <nlist.h>
#include <paths.h>
+#include <devstat.h>
#include "systat.h"
#include "extern.h"
static struct nlist namelist[] = {
-#define X_DK_BUSY 0
- { "_dk_busy" },
-#define X_DK_TIME 1
- { "_dk_time" },
-#define X_DK_XFER 2
- { "_dk_xfer" },
-#define X_DK_WDS 3
- { "_dk_wds" },
-#define X_DK_SEEK 4
- { "_dk_seek" },
-#define X_CP_TIME 5
+#define X_CP_TIME 0
{ "_cp_time" },
#ifdef vax
#define X_MBDINIT (X_CP_TIME+1)
@@ -72,27 +92,20 @@ static struct nlist namelist[] = {
{ "" },
};
-static struct {
- int dk_busy;
- long cp_time[CPUSTATES];
- long *dk_time;
- long *dk_wds;
- long *dk_seek;
- long *dk_xfer;
-} s, s1;
+struct statinfo cur, last;
static int linesperregion;
static double etime;
static int numbers = 0; /* default display bar graphs */
-static int msps = 0; /* default ms/seek shown */
+static int kbpt = 0; /* default ms/seek shown */
static int barlabels __P((int));
-static void histogram __P((double, int, double));
+static void histogram __P((long double, int, double));
static int numlabels __P((int));
+static int devstats __P((int, int, int));
static int stats __P((int, int, int));
static void stat1 __P((int, int));
-
WINDOW *
openiostat()
{
@@ -113,42 +126,61 @@ closeiostat(w)
int
initiostat()
{
- if (namelist[X_DK_BUSY].n_type == 0) {
- if (kvm_nlist(kd, namelist)) {
- nlisterr(namelist);
- return(0);
- }
- if (namelist[X_DK_BUSY].n_type == 0) {
- error("Disk init information isn't in namelist");
- return(0);
- }
- }
- if (! dkinit())
+ if (num_devices = getnumdevs() < 0)
+ return(0);
+
+ cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
+ last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
+ bzero(cur.dinfo, sizeof(struct devinfo));
+ bzero(last.dinfo, sizeof(struct devinfo));
+
+ /*
+ * This value for maxshowdevs (100) is bogus. I'm not sure exactly
+ * how to calculate it, though.
+ */
+ if (dsinit(100, &cur, &last, NULL) != 1)
+ return(0);
+
+ if (kvm_nlist(kd, namelist)) {
+ nlisterr(namelist);
return(0);
- if (dk_ndrive) {
-#define allocate(e, t) \
- s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
- s1./**/e = (t *)calloc(dk_ndrive, sizeof (t));
- allocate(dk_time, long);
- allocate(dk_wds, long);
- allocate(dk_seek, long);
- allocate(dk_xfer, long);
-#undef allocate
}
+
return(1);
}
void
fetchiostat()
{
- if (namelist[X_DK_BUSY].n_type == 0)
- return;
- NREAD(X_DK_BUSY, &s.dk_busy, sizeof(s.dk_busy));
- NREAD(X_DK_TIME, s.dk_time, dk_ndrive * LONG);
- NREAD(X_DK_XFER, s.dk_xfer, dk_ndrive * LONG);
- NREAD(X_DK_WDS, s.dk_wds, dk_ndrive * LONG);
- NREAD(X_DK_SEEK, s.dk_seek, dk_ndrive * LONG);
- NREAD(X_CP_TIME, s.cp_time, sizeof s.cp_time);
+ struct devinfo *tmp_dinfo;
+
+ NREAD(X_CP_TIME, cur.cp_time, sizeof(cur.cp_time));
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+
+ last.busy_time = cur.busy_time;
+
+ /*
+ * Here what we want to do is refresh our device stats.
+ * getdevs() returns 1 when the device list has changed.
+ * If the device list has changed, we want to go through
+ * the selection process again, in case a device that we
+ * were previously displaying has gone away.
+ */
+ switch (getdevs(&cur)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ cmdiostat("refresh", NULL);
+ break;
+ default:
+ break;
+ }
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+
}
#define INSET 10
@@ -158,10 +190,6 @@ labeliostat()
{
int row;
- if (namelist[X_DK_BUSY].n_type == 0) {
- error("No dk_busy defined.");
- return;
- }
row = 0;
wmove(wnd, row, 0); wclrtobot(wnd);
mvwaddstr(wnd, row++, INSET,
@@ -182,11 +210,12 @@ numlabels(row)
int row;
{
int i, col, regions, ndrives;
+ char tmpstr[10];
-#define COLWIDTH 14
+#define COLWIDTH 17
#define DRIVESPERLINE ((wnd->maxx - INSET) / COLWIDTH)
- for (ndrives = 0, i = 0; i < dk_ndrive; i++)
- if (dk_select[i])
+ for (ndrives = 0, i = 0; i < num_devices; i++)
+ if (dev_select[i].selected)
ndrives++;
regions = howmany(ndrives, DRIVESPERLINE);
/*
@@ -200,15 +229,17 @@ numlabels(row)
if (linesperregion < 3)
linesperregion = 3;
col = INSET;
- for (i = 0; i < dk_ndrive; i++)
- if (dk_select[i] && dk_mspw[i] != 0.0) {
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
if (col + COLWIDTH >= wnd->maxx - INSET) {
col = INSET, row += linesperregion + 1;
if (row > wnd->maxy - (linesperregion + 1))
break;
}
- mvwaddstr(wnd, row, col + 4, dr_name[i]);
- mvwaddstr(wnd, row + 1, col, "bps tps msps");
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvwaddstr(wnd, row, col + 4, tmpstr);
+ mvwaddstr(wnd, row + 1, col, " KB/t tps MB/s ");
col += COLWIDTH;
}
if (col)
@@ -221,18 +252,22 @@ barlabels(row)
int row;
{
int i;
+ char tmpstr[10];
mvwaddstr(wnd, row++, INSET,
"/0 /5 /10 /15 /20 /25 /30 /35 /40 /45 /50");
- linesperregion = 2 + msps;
- for (i = 0; i < dk_ndrive; i++)
- if (dk_select[i] && dk_mspw[i] != 0.0) {
+ linesperregion = 2 + kbpt;
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
if (row > wnd->maxy - linesperregion)
break;
- mvwprintw(wnd, row++, 0, "%-4.4s bps|", dr_name[i]);
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvwprintw(wnd, row++, 0, "%-5.5s MB/s|",
+ tmpstr);
mvwaddstr(wnd, row++, 0, " tps|");
- if (msps)
- mvwaddstr(wnd, row++, 0, " msps|");
+ if (kbpt)
+ mvwaddstr(wnd, row++, 0, " KB/t|");
}
return (row);
}
@@ -244,16 +279,11 @@ showiostat()
register long t;
register int i, row, col;
- if (namelist[X_DK_BUSY].n_type == 0)
- return;
- for (i = 0; i < dk_ndrive; i++) {
-#define X(fld) t = s.fld[i]; s.fld[i] -= s1.fld[i]; s1.fld[i] = t
- X(dk_xfer); X(dk_seek); X(dk_wds); X(dk_time);
- }
+#define X(fld) t = cur.fld[i]; cur.fld[i] -= last.fld[i]; last.fld[i] = t
etime = 0;
for(i = 0; i < CPUSTATES; i++) {
X(cp_time);
- etime += s.cp_time[i];
+ etime += cur.cp_time[i];
}
if (etime == 0.0)
etime = 1.0;
@@ -263,11 +293,11 @@ showiostat()
stat1(row++, i);
if (!numbers) {
row += 2;
- for (i = 0; i < dk_ndrive; i++)
- if (dk_select[i] && dk_mspw[i] != 0.0) {
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
if (row > wnd->maxy - linesperregion)
break;
- row = stats(row, INSET, i);
+ row = devstats(row, INSET, i);
}
return;
}
@@ -276,8 +306,8 @@ showiostat()
wdeleteln(wnd);
wmove(wnd, row + 3, 0);
winsertln(wnd);
- for (i = 0; i < dk_ndrive; i++)
- if (dk_select[i] && dk_mspw[i] != 0.0) {
+ for (i = 0; i < num_devices; i++)
+ if (dev_select[i].selected) {
if (col + COLWIDTH >= wnd->maxx - INSET) {
col = INSET, row += linesperregion + 1;
if (row > wnd->maxy - (linesperregion + 1))
@@ -287,42 +317,47 @@ showiostat()
wmove(wnd, row + 3, 0);
winsertln(wnd);
}
- (void) stats(row + 3, col, i);
+ (void) devstats(row + 3, col, i);
col += COLWIDTH;
}
}
static int
-stats(row, col, dn)
+devstats(row, col, dn)
int row, col, dn;
{
- double atime, words, xtime, itime;
-
- atime = s.dk_time[dn];
- atime /= hertz;
- words = s.dk_wds[dn]*32.0; /* number of words transferred */
- xtime = dk_mspw[dn]*words; /* transfer time */
- itime = atime - xtime; /* time not transferring */
- if (xtime < 0)
- itime += xtime, xtime = 0;
- if (itime < 0)
- xtime += itime, itime = 0;
+ long double transfers_per_second;
+ long double kb_per_transfer, mb_per_second;
+ long double busy_seconds;
+ int di;
+
+ di = dev_select[dn].position;
+
+ busy_seconds = compute_etime(cur.busy_time, last.busy_time);
+
+ if (compute_stats(&cur.dinfo->devices[di], &last.dinfo->devices[di],
+ busy_seconds, NULL, NULL, NULL,
+ &kb_per_transfer, &transfers_per_second,
+ &mb_per_second, NULL, NULL) != 0)
+ errx(1, "%s", devstat_errbuf);
+
if (numbers) {
- mvwprintw(wnd, row, col, "%3.0f%4.0f%5.1f",
- words / 512 / etime, s.dk_xfer[dn] / etime,
- s.dk_seek[dn] ? itime * 1000. / s.dk_seek[dn] : 0.0);
- return (row);
+ mvwprintw(wnd, row, col, " %5.2Lf %3.0Lf %5.2Lf ",
+ kb_per_transfer, transfers_per_second,
+ mb_per_second);
+ return(row);
}
wmove(wnd, row++, col);
- histogram(words / 512 / etime, 50, 1.0);
+ histogram(mb_per_second, 50, 1.0);
wmove(wnd, row++, col);
- histogram(s.dk_xfer[dn] / etime, 50, 1.0);
- if (msps) {
+ histogram(transfers_per_second, 50, 1.0);
+ if (kbpt) {
wmove(wnd, row++, col);
- histogram(s.dk_seek[dn] ? itime * 1000. / s.dk_seek[dn] : 0,
- 50, 1.0);
+ histogram(kb_per_transfer, 50, 1.0);
}
- return (row);
+
+ return(row);
+
}
static void
@@ -334,17 +369,17 @@ stat1(row, o)
time = 0;
for (i = 0; i < CPUSTATES; i++)
- time += s.cp_time[i];
+ time += cur.cp_time[i];
if (time == 0.0)
time = 1.0;
wmove(wnd, row, INSET);
#define CPUSCALE 0.5
- histogram(100.0 * s.cp_time[o] / time, 50, CPUSCALE);
+ histogram(100.0 * cur.cp_time[o] / time, 50, CPUSCALE);
}
static void
histogram(val, colwidth, scale)
- double val;
+ long double val;
int colwidth;
double scale;
{
@@ -354,7 +389,7 @@ histogram(val, colwidth, scale)
k = MIN(v, colwidth);
if (v > colwidth) {
- snprintf(buf, sizeof(buf), "%4.1f", val);
+ snprintf(buf, sizeof(buf), "%5.2Lf", val);
k -= strlen(buf);
while (k--)
waddch(wnd, 'X');
@@ -371,13 +406,13 @@ cmdiostat(cmd, args)
char *cmd, *args;
{
- if (prefix(cmd, "msps"))
- msps = !msps;
+ if (prefix(cmd, "kbpt"))
+ kbpt = !kbpt;
else if (prefix(cmd, "numbers"))
numbers = 1;
else if (prefix(cmd, "bars"))
numbers = 0;
- else if (!dkcmd(cmd, args))
+ else if (!dscmd(cmd, args, 100, &cur))
return (0);
wclear(wnd);
labeliostat();
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 4ee5e2d..b035eb9 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -217,10 +217,10 @@ bar graphs of the amount of time executing in user mode (``user''),
in user mode running low priority processes (``nice''), in
system mode (``system''), in interrupt mode (``interrupt''),
and idle (``idle''). Statistics
-on disk throughput show, for each drive, kilobytes of data transferred,
-number of disk transactions performed, and average seek time
-(in milliseconds). This information may be displayed as
-bar graphs or as rows of numbers which scroll downward. Bar
+on disk throughput show, for each drive, megabytes per second,
+average number of disk transactions per second, and
+average kilobytes of data per transaction. This information may be
+displayed as bar graphs or as rows of numbers which scroll downward. Bar
graphs are shown by default.
.Pp
The following commands are specific to the
@@ -237,9 +237,9 @@ displayed in numeric columns which scroll downward.
Show the disk
.Tn I/O
statistics in bar graph form (default).
-.It Cm msps
-Toggle the display of average seek time (the default is to
-not display seek times).
+.It Cm kbpt
+Toggle the display of kilobytes per transaction. (the default is to
+not display kilobytes per transaction).
.El
.It Ic swap
Show information about swap space usage on all the
@@ -452,6 +452,32 @@ drives may be specified, separated by spaces.
.It Cm display Op Ar drives
Display information about the drives indicated. Multiple drives
may be specified, separated by spaces.
+.It Cm only Op Ar drives
+Display only the specified drives. Multiple drives may be specified,
+separated by spaces.
+.It Cm drives
+Display a list of available devices.
+.It Cm match Ar type,if,pass Op Ar | ...
+Display devivces matching the given pattern. The basic matching
+expressions are the same as those used in
+.Xr iostat 8
+with one difference. Instead of specifying multiple
+.Fl t
+arguments which are then ORed together, the user instead specifys multiple
+matching expressions joined by the pipe ( | ) character. The comma
+separated arguments within each matching expression are ANDed together, and
+then the pipe separated matching expressions are ORed together. Any
+device matching the combined expression will be displayed, if there is room
+to display it. For example:
+.Pp
+.Dl match da,scsi | cd,ide
+.Pp
+This will display all SCSI Direct Access devices and all IDE CDROM devices.
+.Pp
+.Dl match da | sa | cd,pass
+.Pp
+This will display all Direct Access devices, all Sequential Access devices,
+and all passthrough devices that provide access to CDROM drives.
.El
.Sh SEE ALSO
.Xr iostat 1 ,
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index 90cff80..79968f3 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)vmstat.c 8.2 (Berkeley) 1/12/94";
#endif
static const char rcsid[] =
- "$Id: vmstat.c,v 1.25 1998/06/09 04:17:29 imp Exp $";
+ "$Id: vmstat.c,v 1.26 1998/07/06 22:08:00 bde Exp $";
#endif /* not lint */
/*
@@ -44,7 +44,6 @@ static const char rcsid[] =
*/
#include <sys/param.h>
-#include <sys/dkstat.h>
#include <sys/buf.h>
#include <sys/stat.h>
#include <sys/time.h>
@@ -52,6 +51,7 @@ static const char rcsid[] =
#include <sys/uio.h>
#include <sys/namei.h>
#include <sys/sysctl.h>
+#include <sys/dkstat.h>
#include <sys/vmmeter.h>
#include <vm/vm_param.h>
@@ -66,6 +66,7 @@ static const char rcsid[] =
#include <time.h>
#include <unistd.h>
#include <utmp.h>
+#include <devstat.h>
#include "systat.h"
#include "extern.h"
@@ -73,11 +74,6 @@ static struct Info {
long time[CPUSTATES];
struct vmmeter Cnt;
struct vmtotal Total;
- long *dk_time;
- long *dk_wds;
- long *dk_seek;
- long *dk_xfer;
- int dk_busy;
struct nchstats nchstats;
long nchcount;
long *intrcnt;
@@ -87,6 +83,8 @@ static struct Info {
long freevnodes;
} s, s1, s2, z;
+struct statinfo cur, last, run;
+
#define cnt s.Cnt
#define oldcnt s1.Cnt
#define total s.Total
@@ -98,10 +96,11 @@ static enum state { BOOT, TIME, RUN } state = TIME;
static void allocinfo __P((struct Info *));
static void copyinfo __P((struct Info *, struct Info *));
static float cputime __P((int));
-static void dinfo __P((int, int));
+static void dinfo __P((int, int, struct statinfo *, struct statinfo *));
static void getinfo __P((struct Info *, enum state));
static void putint __P((int, int, int, int));
static void putfloat __P((double, int, int, int, int, int));
+static void putlongdouble __P((long double, int, int, int, int, int));
static int ucount __P((void));
static int ncpu;
@@ -147,31 +146,21 @@ static struct nlist namelist[] = {
{ "_cnt" },
#define X_BUFFERSPACE 2
{ "_bufspace" },
-#define X_DK_BUSY 3
- { "_dk_busy" },
-#define X_DK_TIME 4
- { "_dk_time" },
-#define X_DK_XFER 5
- { "_dk_xfer" },
-#define X_DK_WDS 6
- { "_dk_wds" },
-#define X_DK_SEEK 7
- { "_dk_seek" },
-#define X_NCHSTATS 8
+#define X_NCHSTATS 3
{ "_nchstats" },
-#define X_INTRNAMES 9
+#define X_INTRNAMES 4
{ "_intrnames" },
-#define X_EINTRNAMES 10
+#define X_EINTRNAMES 5
{ "_eintrnames" },
-#define X_INTRCNT 11
+#define X_INTRCNT 6
{ "_intrcnt" },
-#define X_EINTRCNT 12
+#define X_EINTRCNT 7
{ "_eintrcnt" },
-#define X_DESIREDVNODES 13
+#define X_DESIREDVNODES 8
{ "_desiredvnodes" },
-#define X_NUMVNODES 14
+#define X_NUMVNODES 9
{ "_numvnodes" },
-#define X_FREEVNODES 15
+#define X_FREEVNODES 10
{ "_freevnodes" },
{ "" },
};
@@ -200,13 +189,9 @@ static struct nlist namelist[] = {
#define DISKROW 18 /* uses 5 rows and 50 cols (for 9 drives) */
#define DISKCOL 0
-#define DRIVESPACE 9 /* max # for space */
+#define DRIVESPACE 7 /* max # for space */
-#if DK_NDRIVE > DRIVESPACE
#define MAXDRIVES DRIVESPACE /* max # to display */
-#else
-#define MAXDRIVES DK_NDRIVE /* max # to display */
-#endif
int
initkre()
@@ -225,21 +210,22 @@ initkre()
return(0);
}
}
- if (! dkinit())
+
+ if (num_devices = getnumdevs() < 0) {
+ warnx("%s", devstat_errbuf);
return(0);
- if (dk_ndrive && !once) {
-#define allocate(e, t) \
- s./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
- s1./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
- s2./**/e = (t *)calloc(dk_ndrive, sizeof (t)); \
- z./**/e = (t *)calloc(dk_ndrive, sizeof (t));
- allocate(dk_time, long);
- allocate(dk_wds, long);
- allocate(dk_seek, long);
- allocate(dk_xfer, long);
- once = 1;
-#undef allocate
}
+
+ cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
+ last.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
+ run.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
+ bzero(cur.dinfo, sizeof(struct devinfo));
+ bzero(last.dinfo, sizeof(struct devinfo));
+ bzero(run.dinfo, sizeof(struct devinfo));
+
+ if (dsinit(MAXDRIVES, &cur, &last, &run) != 1)
+ return(0);
+
if (nintr == 0) {
nintr = (namelist[X_EINTRCNT].n_value -
namelist[X_INTRCNT].n_value) / sizeof (long);
@@ -341,15 +327,23 @@ labelkre()
mvprintw(NAMEIROW + 1, NAMEICOL,
" Calls hits %% hits %%");
mvprintw(DISKROW, DISKCOL, "Discs");
- mvprintw(DISKROW + 1, DISKCOL, "seeks");
- mvprintw(DISKROW + 2, DISKCOL, "xfers");
- mvprintw(DISKROW + 3, DISKCOL, " blks");
- mvprintw(DISKROW + 4, DISKCOL, " msps");
+ mvprintw(DISKROW + 1, DISKCOL, "KB/t");
+ mvprintw(DISKROW + 2, DISKCOL, "tps");
+ mvprintw(DISKROW + 3, DISKCOL, "MB/s");
+ /*
+ * For now, we don't support a fourth disk statistic. So there's
+ * no point in providing a label for it. If someone can think of a
+ * fourth useful disk statistic, there is room to add it.
+ */
+ /* mvprintw(DISKROW + 4, DISKCOL, " msps"); */
j = 0;
- for (i = 0; i < dk_ndrive && j < MAXDRIVES; i++)
- if (dk_select[i]) {
- mvprintw(DISKROW, DISKCOL + 5 + 5 * j,
- " %4.4s", dr_name[j]);
+ for (i = 0; i < num_devices && j < MAXDRIVES; i++)
+ if (dev_select[i].selected) {
+ char tmpstr[80];
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvprintw(DISKROW, DISKCOL + 5 + 6 * j,
+ " %5.5s", tmpstr);
j++;
}
for (i = 0; i < nintr; i++) {
@@ -360,6 +354,7 @@ labelkre()
}
#define X(fld) {t=s.fld[i]; s.fld[i]-=s1.fld[i]; if(state==TIME) s1.fld[i]=t;}
+#define Q(fld) {t=cur.fld[i]; cur.fld[i]-=last.fld[i]; if(state==TIME) last.fld[i]=t;}
#define Y(fld) {t = s.fld; s.fld -= s1.fld; if(state == TIME) s1.fld = t;}
#define Z(fld) {t = s.nchstats.fld; s.nchstats.fld -= s1.nchstats.fld; \
if(state == TIME) s1.nchstats.fld = t;}
@@ -380,12 +375,10 @@ showkre()
int i, l, c;
static int failcnt = 0;
- for (i = 0; i < dk_ndrive; i++) {
- X(dk_xfer); X(dk_seek); X(dk_wds); X(dk_time);
- }
etime = 0;
for(i = 0; i < CPUSTATES; i++) {
X(time);
+ Q(cp_time);
etime += s.time[i];
}
if (etime < 5.0) { /* < 5 ticks - ignore this trash */
@@ -496,11 +489,24 @@ showkre()
PUTRATE(Cnt.v_soft, GENSTATROW + 1, GENSTATCOL + 20, 5);
PUTRATE(Cnt.v_vm_faults, GENSTATROW + 1, GENSTATCOL + 25, 5);
mvprintw(DISKROW, DISKCOL + 5, " ");
- for (i = 0, c = 0; i < dk_ndrive && c < MAXDRIVES; i++)
- if (dk_select[i]) {
- mvprintw(DISKROW, DISKCOL + 5 + 5 * c,
- " %4.4s", dr_name[i]);
- dinfo(i, ++c);
+ for (i = 0, c = 0; i < num_devices && c < MAXDRIVES; i++)
+ if (dev_select[i].selected) {
+ char tmpstr[80];
+ sprintf(tmpstr, "%s%d", dev_select[i].device_name,
+ dev_select[i].unit_number);
+ mvprintw(DISKROW, DISKCOL + 5 + 6 * c,
+ " %5.5s", tmpstr);
+ switch(state) {
+ case TIME:
+ dinfo(i, ++c, &cur, &last);
+ break;
+ case RUN:
+ dinfo(i, ++c, &cur, &run);
+ break;
+ case BOOT:
+ dinfo(i, ++c, &cur, NULL);
+ break;
+ }
}
putint(s.nchcount, NAMEIROW + 2, NAMEICOL, 9);
putint((nchtotal.ncs_goodhits + nchtotal.ncs_neghits),
@@ -519,11 +525,27 @@ int
cmdkre(cmd, args)
char *cmd, *args;
{
+ int retval;
if (prefix(cmd, "run")) {
+ retval = 1;
copyinfo(&s2, &s1);
+ switch (getdevs(&run)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = run.dinfo->numdevs;
+ generation = run.dinfo->generation;
+ retval = dscmd("refresh", NULL, MAXDRIVES, &cur);
+ if (retval == 2)
+ labelkre();
+ break;
+ default:
+ break;
+ }
state = RUN;
- return (1);
+ return (retval);
}
if (prefix(cmd, "boot")) {
state = BOOT;
@@ -535,11 +557,32 @@ cmdkre(cmd, args)
return (1);
}
if (prefix(cmd, "zero")) {
- if (state == RUN)
+ retval = 1;
+ if (state == RUN) {
getinfo(&s1, RUN);
- return (1);
+ switch (getdevs(&run)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = run.dinfo->numdevs;
+ generation = run.dinfo->generation;
+ retval = dscmd("refresh",NULL, MAXDRIVES, &cur);
+ if (retval == 2)
+ labelkre();
+ break;
+ default:
+ break;
+ }
+ }
+ return (retval);
}
- return (dkcmd(cmd, args));
+ retval = dscmd(cmd, args, MAXDRIVES, &cur);
+
+ if (retval == 2)
+ labelkre();
+
+ return(retval);
}
/* calculate number of users on the system */
@@ -617,24 +660,43 @@ putfloat(f, l, c, w, d, nz)
}
static void
+putlongdouble(f, l, c, w, d, nz)
+ long double f;
+ int l, c, w, d, nz;
+{
+ char b[128];
+
+ move(l, c);
+ if (nz && f == 0.0) {
+ while (--w >= 0)
+ addch(' ');
+ return;
+ }
+ sprintf(b, "%*.*Lf", w, d, f);
+ if (strlen(b) > w) {
+ while (--w >= 0)
+ addch('*');
+ return;
+ }
+ addstr(b);
+}
+
+static void
getinfo(s, st)
struct Info *s;
enum state st;
{
+ struct devinfo *tmp_dinfo;
int mib[2], size;
extern int errno;
NREAD(X_CPTIME, s->time, sizeof s->time);
+ NREAD(X_CPTIME, cur.cp_time, sizeof(cur.cp_time));
NREAD(X_CNT, &s->Cnt, sizeof s->Cnt);
NREAD(X_BUFFERSPACE, &s->bufspace, sizeof(s->bufspace));
NREAD(X_DESIREDVNODES, &s->desiredvnodes, sizeof(s->desiredvnodes));
NREAD(X_NUMVNODES, &s->numvnodes, LONG);
NREAD(X_FREEVNODES, &s->freevnodes, LONG);
- NREAD(X_DK_BUSY, &s->dk_busy, sizeof(s->dk_busy));
- NREAD(X_DK_TIME, s->dk_time, dk_ndrive * LONG);
- NREAD(X_DK_XFER, s->dk_xfer, dk_ndrive * LONG);
- NREAD(X_DK_WDS, s->dk_wds, dk_ndrive * LONG);
- NREAD(X_DK_SEEK, s->dk_seek, dk_ndrive * LONG);
NREAD(X_NCHSTATS, &s->nchstats, sizeof s->nchstats);
NREAD(X_INTRCNT, s->intrcnt, nintr * LONG);
size = sizeof(s->Total);
@@ -647,6 +709,24 @@ getinfo(s, st)
size = sizeof(ncpu);
if (sysctlbyname("hw.ncpu", &ncpu, &size, NULL, 0) < 0)
ncpu = 1;
+
+ tmp_dinfo = last.dinfo;
+ last.dinfo = cur.dinfo;
+ cur.dinfo = tmp_dinfo;
+
+ last.busy_time = cur.busy_time;
+ switch (getdevs(&cur)) {
+ case -1:
+ errx(1, "%s", devstat_errbuf);
+ break;
+ case 1:
+ num_devices = cur.dinfo->numdevs;
+ generation = cur.dinfo->generation;
+ cmdkre("refresh", NULL);
+ break;
+ default:
+ break;
+ }
}
static void
@@ -663,45 +743,45 @@ static void
copyinfo(from, to)
register struct Info *from, *to;
{
- long *time, *wds, *seek, *xfer;
long *intrcnt;
+ struct devinfo tmp_dinfo;
/*
* time, wds, seek, and xfer are malloc'd so we have to
* save the pointers before the structure copy and then
* copy by hand.
*/
- time = to->dk_time; wds = to->dk_wds; seek = to->dk_seek;
- xfer = to->dk_xfer; intrcnt = to->intrcnt;
+ intrcnt = to->intrcnt;
*to = *from;
- bcopy(from->dk_time, to->dk_time = time, dk_ndrive * sizeof (long));
- bcopy(from->dk_wds, to->dk_wds = wds, dk_ndrive * sizeof (long));
- bcopy(from->dk_seek, to->dk_seek = seek, dk_ndrive * sizeof (long));
- bcopy(from->dk_xfer, to->dk_xfer = xfer, dk_ndrive * sizeof (long));
+
bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (int));
}
static void
-dinfo(dn, c)
+dinfo(dn, c, now, then)
int dn, c;
+ struct statinfo *now, *then;
{
- double words, atime, itime, xtime;
-
- c = DISKCOL + c * 5;
- atime = s.dk_time[dn];
- atime /= hertz;
- words = s.dk_wds[dn]*32.0; /* number of words transferred */
- xtime = dk_mspw[dn]*words; /* transfer time */
- itime = atime - xtime; /* time not transferring */
- if (xtime < 0)
- itime += xtime, xtime = 0;
- if (itime < 0)
- xtime += itime, itime = 0;
- putint((int)((float)s.dk_seek[dn]/etime+0.5), DISKROW + 1, c, 5);
- putint((int)((float)s.dk_xfer[dn]/etime+0.5), DISKROW + 2, c, 5);
- putint((int)(words/etime/512.0 + 0.5), DISKROW + 3, c, 5);
- if (s.dk_seek[dn])
- putfloat(itime*1000.0/s.dk_seek[dn], DISKROW + 4, c, 5, 1, 1);
- else
- putint(0, DISKROW + 4, c, 5);
+ long double transfers_per_second;
+ long double kb_per_transfer, mb_per_second;
+ long double busy_seconds;
+ int di;
+
+ di = dev_select[dn].position;
+
+ busy_seconds = compute_etime(now->busy_time, then ?
+ then->busy_time :
+ then->dinfo->devices[di].dev_creation_time);
+
+ if (compute_stats(&now->dinfo->devices[di], then ?
+ &then->dinfo->devices[di] : NULL, busy_seconds,
+ NULL, NULL, NULL,
+ &kb_per_transfer, &transfers_per_second,
+ &mb_per_second, NULL, NULL) != 0)
+ errx(1, "%s", devstat_errbuf);
+
+ c = DISKCOL + c * 6;
+ putlongdouble(kb_per_transfer, DISKROW + 1, c, 5, 2, 0);
+ putlongdouble(transfers_per_second, DISKROW + 2, c, 5, 0, 0);
+ putlongdouble(mb_per_second, DISKROW + 3, c, 5, 2, 0);
}
OpenPOWER on IntegriCloud