Bug 256542 - vmstat -z output columns are not aligned
Summary: vmstat -z output columns are not aligned
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-10 21:13 UTC by ghuckriede
Modified: 2021-06-19 15:07 UTC (History)
1 user (show)

See Also:


Attachments
Potential Fix (1.34 KB, patch)
2021-06-10 21:13 UTC, ghuckriede
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>