Bug 256542

Summary: vmstat -z output columns are not aligned
Product: Base System Reporter: ghuckriede
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: emaste
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272438
Attachments:
Description Flags
Potential Fix none

Description ghuckriede 2021-06-10 21:13:08 UTC
Created attachment 225717 [details]
Potential Fix

vmstat -z currently has:
- a missing space in the column header between SIZE and LIMIT
- a missing space in the column header between FAIL and SLEEP
- inconsistent column spacing between header and values for REQ, FAIL, SLEEP, and XDOMAIN columns

The included diff uses the following column sizes:
- REQ is 8 bytes (could also be 4 bytes if libxo doesn't mind having values sized differently than 'requests' field name)
- SLEEP is 5 bytes (to fit column name)
- XDOMAIN is 7 bytes (to fit column name)

N.B. Could also make SLEEP and XDOMAIN column sizes be 6 and 8, but then the default length would exceed 80 characters.


Current output:
# vmstat -z
ITEM                   SIZE  LIMIT     USED     FREE      REQ     FAILSLEEP XDOMAIN
<SNIP>
mbuf_packet:            256,      0,       0,       0,       0,   0,   0,   0
mbuf:                   256, 4946937,       1,      14,       1,   0,   0,   0
mbuf_cluster:          2048, 772959,       0,       0,       0,   0,   0,   0
mbuf_jumbo_page:       4096, 386479,       0,       0,       0,   0,   0,   0
mbuf_jumbo_9k:         9216, 114512,       0,       0,       0,   0,   0,   0
mbuf_jumbo_16k:       16384,  64413,       0,       0,       0,   0,   0,   0
<SNIP>

Output with diff applied:
# vmstat -z
ITEM                   SIZE  LIMIT     USED     FREE      REQ FAIL SLEEP XDOMAIN
<SNIP>
mbuf_packet:            256,     0,       0,       0,       0,   0,    0,      0
mbuf:                   256,4946937,       1,      14,       1,   0,    0,      0
mbuf_cluster:          2048,772959,       0,       0,       0,   0,    0,      0
mbuf_jumbo_page:       4096,386479,       0,       0,       0,   0,    0,      0
mbuf_jumbo_9k:         9216,114512,       0,       0,       0,   0,    0,      0
mbuf_jumbo_16k:       16384, 64413,       0,       0,       0,   0,    0,      0
<SNIP>