systat(1): vmstat: measure elapsed time with clock_gettime(2) instead of ticks
The vmstat view in systat(1) should not use statclock() ticks to count
elapsed time. First, ticks are low resolution. Second, the statclock
is sometimes randomized, so each tick is not necessarily of equal
length. Third, we're counting ticks from every CPU on the system, so
every rate in the view is divided by the number of CPUs. For example,
on an amd64 system with 8 CPUs you currently see:
200 clock
... when the true clock interrupt rate on that system is 1600.
Instead, measure elapsed time with clock_gettime(2). Use CLOCK_UPTIME
here so we exclude time when the system is suspended. With this
change we no longer need "stathz" or "hertz". We can also get rid of
the anachronistic secondary clock failure test.
Prompted by dlg@ and jmatthew@. deraadt@ says this has been in snaps
since 2022-11-21; no complaints.
Link: https://marc.info/?l=openbsd-tech&m=166898960831136&w=2
ok dlg@ deraadt@