[Bug 256542] vmstat -z output columns are not aligned

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 10 Jun 2021 21:13:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256542

            Bug ID: 256542
           Summary: vmstat -z output columns are not aligned
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ghuckriede@blackberry.com

Created attachment 225717
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=225717&action=edit
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>

-- 
You are receiving this mail because:
You are the assignee for the bug.