This is a nice effort, but one wonders why the author doesn’t want to use vmstat(8).
Side note: The author doesn’t seem to be too familiar with OpenBSD and its conventions. The man page was written in man(7), which is deprecated in favor of mdoc(7) on OpenBSD
Thanks for educating me about the distinction: https://github.com/blinkkin/blinkkin.github.com/wiki/man-vs-mdoc
I’d suggest Practical UNIX Manuals for introductionary reading for mdoc, too: https://manpages.bsd.lv/mdoc.html
Thanks very much for your pointing out to use mdoc!
Compared to vmstat(8), my simple toy has following differences:
(1) Add displaying swap space;
(2) Only consider active pages as “used” memory, others are all counted as “free” memory.IMHO, for the end user who doesn’t care the guts of Operating System, maybe this method is more plausible?
All in all, I just write a small tool for fun, and thanks very much again for giving pertinent advice!
Agreed. Sometimes you don’t really care about everything vmstat offers. free is dirty neat :)
P.S. After some testing, I modify the calculating free method just now: use free pages as “free” memory, then others are considered as “used” memory.