Bug 242350 - vmstat: add space between "fre" and "flt" field in text format
Summary: vmstat: add space between "fre" and "flt" field in text format
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.3-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-12-02 06:21 UTC by minmin
Modified: 2019-12-02 06:30 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description minmin 2019-12-02 06:21:32 UTC
In my FreeBSD server, vmstat reports the follows.
====================================
procs     memory        page                    disks     faults         cpu
r b w     avm     fre  flt  re  pi  po    fr   sr ad0 md99   in    sy    cs us sy id
1 0 0  402856  138956    0   0   0   0     0   47   1   0   43   169   126  1  0 99
1 0 0  402856  138940   91   0   0   0    86   47   9   0  128   683   340  2  0 98
1 0 0  553772   88508 3354   0   0   0   576   50  24   0  380  2487   878 16  1 83
55 0 0 1403424   2014827881   4   2   0 25098 18597  26   1  541 14644  1111 78 12  9
45 0 5 1544552    6396 7979 412   8 301  6708 301295 874 298 1381  4570  4770 29  9 62
15 0 4 1548180   66284 5619 175  50 1099 11022 22044 1013 367 4636  6704 16617 13  4 83
7 0 28 1659472   1602811158 430  42 363 10102 6736 896 311 1740  7383  6149 29  8 63
0 0 39 1654176   18220 8308 878  34 267  8280 7793 891 287 1167  3218  4333 18  6 76
0 0 33 1553232   68684 2556 130  15  14  4045  623  80  25  184   905   619  4  1 95
1 0 24 1453984  117764 2566   0   2   0  3584  217   7   2   75   718   225  4  0 96
1 0 12 1338444  165204 1975   0  14   0  2981  200  13  14   85   397   287  2  0 98
0 0 3 1222904  212396 3691   0  15   0  2919  185  31  15  220  1080   647  6  2 92
0 0 3 1130472  261972  238   0   4   0  2645  169   3   4   39   225   137  0  0 100
====================================

It is difficult to separate value of "fre" and "flt" from above example.
I made quick patch to solve this problem. Here it patch. And, It works fine for me.

Thanks in advance.

--- src/usr.bin/vmstat/vmstat.c-   2019-07-25 11:53:04.499680000 +0900
+++ src/usr.bin/vmstat/vmstat.c    2019-11-28 15:49:54.655633000 +0900
@@ -794,7 +794,8 @@
                        xo_emit("{:free-memory/%7d}",
                            vmstat_pgtok(total.t_free));
                }
-               xo_emit("{:total-page-faults/%5lu} ",
+               xo_emit(" ");
+               xo_emit("{:total-page-faults/%4lu} ",
                    (unsigned long)rate(sum.v_vm_faults -
                    osum.v_vm_faults));
                xo_close_container("memory");