In systat(1)'s vmstat view, dinfo() uses the global "naptime" as an
elapsed time when computing rates.
The problem is that naptime isn't the actual elapsed time. For
example, if you force a view update by hitting the spacebar, the
actual elapsed time is obviously not naptime.
The fix is easy. showkre() calls dinfo(), and showkre() has the real
elapsed time (etime), so just pass that as argument to dinfo().
ok?
Index: vmstat.c
===================================================================
RCS file: /cvs/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.95
diff -u -p -r1.95 vmstat.c
--- vmstat.c 4 Dec 2022 18:01:57 -0000 1.95
+++ vmstat.c 13 Dec 2022 17:13:30 -0000
@@ -84,7 +84,7 @@ static enum state { BOOT, TIME, RUN } st
static void allocinfo(struct Info *);
static void copyinfo(struct Info *, struct Info *);
static float cputime(int);
-static void dinfo(int, int);
+static void dinfo(int, int, double);
static void getinfo(struct Info *);
void putint(int, int, int, int);
void putintmk(int, int, int, int);
@@ -443,7 +443,7 @@ showkre(void)
mvprintw(DISKROW, DISKCOL + 5 + c,
" %*s", l, dr_name[i]);
c += 1 + l;
- dinfo(i, c);
+ dinfo(i, c, etime);
}
/* and pad the DRIVESPACE */
l = DRIVESPACE - c;
@@ -666,11 +666,9 @@ copyinfo(struct Info *from, struct Info
}
static void
-dinfo(int dn, int c)
+dinfo(int dn, int c, double etime)
{
- double words, atime, etime;
-
- etime = naptime;
+ double words, atime;
c += DISKCOL;