[Toybox] [PATCH] vmstat: increase column sizes
Petri Gynther
pgynther at google.com
Wed May 20 16:40:00 PDT 2020
Increase memory:swpd,free,cache to 7 characters
Increase swap:si,so to 5 characters
Increase system:in,cs to 5 characters
Sample output from Pixel 4 phone:
procs ------------memory------------ ----swap--- -----io---- ---system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
4 0 1111676 87896 6328 2268596 8152 11896 10712 14280 0 25712 31 21 46 3
17 0 1082788 224292 5972 2213996 73220 68908 2432 3948 1 26611 41 38 22 0
6 0 1127316 203196 5972 2225164 8980 53996 11796 788 0 25200 33 22 45 1
0 0 1133072 200984 5972 2225280 416 6260 52 88 0 8543 10 6 84 0
2 0 1128976 196976 5972 2225692 3588 0 340 800 0 5243 5 4 91 0
---
toys/other/vmstat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c
index 44f73d49..d5cf5691 100644
--- a/toys/other/vmstat.c
+++ b/toys/other/vmstat.c
@@ -78,7 +78,7 @@ void vmstat_main(void)
int i, loop_delay = 0, loop_max = 0;
unsigned loop, rows = 25, page_kb = sysconf(_SC_PAGESIZE)/1024;
char *headers="r\0b\0swpd\0free\0buff\0cache\0si\0so\0bi\0bo\0in\0cs\0us\0"
- "sy\0id\0wa", lengths[] = {2,2,6,6,6,6,4,4,5,5,4,4,2,2,2,2};
+ "sy\0id\0wa", lengths[] = {2,2,7,7,6,7,5,5,5,5,5,5,2,2,2,2};
memset(top, 0, sizeof(top));
if (toys.optc) loop_delay = atolx_range(toys.optargs[0], 0, INT_MAX);
@@ -98,7 +98,7 @@ void vmstat_main(void)
if (!(toys.optflags&FLAG_n) && isatty(1)) terminal_size(0, &rows);
else rows = 0;
- printf("procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----\n");
+ printf("procs ------------memory------------ ----swap--- -----io---- ---system-- ----cpu----\n");
for (i=0; i<sizeof(lengths); i++) {
printf(" %*s"+!i, lengths[i], header);
header += strlen(header)+1;
--
2.26.2.761.g0e0b3e54be-goog
More information about the Toybox
mailing list