[Toybox] [PATCH] vmstat: fix units for bi and bo columns

Rob Landley rob at landley.net
Tue Sep 1 23:29:22 PDT 2015


On 09/01/2015 05:54 PM, enh wrote:
> (from https://android-review.googlesource.com/#/c/169271/.)
> 
> Author: Colin Cross <ccross at android.com>
> Date:   Tue Sep 1 15:41:34 2015 -0700
> 
>     vmstat: fix units for bi and bo columns
> 
>     pgpgin and pgpgout in /proc/vmstat are in kbytes, not pages.
>     (see http://lxr.free-electrons.com/source/mm/vmstat.c?v=4.2#L1310).
>     Remove the extra * page_kb for io_in and io_out.

Yay improvement.

> diff --git a/toys/other/vmstat.c b/toys/other/vmstat.c
> index 5b79702..870da48 100644
> --- a/toys/other/vmstat.c
> +++ b/toys/other/vmstat.c
> @@ -2,7 +2,7 @@
>   *
>   * Copyright 2012 Elie De Brauwer <eliedebrauwer at gmail.com>
>   *
> - * TODO: I have no idea how the "io" and "system" categories are calculated.
> + * TODO: I have no idea how "system" category is calculated.
>   * whatever we're doing isn't matching what other implementations are doing.

I'm not sure I'd go that far...

landley at macbuntu:~/toybox/toy2$ ./vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0 142236 1271604 300992 4598732  1    1    36    41    0  321  6  1 92  0
landley at macbuntu:~/toybox/toy2$ vmstat
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0 142236 1269000 301000 4600260    0    0    33    38   53   19  6  1 92  0  0

Ran both twice and it's consistent, ours is producing
bi=36, bo=41 and ubuntu is saying bi=33 bo=48 from
the same input data. (It's presumably close enough,
but I still dunno what the numbers _mean. Binary/decimal
rounding?)

Still: yay improvement. Applied.

Thanks,

Rob

 1441175362.0


More information about the Toybox mailing list