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].
This commit is contained in:
Bruce Evans 1994-12-03 10:06:40 +00:00
parent b39b673d37
commit 3544ae54e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4930
5 changed files with 18 additions and 24 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -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();

View File

@ -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.

View File

@ -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)