Created attachment 144803 [details] vmstat.diff vmstat(8): fix formatting to fit in 80 cols. Fix formatting so that it looks cleaner on standard 80 cols displays and it's not wrapping so often. ---------------------------------[BEFORE]---------------------------------------- zork $ vmstat procs memory page disks faults cpu r b w avm fre flt re pi po fr sr ad0 cd0 in sy cs us sy i d 1 0 0 446M 70M 16 0 0 0 17 5 0 0 407 188 141 0 0 1 00 ---------------------------------[AFTER]----------------------------------------- zork $ vmstat procs memory page disks faults cpu r b w avm fre flt re pi po fr sr ad0 cd0 in sy cs us sy id 1 0 0 446M 70M 16 0 0 0 17 5 0 0 407 187 141 0 0 100
Created attachment 147490 [details] output on freefall The idea looks good, but output on a busy system still overflows. Suggest some more tweeking is needed.
Created attachment 147495 [details] vmstat.diff
(In reply to Kirk McKusick from comment #1) > Created attachment 147490 [details] > output on freefall > > The idea looks good, but output on a busy system still overflows. Suggest > some more tweeking is needed. New diff attached. It reserves at least '%4lu' for parameters that are known to cause overflow.
Created attachment 147560 [details] extended run of vmstat on freefall
Further (extended) run of vmstat with revised patch. Different fields are now blowing it out. It may be that the best way to fix it is to use the prthuman() function to bound the size of fields that may get too large. It may also be sensible to check the width of the window and use that value to determine how many disk drives to display.
Created attachment 147697 [details] vmstat.diff
Created attachment 147698 [details] vmstat.diff
New revised patch. I'm not a big fan of using prthuman() to display fields which should stay the way they are from the historical perspective. Also, by the default only two drives are displayed unless you change it with '-n' switch, so there is no reason to check TIOCGWINSZ. This patch still can make vmstat(8) wrap in extreme cases, but it looks much cleaner in 95% of cases now (much better than first patch).
Created attachment 148344 [details] vmstat.diff
A commit references this bug: Author: mckusick Date: Fri Oct 24 04:01:15 UTC 2014 New revision: 273575 URL: https://svnweb.freebsd.org/changeset/base/273575 Log: Fix formatting of vmstat (1) so that it looks cleaner on standard 80 column displays. In particular it wraps far less often. Submitted by: Andy Kosela <akosela@andykosela.com> PR: 191976 Changes: head/usr.bin/vmstat/vmstat.c