summaryrefslogtreecommitdiffstats
path: root/usr.bin/systat
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1994-12-03 10:06:40 +0000
committerbde <bde@FreeBSD.org>1994-12-03 10:06:40 +0000
commitbe27214244934a97220f616d15ad99b9badee65e (patch)
treec1a4da58fcfcc50a0591ac0d2bead1ac99c2bbc1 /usr.bin/systat
parent40161a97d94886f78fa2f2119f5f507db9cfff2e (diff)
downloadFreeBSD-src-be27214244934a97220f616d15ad99b9badee65e.zip
FreeBSD-src-be27214244934a97220f616d15ad99b9badee65e.tar.gz
extern.h, iostat.c, main.c, vmstat.c:
Use the correct value of hz (stathz if it is nonzero) for interpretion of dk_time[] and cp_time[] in iostat.c. Avoid multiple conversions of this value in iostat.c and vmstat.c iostat.c: Implement the display of cp_time[CP_INTR]. Fix the display of cp_time[CP_IDLE] (the display was always null because cp_time[CP_INTR] == 0 was displayed instead). systat.1: Document the display of cp_time[CP_INTR]. vmstat.c: Implement the display of cp_time[CP_INTR].
Diffstat (limited to 'usr.bin/systat')
-rw-r--r--usr.bin/systat/extern.h1
-rw-r--r--usr.bin/systat/iostat.c11
-rw-r--r--usr.bin/systat/main.c2
-rw-r--r--usr.bin/systat/systat.15
-rw-r--r--usr.bin/systat/vmstat.c23
5 files changed, 18 insertions, 24 deletions
diff --git a/usr.bin/systat/extern.h b/usr.bin/systat/extern.h
index 673278b..2e264f0 100644
--- a/usr.bin/systat/extern.h
+++ b/usr.bin/systat/extern.h
@@ -51,6 +51,7 @@ extern int *dk_select;
extern int CMDLINE;
extern int dk_ndrive;
extern int hz, stathz;
+extern double hertz; /* sampling frequency for cp_time and dk_time */
extern int naptime, col;
extern int nhosts;
extern int nports;
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c
index b5412a5..7c066f1 100644
--- a/usr.bin/systat/iostat.c
+++ b/usr.bin/systat/iostat.c
@@ -169,6 +169,7 @@ labeliostat()
mvwaddstr(wnd, row++, 0, "cpu user|");
mvwaddstr(wnd, row++, 0, " nice|");
mvwaddstr(wnd, row++, 0, " system|");
+ mvwaddstr(wnd, row++, 0, "interrupt|");
mvwaddstr(wnd, row++, 0, " idle|");
if (numbers)
row = numlabels(row + 1);
@@ -256,13 +257,9 @@ showiostat()
}
if (etime == 0.0)
etime = 1.0;
- etime /= (float) hz;
+ etime /= hertz;
row = 1;
-
- /*
- * Last CPU state not calculated yet.
- */
- for (i = 0; i < CPUSTATES - 1; i++)
+ for (i = 0; i < CPUSTATES; i++)
stat1(row++, i);
if (!numbers) {
row += 2;
@@ -302,7 +299,7 @@ stats(row, col, dn)
double atime, words, xtime, itime;
atime = s.dk_time[dn];
- atime /= (float) hz;
+ 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 */
diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c
index c11c553..07975f3 100644
--- a/usr.bin/systat/main.c
+++ b/usr.bin/systat/main.c
@@ -66,6 +66,7 @@ int col;
int naptime = 5;
int verbose = 1; /* to report kvm read errs */
int hz, stathz;
+double hertz;
char c;
char *namp;
char hostname[MAXHOSTNAMELEN];
@@ -143,6 +144,7 @@ main(argc, argv)
gethostname(hostname, sizeof (hostname));
NREAD(X_HZ, &hz, LONG);
NREAD(X_STATHZ, &stathz, LONG);
+ hertz = stathz ? stathz : hz;
(*curcmd->c_init)();
curcmd->c_flags |= CF_INIT;
labels();
diff --git a/usr.bin/systat/systat.1 b/usr.bin/systat/systat.1
index 11bdbd5..a4d82e2 100644
--- a/usr.bin/systat/systat.1
+++ b/usr.bin/systat/systat.1
@@ -158,7 +158,8 @@ Display, in the lower window, statistics about processor use
and disk throughput. Statistics on processor use appear as
bar graphs of the amount of time executing in user mode (``user''),
in user mode running low priority processes (``nice''), in
-system mode (``system''), and idle (``idle''). Statistics
+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
@@ -237,7 +238,7 @@ in disk wait other than paging (`d'),
sleeping (`s'), and swapped out but desiring to run (`w').
Below the queue length listing is a numerical listing and
a bar graph showing the amount of
-system (shown as `='), user (shown as `>'),
+system (shown as `='), interrupt (shown as `+'), user (shown as `>'),
nice (shown as `-'), and idle time (shown as ` ').
.Pp
At the bottom left are statistics on name translations.
diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c
index ce82f02..5075394 100644
--- a/usr.bin/systat/vmstat.c
+++ b/usr.bin/systat/vmstat.c
@@ -96,7 +96,6 @@ static int ut;
static char buf[26];
static time_t t;
static double etime;
-static float hertz;
static int nintr;
static long *intrloc;
static char **intrname;
@@ -207,7 +206,6 @@ initkre()
return(0);
}
}
- hertz = stathz ? stathz : hz;
if (! dkinit())
return(0);
if (dk_ndrive && !once) {
@@ -313,7 +311,7 @@ labelkre()
mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt");
mvprintw(GRAPHROW, GRAPHCOL,
- " . %% Sys . %% User . %% Nice . %% Idle");
+ " . %%Sys . %%Intr . %%User . %%Nice . %%Idle");
mvprintw(PROCSROW, PROCSCOL, "Proc:r p d s w");
mvprintw(GRAPHROW + 1, GRAPHCOL,
"| | | | | | | | | | |");
@@ -349,8 +347,9 @@ labelkre()
putint((int)((float)s.fld/etime + 0.5), l, c, w)
#define MAXFAIL 5
-static char cpuchar[CPUSTATES] = { '=' , '>', '-', ' ' };
-static char cpuorder[CPUSTATES] = { CP_SYS, CP_USER, CP_NICE, CP_IDLE };
+static char cpuchar[CPUSTATES] = { '=' , '+', '>', '-', ' ' };
+static char cpuorder[CPUSTATES] = { CP_SYS, CP_INTR, CP_USER, CP_NICE,
+ CP_IDLE };
void
showkre()
@@ -409,20 +408,14 @@ showkre()
psiz = 0;
f2 = 0.0;
-
- /*
- * Last CPU state not calculated yet.
- */
- for (c = 0; c < CPUSTATES - 1; c++) {
+ for (c = 0; c < CPUSTATES; c++) {
i = cpuorder[c];
f1 = cputime(i);
f2 += f1;
l = (int) ((f2 + 1.0) / 2.0) - psiz;
- if (c == 0)
- putfloat(f1, GRAPHROW, GRAPHCOL + 1, 5, 1, 0);
- else
- putfloat(f1, GRAPHROW, GRAPHCOL + 12 * c,
- 5, 1, 0);
+ if (f1 > 99.9)
+ f1 = 99.9; /* no room to display 100.0 */
+ putfloat(f1, GRAPHROW, GRAPHCOL + 10 * c, 4, 1, 0);
move(GRAPHROW + 2, psiz);
psiz += l;
while (l-- > 0)
OpenPOWER on IntegriCloud