On Sun, Jan 25, 2015 at 12:15 PM, Rob Landley <r...@landley.net> wrote:
> On 01/17/15 00:09, enh wrote:
>> more progress...
> ...
>> I’ve moved the following commands over to toybox, removing the old
>> toolbox implementations:
>>
>>     vmstat
>
> Going into a bit more depth on vmstat, on my netbook right now:
>
> $ vmstat
> procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
>  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
>  7  0 2677468 163892 129332 970508   15   12   132   117    2   15 37  7 54  2
> $ ./toybox vmstat
> procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
>  r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
>  2  0 2677468 166900 129376 971616  14   11   473   418    0  777 37  7 54  2
>
> The "memory" and "system" fields (swpd, free, buff, cache, us, sy, id, wa)
> look right. (And at least mine gets the rounding right. :)
>
> The "swap" fields (si/so) are close but _consistently_ off by one, some
>  sort of rounding difference?.
>
> The i/o stuff isn't even close and I haven't got a clue what it thinks
> it's reporting. The ratios are consistent but:
>
>>>> print 473.0/132.0
> 3.58333333333
>>>> print 418/117.0
> 3.57264957265
>
> Three and a bit? (Rounding _and_ different block size...?)
>
> And then there's "system". I have no idea what that's displaying.

   System
       in: The number of interrupts per second, including the clock.
       cs: The number of context switches per second.

iirc, toybox, toolbox, and desktop procps were all in disagreement in
one way or another.

also, my desktop vmstat has more columns than yours:

procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  1 2314312 2398456 1818852 49500840    0    0     7    42    2    2
 6  1 93  0  0

the man page also explains what 'st' is:

       st: Time stolen from a virtual machine.  Prior to Linux 2.6.11, unknown.

> Also, vmstat and ls both do variable indenting of fields, but use completely
> different implementations that don't genericize easily. (ls is doing readahead
> and measuring, vmstat has an array of fields each marked with a padding
> length and if it goes over it forces the padding of all future fields to one
> space until it's back under budget. Not really the same, but the human
> readable changes pending elsewhere open this can of worms in a _third_ way...)

as shown above, desktop vmstat isn't even close to lining up.
presumably hardware was much less meaty the last time anyone was
seriously maintaining this code? oh; turns out there's an option:

       -w, --wide
              Wide output mode (useful for systems with higher amount of  mem‐
              ory,  where the default output mode suffers from unwanted column
              breakage).  The output is wider than 80 characters per line.

but it's off by default, even if you have lots of RAM.

neither toolbox nor toybox implemented -f, -m, -s, -d, et cetera, and
i hadn't even heard of any of those options until i read the man page
to learn what some of the fields in the regular output are supposed to
mean.

> So that's why _that_ one is in the pending README.
>
> Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to