Home | History | Annotate | Download | only in vmstat
History log of /src/usr.bin/vmstat/vmstat.c
RevisionDateAuthorComments
 1.262  16-Feb-2025  skrll Print a column heading of "event" when displaying all events, and
"interrupts" otherwise (not always).
 1.261  16-Feb-2025  skrll Remove unnecessary do / while (0);
 1.260  16-Feb-2025  skrll Trailing whitespace.
 1.259  16-Feb-2025  skrll When printing interrupt statistics line up wrt the totals.
 1.258  09-Sep-2023  ad branches: 1.258.2;
uidinfo is an SLIST.
 1.257  01-Aug-2023  simonb For vmstat -mW, add a total KB consumed column and widen a couple of
other fields.
 1.256  23-Oct-2022  simonb Remove extraneous "d" in a printf format string in UVM history dump
(leftover int format specifier from conversion to FMTd32?).
 1.255  16-Jul-2022  simonb When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes. Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.
 1.254  16-Jul-2022  simonb Move the call to getnlist() to after we check if kvm_openfiles(3) succeeded.
Avoids a coredump when called with "vmstat -M /dev/mem".
 1.253  19-May-2022  simonb Bump some column widths for "vmstat -mW".
 1.252  27-Feb-2022  rillig vmstat: unexport file-scope variable numdisks

There is no need to make this variable externally visible. There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.
 1.251  09-Feb-2022  wiz Fix typo in usage.
 1.250  09-Feb-2022  mrg allow the number of disks displayed in the default output
to be controlled.
 1.249  01-Feb-2022  mrg when picking which 2 disks to show in the 'vmstat' default output
and they haven't been specified on the command line, pick the two
devices that have had the largest read+write IO bytes count.
 1.248  27-Nov-2021  rillig usr.bin: remove unnecessary CONSTCOND, lint no longer needs it

Since 2021-01-31, lint no longer requires a CONSTCOND comment in a
do-while-0 statement since this is a common code pattern, especially in
statement-like macros.
 1.247  22-Aug-2021  rillig usr.bin: enable lint checks for most programs in /usr/bin

Previously, lint was only activated for the libraries, but not for the
kernel or userland programs. Activate lint for the programs in /usr/bin
for now, more will follow later.

This only affects builds that set MKLINT=yes.
 1.246  02-Apr-2021  simonb Drop setgid kmem, simplify nlist setup.
 1.245  01-Apr-2021  simonb Use kernel sysctl hashstat collection instead of kmem grovelling
directly. Also GC a few old hash nlist entries that no longer exist.
 1.244  01-Apr-2021  simonb Now that ports that use legacy intrcnt interrupt accounting have event
counters to show that data, for the live kernel case just show INTR
events for "vmstat -i".
 1.243  03-Mar-2021  simonb For vmstat -h/-H, calculate the hash element size correctly instead of
assuming that everything that isn't a list is a tailq. Fixes random
reads from kmem that either fail or return incorrect data for the vcache
hash table.
 1.242  14-Jun-2020  ad Remove PG_ZERO. It worked brilliantly on x86 machines from the mid-90s but
having spent an age experimenting with it over the last 6 months on various
machines and with different use cases it's always either break-even or a
slight net loss for me.
 1.241  14-Jun-2020  ad pool_cache:

- make all counters per-CPU and make cache layer do its work with atomic ops.
- conserve memory by caching empty groups globally.
 1.240  11-Jun-2020  ad Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot.
For the cheap option, give cpu_count_sync() a boolean parameter indicating
that a cached value is okay, and rate limit the updates for cached values
to hz.
 1.239  23-Mar-2020  ad ncs_collisions is gone.
 1.238  22-Mar-2020  ad Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core. Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.
 1.237  22-Mar-2020  ad - nchash is gone.
- Report new namecache stats.
 1.236  25-Jan-2020  simonb Fix alignment of Flags column for vmstat -mW.
 1.235  15-Jan-2020  ad vmstat -s: report new stats:

0 per-cpu stats one synced
7246 per-cpu stats all synced
4092 anon pages possibly dirty
8881 anon pages dirty
0 anon pages clean
68 file pages possibly dirty
0 file pages dirty
2367889 file pages clean
 1.234  08-Jan-2020  ad Show reverse misses too.
 1.233  06-Jan-2020  ad - Report namecache reverse hits with vmstat -s.
- ncvhashtbl is no more.
 1.232  04-Jan-2020  mrg move the time nlist fetches into their own namelist and only
fetch them when necessary. allow for fallback uses of older
time sources if others are not present.

this stops vmstat from exiting if it can't get the addresses
of these time values it often doesn't need (eg, running kernels
use the sysctl method), which has cropped up recently wit the
removal of boottime variable.


a slighly modified version of this patch (modified to handle
the old boottime variable over the new one) works against a
netbsd-9 vmstat in -current too.

XXX: pullup
 1.231  03-Jan-2020  thorpej boottime in the kernel is no more. Instead, read timebasebin and convert
from bintime to timespec.
 1.230  27-Dec-2019  msaitoh s/sucess/success/ in comment.
 1.229  22-Dec-2019  ad Have vmstat -H report on vcache_hashtab.
 1.228  13-Sep-2019  christos Expose struct namecache.
 1.227  09-May-2019  mrg branches: 1.227.2;
when dumping a kernhist history replace "%s" with "%p" so that the
kernhist in kernel can be a little more usable without making the
userland dumping code crash.
 1.226  30-Apr-2019  simonb Use PRWORD for printing -m/-mW totals so fields don't run in to each other.

While here, update field widths for 'vmstat -mW' for modern machines.
 1.225  13-Dec-2018  sevan typo
 1.224  04-Dec-2017  mrg branches: 1.224.2; 1.224.4;
deref the right address to get the pool_allocator.
 1.223  03-Dec-2017  mrg remove now wrong comment. minor KNF.
 1.222  03-Dec-2017  mrg fix the kvm version of counting pool pages for vmstat -s.
 1.221  02-Dec-2017  mrg add two new members to uvmexp_sysctl{}: bootpages and poolpages.
bootpages is set to the pages allocated via uvm_pageboot_alloc().
poolpages is calculated from the list of pools nr_pages members.

this brings us closer to having a valid total of pages known by
the system, vs actual pages originally managed.

XXX: poolpages needs some handling for PR_RECURSIVE pools still.
 1.220  03-Nov-2017  pgoyette Remove the ABI version-and-length check that was recently introduced;
sysctl(9) ABIs should be stable across versions.

XXX Pull-up to -8
 1.219  28-Oct-2017  pgoyette Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.
 1.218  06-Sep-2017  mlelstv Don't print "nan" when there is no disk activity.
 1.217  04-Jul-2017  mlelstv Use I/O timestamps to compute disk statistics for better precision.

Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
 1.216  05-Jan-2017  ryo branches: 1.216.6;
"vmstat -ie[v]" auto fit to minimum columns

Reviewed by msaitoh@
 1.215  05-Jan-2017  pgoyette Adapt to use of bintime(9) for kernel history timestamps (7.99.55).
 1.214  04-Jan-2017  pgoyette Fix error handling confusion between error and errno
 1.213  04-Jan-2017  pgoyette Adapt to new version of the sysctl export structure
 1.212  02-Jan-2017  pgoyette Use appropriate PRI* format specifiers for fixed-bit-size numbers

Should fix i386 build.
 1.211  02-Jan-2017  pgoyette For kvm-based kernhist code, print size of history table and "next free"
pointer, same as we do for sysctl-based code.
 1.210  02-Jan-2017  pgoyette Restore the kvm-grovelling code for use on crash files (where sysctl(3)
is not available). Otherwise, this would always report on the current
running kernel regardless of the use of -M option.
 1.209  02-Jan-2017  pgoyette For kernel history display, replace the kvm grovelling with the newly
available sysctl access to the history data.

XXX vmstat still uses kvm for several other displays
 1.208  04-Oct-2016  christos No point in using float here; makes evbmips64 need __truncdfsf2, and that
causes static linking issues because of softfloat.
 1.207  05-Sep-2016  sevan Drop main() prototype.
 1.206  24-Dec-2014  dennis branches: 1.206.2;
Update stats-keeping in sys/kern/vfs_cache.c to remove (most)
races while allowing consistent lockless sampling of the per-cpu
statistics without atomic operations. Update comment describing
the locking protocol to include this.

These files were fumble-fingered out of the last commit.
 1.205  12-Sep-2014  skrll Trailing whitespace.
 1.204  12-Sep-2014  skrll Print the cpu in the kernhist record.
 1.203  12-Jul-2014  nakayama branches: 1.203.2;
Use u_long to avoid negative value outputs.
 1.202  14-Jun-2014  joerg Init summary counters.
 1.201  14-Jun-2014  joerg Fix format string for ILP32.
 1.200  13-Jun-2014  joerg Use kern.pool for the live system.
 1.199  03-Jun-2014  joerg GC left-over kread.
 1.198  03-Jun-2014  joerg Use CPU statistics from uvmexp when possible.
 1.197  03-Jun-2014  joerg Use kern.clockrate if possible.
 1.196  03-Jun-2014  joerg Convert the remaining uvmexp users to the sysctl as default source.
 1.195  03-Jun-2014  joerg Use vm.uvmexp data as much as possible for vmstat -s.
Temporarily disable shadowing warning until the other users are cleaned
up.
 1.194  03-Jun-2014  joerg Provide sysctl for namecache statistics.
 1.193  02-Jun-2014  joerg Make missing kern.evcnt an error, don't try to fallback to kmem use.
 1.192  08-May-2014  hannken Add a global vnode cache:

- vcache_get() retrieves a referenced and initialised vnode / fs node pair.
- vcache_remove() removes a vnode / fs node pair from the cache.

On cache miss vcache_get() calls new vfs operation vfs_loadvnode() to
initialise a vnode / fs node pair. This call is guaranteed exclusive,
no other thread will try to load this vnode / fs node pair.

Convert ufs/ext2fs, ufs/ffs and ufs/mfs to use this interface.

Remove now unused ufs/ufs_ihash

Discussed on tech-kern.

Welcome to 6.99.41
 1.191  19-Feb-2014  dsl branches: 1.191.2;
Remove some pointless inclusions os sys/user.h
 1.190  24-Nov-2013  rmind Remove cpu_queue (and thus eleminate another use of CIRCLEQ) by replacing
its uses with cpu_infos array. Extra testing by christos@.
 1.189  10-Nov-2013  mrg add a row with totals for some pool statistics.
 1.188  29-Apr-2012  para branches: 1.188.2;
remove malloc(9) output function from vmstat
it is not required and working any more
 1.187  20-Mar-2012  matt Use C89 function definitions
 1.186  15-Oct-2011  christos branches: 1.186.2;
use warn instead of perror.
 1.185  15-Oct-2011  christos unbreak -f -H -h, etc, part 1
- get nlist once in the beginning and fix the flags. Not each time! It is
not like the kernel will change it symbols in the middle of the run.
 1.184  21-Sep-2011  jym Use __arraycount(), as done above.
 1.183  06-Sep-2011  joerg Mark usage as static and __dead.
 1.182  26-Jul-2011  yamt dopoolcache: don't print unused caches unless verbose
 1.181  17-May-2011  mrg move and rename the uvm history code out of uvm_stat to "kernhist".

rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories. this is mostly just
allocating something in a bitmap, and is only for viewing multiple
histories in a merged form.


tested on amd64 and sparc64.
 1.180  16-Feb-2011  nakayama Fix header, format and total count of system interrupt counters.
 1.179  05-Feb-2011  mlelstv dosum also needs getnlist
 1.178  31-Jan-2011  christos deal with detecting the first and last cpu differently.
 1.177  31-Jan-2011  matt Make sure to getnlist in dovmstat
 1.176  29-Jan-2011  matt Defer nlist processing until we know we need to it. If everything can be
obtained via sysctl, we can skip it entirely. This means we can run even
if not setgid.

getuptime will now use sysctl/clock_gettime if memf is NULL.
doevcnt now sues sysctl(kern.evcnt) is memf is NULL. It falls back to
groveling if sysctl returns an error of ENOENT.
dointr will call doevcnt to evcnt based intr stats.
 1.175  25-Dec-2010  christos branches: 1.175.2;
can't play games with structure names since cpu_data refers to cpu_info, so
provide our own copy for everything.
 1.174  25-Dec-2010  christos use a local definition of cpu_info if we have __HAVE_CPU_DATA_FIRST
 1.173  25-Dec-2010  christos Don't crash on old kernels that don't have the new per cpu counters.
 1.172  24-Dec-2010  enami We still need to update ouvmexp to output the differene from
previous iteration.
 1.171  20-Dec-2010  christos make this work with the per-cpu counters.
 1.170  18-Oct-2010  christos simplify and modernize:
- make sysctl mibs static
- use warn/warnx for warnings
makes binary 4K smaller.
 1.169  07-Jul-2010  pooka Make "i" unsigned to mirror change to struct uvm_history
 1.168  05-Apr-2010  he Follow christos' suggestions, and make ks_active a u_short, and
also only use 16 u_shorts instead of 32 ints. Also add panic()
calls for under- and overflow of the ks_active members under
DIAGNOSTIC. The MAXBUCKET constant ended up in sys/mallocvar.h
and not sys/param.h, as the latter caused build problems.

Ride the kernel revision bump of my previous change.
 1.167  05-Apr-2010  he Extend struct malloc_type to count the number of active allocations
per size, and make vmstat report this information under the "Memory
statistics by type" display, which is only printed when the kernel
has been compiled with KMEMSTATS defined, like this:

Memory statistics by type Type Kern
Type InUse MemUse HighUse Limit Requests Limit Limit Size(s)
wapbl 15 4192K 4192K 78644K 376426 0 0 32:0,256:3,512:6,131072:1,262144:2,524288:3

Since struct malloc_type is user-visible and is changed, bump kernel
revision to 5.99.26.

While it is true that malloc(9) is in general on the path of slowly
being replaced by kmem(9) (kmem_alloc/kmem_free), there remains a
lot of points of usage of malloc/free, and this could aid in finding
any leaks. (It helped finding the leak fixed in PR#42661.)

This was discussed with and somewhat hestitantly OKed by rmind@
 1.166  21-Oct-2009  rmind Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.165  18-Jan-2009  lukem fix -Wsign-compare issues
 1.164  28-Nov-2008  dholland Add missing fflush() in one of three places that print stuff repeatedly
every so often. PR 32836 from Takuro KUBOTA.
 1.163  22-Oct-2008  matt branches: 1.163.6;
NFS hash tables no longer exist.
 1.162  20-Aug-2008  he Restore the "pages actige" and "pages inactive" value printouts
in "vmstat -s" output when run on the active kernel.

The reason we can't easily provide these values out of a crash
dump, is that these fields are no longer proper members of
struct uvmexp, but rather are estimated by and dependent on
the currently active page replacement policy in the kernel.
 1.161  21-Jul-2008  lukem Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.160  24-Jun-2008  he Fix alignment of fields for "vmstat -m" when KMEMSTATS are available:
o Make "prop dictionary" fit in the "Type" coloumn
o Ensure that fields don't run into each other (adds a space between fields)
o Ensure that a Limit of >100000K fits in the field width
 1.159  04-Jun-2008  ad vmstat -s: report cpu pagealloc hits/misses.
 1.158  28-Apr-2008  martin branches: 1.158.2;
Remove clause 3 and 4 from TNF licenses
 1.157  26-Dec-2007  ad branches: 1.157.4;
Merge more changes from vmlocking2, mainly:

- Locking improvements.
- Use pool_cache for more items.
 1.156  20-Dec-2007  ad - Support two different sizes of pool_cache group. The default has 14 or 15
items, and the new large groups (for busy caches) have 62 or 63 items.
- Add PR_LARGECACHE flag as a hint that a pool_cache should use large groups.
This should be eventually be tuned at runtime.
- Report group size for vmstat -C.
 1.155  05-Dec-2007  yamt add -C to usage.
 1.154  07-Nov-2007  ad Add -C option to display pool_cache info, eg:

Pool cache statistics.
Name Spin Full Empty PoolLayer CacheLayer Hit% CpuLayer Hit%
pipepl 0 1 3 385 42862 99.1 985780 95.7
fdescpl 0 0 2 310 31133 99.0 1029620 97.0
cwdipl 0 0 2 310 31227 99.0 1029714 97.0
filepl 0 1 4 680 141415 99.5 24011135 99.4
 1.153  17-Oct-2006  christos branches: 1.153.8;
warns=4, pass lint.
 1.152  16-Oct-2006  christos use howmany(), instead of open-coding the calculation.
 1.151  27-Sep-2006  yamt increase a chance to fit within 80 char width consoles.
- use PRWORD for dovmstat as well.
- reduce number of drives shown by default from 3 to 2.
 1.150  15-Sep-2006  yamt sync with kernel after yamt-pdpolicy merge.
 1.149  15-Aug-2006  kardel PR 34205: workaround struct timeval tv_sec not being SUS compliant issue (reported by Takeshi Nakayama)
 1.148  21-Jul-2006  simonb branches: 1.148.2;
Dump some column widths.
 1.147  09-Jul-2006  kardel accept either "time_second" or "time" as kernel timevariable in
order to support common userland in enviroments where
timecounter kernels and non timecounter kernel co-exist
(e.g. xen & i386)
 1.146  08-Jul-2006  yamt include evcnt.h rather than device.h.
 1.145  07-Jun-2006  kardel support timecounters (struct time gone, use time_second then)
 1.144  02-May-2006  christos branches: 1.144.2;
Coverity CID 884: Avoid NULL deref.
 1.143  02-May-2006  christos Coverity CID 885: Avoid NULL deref.
 1.142  02-May-2006  christos Coverity CID 886: Avoid NULL deref.
 1.141  27-Apr-2006  simonb Unwrap a not too long line.
 1.140  14-Apr-2006  blymn Update statistics reporting to use new kernel framework, rename dkstats*
to a more generic name since it no longer just deals with disk.
 1.139  05-Feb-2006  dsl Split dkreadstats() into dkreadstats(), tkreadstats() and cpureadstats().
Similarly for dkswap().
Allows code to only call one of these.
Rename struct _disk to _vminfo to be nearer its contents.
Change 'systat vm' so that it always shows the 'current' cpu times, even
after ':run' or ':boot' commands. The code in vmstat.c doesn't support :run.
 1.138  22-Oct-2005  nonaka branches: 1.138.2;
Don't forget original allocated memory address.
 1.137  02-Oct-2005  chs optimize pool_caches similarly to how I optimized pools before:
split the single list of pool cache groups into three lists:
completely full, partially full, and completely empty.
use LIST instead of TAILQ where appropriate.
 1.136  07-Aug-2005  blymn Add support for tape statistics.
 1.135  02-Jun-2005  lukem appease gcc -Wuninitialized
 1.134  30-May-2005  chs rename "kbucket" to "kmembuckets", for greater clarity.
don't forget to update vmstat this time.
 1.133  22-May-2005  chs do not rely on the pre-evcnt interrupt counter kernel symbols being present.
if they do not exist, then interrupt stats are all in evcnts.
 1.132  15-May-2005  yamt remove anon related statistics which are no longer used.
 1.131  10-Mar-2005  wiz Add -t to usage.
 1.130  10-Mar-2005  he Add a '-t' option to print the contents of the vmtotal structure,
possibly repeatedly.
 1.129  26-Feb-2005  dsl WARNS=3
 1.128  30-Jan-2005  simonb Remove a blank line.
 1.127  26-Jan-2005  wiz Sync with manpage (add -W, sort).
 1.126  26-Jan-2005  simonb Add a "wide" mode output (selected with -W) to show more information
about memory pools, including pool page size, flags and utilisation.
 1.125  20-Dec-2004  dsainty Correct typo in an error message: allocatior -> allocator
 1.124  05-Nov-2004  dsl Add (unsigned char) cast to ctype functions
 1.123  15-Oct-2004  enami Make vmstat -s prints:
- uvmexp.pdre{anon,file,exec}.
- real number of namecache stats.
 1.122  28-Feb-2004  junyoung pidhash and pgrphash should have been removed from here as well when the
new pid allocator was committed 3/2003.
 1.121  13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.120  22-Jan-2004  dbj fixes to keep default output under 80 columns
reduce default number of disks to 3 from 4
adjust widths of cpu stats if one of them is 100%
always put spaces between # of processes runnable (from pr 12691)
 1.119  28-Sep-2003  simonb Extra columns appeared in one line of the "Memory statistics by type"
header in '94 and '97. Grow the other line a little so that it looks
pretty again.
 1.118  19-Sep-2003  itojun realloc pedant
 1.117  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.116  15-Jul-2003  itojun snprintf
 1.115  02-Jul-2003  simonb No need to cast the third argument of ioctl() to "char *".
 1.114  11-Jun-2003  drochner no need to #include <sys/dkstat.h>
 1.113  06-May-2003  dsl Make vmstat -m skip memory pools that have never been used - unless -v given.
Update man page to match.
 1.112  09-Apr-2003  thorpej Update for cached physical addresses in the pool caches.
 1.111  19-Mar-2003  dsl Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
 1.110  01-Feb-2003  matt The last NULL entry should not be printed on missing symbols.
 1.109  01-Feb-2003  thorpej Update for extensible malloc types.
 1.108  12-Dec-2002  atatat The -u option takes an argument, so we need the corresponding : in the
getopt() string. Does no one use uvm histories any more, or does
everyone just dump all the histories?
 1.107  22-Nov-2002  simonb Remove pc532-only hacks to access wildly different interrupt accounting
now that interrupts are tracked with evcnt(9) on this port.
 1.106  21-Nov-2002  simonb Include <machine/intr.h> to get "struct iv" (in pc532-specific code).
 1.105  18-Nov-2002  nathanw In getuptime(), use kread() to get the current time as well as boottime,
instead of calling time(3).

This makes rate calculations of crash dumps sensible; in contrast,
subtracting the boot time of the crash dump from the current time of the
running system produces a not-very-meaningful number.
 1.104  01-Nov-2002  mrg iostat(8) and systat(8) support for separate read/write disk statistics.
"iostat -x" now shows these (ala linux/solaris), but this is only splitting
the read/write bytes/transactions, not adding any new metrics. "systat
iostat" now has two new commands to switch between combined/separate mode
for both it's numbers & bar modes.
 1.103  18-Sep-2002  mycroft sleep() -> nanosleep()
 1.102  10-Aug-2002  soren Print newline before pool stats.
 1.101  30-Jun-2002  sommerfeld Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.

Fixes I/O rate deflation observed on multiprocessors.
 1.100  13-Mar-2002  simonb branches: 1.100.2;
Don't provide a local declaration of 'struct pool_cache_group' now that
it's in <sys/pool.h>.
 1.99  11-Mar-2002  enami Fix broken indentation.
 1.98  10-Mar-2002  christos fix pool_allocator fallout. bad boy jason!
 1.97  20-Feb-2002  enami Don't forget to fetch pool cache group.
 1.96  20-Feb-2002  enami When printing pool stats, print pool cache stats also if -v is given.
 1.95  28-Jan-2002  simonb Use the new disk and tty stats sysctls when operating on a live kernel,
dk*() don't need to worry about setgid() games anymore.
 1.94  09-Dec-2001  chs replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.93  06-Dec-2001  lukem print average chain length as %8.2f instead of %8d
 1.92  29-Nov-2001  thorpej KERNBASE is a constant that kernland has no business using; it's
existence and value are machine-dependent, and using KERNBASE
either breaks binary compatibility across the same MACHINE_ARCH
or prevents this program from compiling at all.
 1.91  26-Nov-2001  jmc Cast the printf'ing of the 2 size_t vars in dohashstat to unsigned long long as
some ports have size_t's which are larger than int's.
 1.90  26-Nov-2001  lukem - Separate hashstat namelist into separate hashnl[], and don't barf if
some of the symbols can't be found
- Only kvm_nlist() hashnl[] and histnl[] once
- Add a description to struct kernel_hash, and print with -L
- Sort entries in khashes[]
- Don't exit on unknown hashes; just display a warning and move on
 1.89  26-Nov-2001  lukem add stats for nchash & ncvhash
 1.88  26-Nov-2001  lukem - Use -H (instead of -h) to list all hash stats.
- Add '-h hashname' to only list the stats for hashname.
- Add -L to list valid hashes
- Fix up some whitespace
 1.87  26-Nov-2001  lukem - replace -h uvmhist with -u uvmhist, and -H with -U, since uvm history stuff
isn't generally enabled by default, and i wanted -h for something else.
- implement -h, which displays statistics for various kernel hash tables
- add deref_kptr(), which does the hard work of kvm_read() et al
- various minor cleanups
 1.86  21-Nov-2001  enami Check array boundary correctly.
 1.85  21-Nov-2001  enami Print evcnt/intrcnt as unsigned.
 1.84  07-Oct-2001  bjh21 When summarizing pool memory usage, account for PR_RECURSIVE pools
specially so as to avoid counting the same memory twice.
 1.83  26-Aug-2001  matt Adjust vmstat -i / -e for wider event names
 1.82  13-Jun-2001  lukem when printing "avm fre" fields, use " %5ld %5ld " instead of "%6ld%6ld ",
because it's better to slightly right-shift the display than run numbers
together when you've got > 99999KB avm or fre.
 1.81  02-May-2001  thorpej Move the number of page colors to the top of the display.
 1.80  01-May-2001  thorpej Add the number of page colors to uvmexp.
 1.79  29-Apr-2001  thorpej Print print color bucket hit/miss stats.
 1.78  05-Apr-2001  jhawk Make -c and -w work properly when printing non-default statistics.
 1.77  09-Mar-2001  simonb Show number of pages used by executables now that they're are counted
by UVM.
 1.76  27-Jan-2001  enami Prevent integer overflow.
 1.75  27-Jan-2001  enami Cosmetic changes.
 1.74  01-Dec-2000  simonb Don't "extern" variables and function in dkstats.c, declare them in
dkstats.h instead.
 1.73  30-Nov-2000  simonb ANSIfy.
 1.72  30-Nov-2000  simonb Use a better description for the vnode page cache pages.
 1.71  30-Nov-2000  simonb Show anonpages and vnodepages in "vmstat -s".
 1.70  28-Sep-2000  sommerfeld Move cpu header right 3 spaces to match grouping in man page
 1.69  23-Sep-2000  enami Make vmstat -m to put at least one space between each numbers.
 1.68  21-Sep-2000  thorpej Display number of zero page aborts.
 1.67  29-Jun-2000  mrg remove include of <vm/vm.h>
 1.66  04-Jun-2000  cgd branches: 1.66.2;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.65  04-Jun-2000  itojun cp_time is no longer available in the kernel.
remove it from namelist[] to make vmstat work.
 1.64  04-Jun-2000  perry include sys/sched.h to get definition of CPUSTATES
 1.63  24-Apr-2000  thorpej branches: 1.63.2;
Print the zero page statistics.
 1.62  14-Apr-2000  simonb Don't declare 'extern opt*' getopt variables.
 1.61  27-Mar-2000  kleink Cast timeval members to types we know the printf conversions of.
 1.60  05-Dec-1999  fredb More fallout from CL* purge.
 1.59  02-Nov-1999  soren Make pool output fit in 80 columns on most machines.
 1.58  30-Oct-1999  thorpej This program has to use KVM alrady, so use that to read uvmexp, rather
than sysctl. This can now read VM stats from crash dumps.
 1.57  31-Mar-1999  thorpej branches: 1.57.4;
Define __POOL_EXPOSE to get at the guts of the pool descriptor.
 1.56  24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.55  12-Feb-1999  kleink <sys/fcntl.h> -> <fcntl.h>
 1.54  11-Jan-1999  thorpej Nuke all mentions of vmstat -t. PR #6433, Geoff Wing.
 1.53  10-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.52  01-Aug-1998  thorpej Display the number of idle pages per pool.
 1.51  27-Jul-1998  pk Print memory pool statistics.
 1.50  26-Jul-1998  mycroft const poisoning.
 1.49  19-Jul-1998  drochner Fix handling of privileges - the gid was given up before dkinit()
was called.
Pass the gid to use for KVM access explicitely to dkinit(), the caller
decides whether to call setgid(getgid()) or not.
 1.48  06-Jul-1998  mrg - change setgid kmem programs (that lend themselves to this) so setegid(getgid())
and the top, and then set the effective gid back to kmem around the call to
kvm_openfiles(). this reduces the time group kmem is available.
- for those above that also allow this, setgid(getgid()) after the call to
kvm_openfiles() to fully revoke priviledges.
- some KNF
- use err(3) over fprintf(3) in some places
 1.47  05-Jul-1998  mrg KNF.
 1.46  05-Mar-1998  mrg use the uvmexp.pageins member for "pi".
 1.45  13-Feb-1998  thorpej Add support for listing and dumping UVM history buffers.
 1.44  09-Feb-1998  mrg print almost all of uvmexp with -s. do pagein/pageout counts correctly.
also include freed pages count (that was missing from mach vm, but present
in the "output" but hard coded to 0 in vmstat.c.
 1.43  07-Feb-1998  mrg print out the contents of uvmexp for "vmstat -s"
 1.42  07-Feb-1998  mrg flesh out standard vmstat output with UVM.
 1.41  07-Feb-1998  mrg GC old old old "NEWVM". make run under UVM, if not report everything yet..
 1.40  04-Jan-1998  thorpej Revive the -f option: report fork statistics.
 1.39  01-Nov-1997  lukem getopt returns -1 not EOF
 1.38  20-Oct-1997  mrg WARNSify; deprecate register; fix some broken fprintf() statements found from WARNS.
 1.37  18-Oct-1997  mrg merge lite-2.
 1.36  10-Apr-1997  is Repair the formatting of the by-memory-type table of "vmstat -m"
("MSDOSFS mount" is too big for %12s).
Note that this breaks naive parser scripts, but they would not parse
the earlier "MSDOSFS mount" line correctly, anyway.
 1.35  10-Apr-1997  is "undefined" -> "undef/%d" for memory type names. Similar, but not identical
to Ken Raeburns proposal from PR 1012, herewith closed.
 1.34  22-Feb-1997  thorpej If kmem stats are not being gathered by the kernel, print a useful
message to that effect. Fixes PR #3187, submitted by
Guenther Grau <s_grau@ira.uka.de> (fix by me).
 1.33  29-Nov-1996  thorpej Compute `halfuptime' correctly when `uptime' == 1.
From Lennart Augustsson <augustss@cs.chalmers.se>, PR #2944.
 1.32  25-Nov-1996  cgd print all evcnt structures, not just those which have the name "intr".
Printing only those with the name "intr" is too restrictive, because it
means that devices can only have one interrupt, which makes little
sense for many devices and absolutely no sense for several common busses.
 1.31  08-Aug-1996  mycroft Remove straggling references to dk_ndrive and dk_xfer.
 1.30  05-Jun-1996  cgd the kernel 'boottime' variable is a timeval. copy it out of kernel
memory as such (not as a time_t).
 1.29  10-May-1996  thorpej branches: 1.29.4;
New userland code to read the statistics kept by the NetBSD generic
disk framework, from John M. Vinopal <banshee@gabriella.resort.com>
 1.28  04-Apr-1996  cgd update for the fact that 'allevents' is now a TAILQ.
 1.27  10-Oct-1995  cgd print interrupt names in 14 cols. really should be dynamic.
 1.26  08-Oct-1995  cgd don't forget to accumulate interrupt counts found via allevents.
 1.25  08-Oct-1995  cgd fix spacing problem in interrupt/total/rate output line of vmstat -i
 1.24  24-Sep-1995  phil For the pc532, get struct iv from the protected part of <machine/psl.h>.
 1.23  27-Aug-1995  phil pc532 specific interrupt code. (From Matthias Pfaller.)
 1.22  27-Jun-1995  jtc sys/signal.h -> signal.h
 1.21  07-May-1995  cgd fix up RCS ids
 1.20  29-Apr-1995  cgd cast pointers to longs, not ints.
 1.19  17-Apr-1995  ragge VAX machine dependent defs removed.
 1.18  14-Mar-1995  pk Make use of the new kernel event counters; from Theo.
 1.17  24-Dec-1994  cgd size is a size_t!
 1.16  06-Oct-1994  mycroft Fix RCS id format.
 1.15  13-May-1994  cgd re-enable new bucket foo, also widen type name field by one for miscfs mount
 1.14  11-May-1994  cgd rcsids
 1.13  11-May-1994  cgd clean up import. also, stub read_names for the i386, and comment out
some refs to kmem stats fields that we don't have yet. This will need
hacking, (1) for the various ports, (2) for the kmem stuff, and won't
work completely right until those happen, and until the new vm system
is integrated.
 1.12  15-Apr-1994  cgd clean, exported variable (and contents) changes
 1.11  13-Mar-1994  cgd fix to work with new config. SCSI device name support is totally hosed.
 1.10  06-Dec-1993  cgd get rid of __386BSD__ and replace as appropriate with __NetBSD__ and i386
 1.9  10-Nov-1993  deraadt some nice new things
 1.8  02-Oct-1993  cgd widen "Type" field of vmstat -m by 2 characters
 1.7  23-Aug-1993  cgd make various vm counters part of the "standard" nlist (for mw)
 1.6  01-Aug-1993  mycroft Add RCS identifiers.
 1.5  06-Jun-1993  cgd clean up interrupt count printing a bit...
 1.4  25-May-1993  cgd fix dependencies on M_LAST's old off-by-one error...
(arguably, the old error wasn't an error, but, given some
of the old usage of M_LAST and its name, i say it was)
 1.3  21-May-1993  cgd add rcs ids, and update for "arch"
 1.2  04-May-1993  deraadt iostat and vmstat being taught about drives..
 1.1  09-Apr-1993  cgd branches: 1.1.1;
added, from net/2 (patch 124).
 1.1.1.2  01-Mar-1995  mrg 4.4BSD-Lite2
 1.1.1.1  11-May-1994  cgd updated vmstat
 1.29.4.1  05-Jun-1996  cgd pull up from trunk:
>the kernel 'boottime' variable is a timeval. copy it out of kernel
>memory as such (not as a time_t).
 1.57.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.63.2.1  23-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.66.2.2  15-Nov-2001  he Pull up revision 1.82 (requested by lukem):
Change memory display to prevent results from running into
each other.
 1.66.2.1  28-Sep-2000  sommerfeld Pull up:
src/usr.bin/vmstat/vmstat.c 1.70
src/usr.bin/vmstat/vmstat.8 1.19

Fix misc/11086 (inconsistancies between man page and output)
Approved by thorpej
 1.100.2.3  02-Oct-2003  tron Pull up revision 1.119 (requested by simonb in ticket #1487):
Extra columns appeared in one line of the "Memory statistics by type"
header in '94 and '97. Grow the other line a little so that it looks
pretty again.
--
 1.100.2.2  12-Dec-2002  he Pull up revision 1.105 (requested by nathanw in ticket #999):
In getuptime(), use kread() instead of time(3) to get the
current time and boottime. This makes rate calculations
of crash dumps sensible.
 1.100.2.1  30-Jun-2002  lukem Pull up revision 1.101 (requested by sommerfeld in ticket #406):
Since the KERN_CP_TIME sysctl reports total clock ticks across all
cpus and hz is measured in ticks per cpu, divide tick count by ncpu to
determine elapsed time since last sample.
Fixes I/O rate deflation observed on multiprocessors.
 1.138.2.4  01-Jun-2006  kardel Sync with head.
 1.138.2.3  22-Apr-2006  simonb Sync with head.
 1.138.2.2  28-Feb-2006  kardel support __HAVE_TIMECOUNTER kernels
 1.138.2.1  04-Feb-2006  simonb If we have timecounters, read time_second from the kernel for the
current time instead of the time variable.
 1.144.2.1  19-Jun-2006  chap Sync with head.
 1.148.2.1  16-Aug-2006  tron Pull up following revision(s) (requested by kardel in ticket #29):
usr.bin/vmstat/vmstat.c: revision 1.149
PR 34205: workaround struct timeval tv_sec not being SUS compliant issue (reported by Takeshi Nakayama)
 1.153.8.2  09-Jan-2008  matt sync with HEAD
 1.153.8.1  08-Nov-2007  matt sync with HEAD
 1.157.4.2  17-Jun-2008  yamt sync with head.
 1.157.4.1  18-May-2008  yamt sync with head.
 1.158.2.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.158.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.163.6.1  09-Feb-2012  matt Deal with the changes to uvmexp. Use sysctl version when possible.
 1.175.2.2  17-Feb-2011  bouyer Sync with HEAD
 1.175.2.1  08-Feb-2011  bouyer Sync with HEAD
 1.186.2.6  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.186.2.5  23-May-2012  yamt sync with head.
 1.186.2.4  17-Apr-2012  yamt sync with head
 1.186.2.3  28-Dec-2011  yamt page loaning related statistics

6 O->K loan
433958 O->K unloan
0 O->K loan resolved on write to O
0 O->K loan resolved on free of O
1562110 A->K loan
1450785 A->K unloan
108147 A->K loan resolved on write to A
3178 A->K loan resolved on free of A
506926 O->A->K loan
72974 O->A->K unloan
0 O->K loan (zero)
0 O->K unloan (zero)
0 O->A->K loan turned into A->K loan due to write to O
0 O->A->K loan turned into A->K loan due to free of O
50 O->A->K loan turned into O->K loan due to write to A
435568 O->A->K loan turned into O->K loan due to free of A
22761 O->A loan resolved on write to O
602 O->A loan resolved on free of O
1015322 O->A loan resolved on write to A
11431602 O->A loan resolved on free of A
23363 O->A loaned page taken over by anon
12470316 O->A loan for read(2)
 1.186.2.2  14-Nov-2011  yamt might dirty -> possibly dirty
suggested by wiz@
 1.186.2.1  12-Nov-2011  yamt report some more statistics.

373597 file pages known clean
225 file pages might dirty
16 file pages known dirty
0 anonymous pages known clean
2218 anonymous pages might dirty
39055 anonymous pages known dirty
 1.188.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.191.2.1  10-Aug-2014  tls Rebase.
 1.203.2.1  12-Nov-2014  martin Pull up following revision(s) (requested by skrll in ticket #221):
usr.bin/vmstat/vmstat.c: revision 1.204
Print the cpu in the kernhist record.
 1.206.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.206.2.1  04-Nov-2016  pgoyette Sync with HEAD
 1.216.6.5  22-Jul-2019  martin Pull up following revision(s) (requested by mrg in ticket #1304):

usr.bin/vmstat/vmstat.c: revision 1.226

Use PRWORD for printing -m/-mW totals so fields don't run in to each other.

While here, update field widths for 'vmstat -mW' for modern machines.
 1.216.6.4  06-Mar-2018  martin Pull up following revision(s) (requested by nakayama in ticket #606):
usr.bin/vmstat/vmstat.c: revision 1.218
Don't print "nan" when there is no disk activity.
 1.216.6.3  06-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #343):
sys/kern/kern_history.c: revision 1.16
sys/sys/kernhist.h: revision 1.22
usr.bin/vmstat/vmstat.c: revision 1.220
Remove the ABI version-and-length check that was recently introduced;
sysctl(9) ABIs should be stable across versions.
 1.216.6.2  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3)
format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
but it is possible that I've missed some of them. I would be glad
to
update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.216.6.1  25-Jul-2017  snj Pull up following revision(s) (requested by mlelstv in ticket #138):
usr.bin/systat/iostat.c: revision 1.38
usr.bin/systat/vmstat.c: revision 1.82
usr.bin/vmstat/drvstats.c: revision 1.11
usr.bin/vmstat/drvstats.h: revision 1.5
usr.bin/vmstat/vmstat.c: revision 1.217
usr.sbin/iostat/iostat.c: revision 1.65
Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
--
Use I/O timestamps to compute disk statistics for better precisison.
 1.224.4.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.224.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.224.4.1  10-Jun-2019  christos Sync with HEAD
 1.224.2.1  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.227.2.2  17-Jul-2022  martin Pull up following revision(s) (requested by simonb in ticket #1480):

usr.bin/vmstat/vmstat.c: revision 1.255

When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes. Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.
 1.227.2.1  18-Dec-2020  martin Pull up following revision(s) (requested by mrg in ticket #1153):

usr.bin/vmstat/vmstat.c: revision 1.232 (patch)

move the time nlist fetches into their own namelist and only
fetch them when necessary. allow for fallback uses of older
time sources if others are not present.

this stops vmstat from exiting if it can't get the addresses
of these time values it often doesn't need (eg, running kernels
use the sysctl method), which has cropped up recently wit the
removal of boottime variable.

a slighly modified version of this patch (modified to handle
the old boottime variable over the new one) works against a
netbsd-9 vmstat in -current too.
XXX: pullup
 1.258.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed