[Toybox] [PATCH] top: don't report GiB sizes in KiB.

enh enh at google.com
Mon Sep 14 15:42:41 PDT 2020


On Mon, Sep 14, 2020 at 2:33 PM Rob Landley <rob at landley.net> wrote:

> On 9/14/20 2:49 PM, enh wrote:
> > i think it will, it's just neither very helpful nor clear:
> >
> > ~$ top --version
> > top: inappropriate '-version'
> > Usage:
> >   top -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w
> [cols]
> > ~$ top -v
> >   procps-ng 3.3.16
> > Usage:
> >   top -hv | -bcEHiOSs1 -d secs -n max -u|U user -p pid(s) -o field -w
> [cols]
> > ~$
> >
> > even when it works, it manages to make it look like a syntax error!
>
> Ah, I missed that.
>
> $ top -v
>   procps-ng 3.3.12
>
> > but, yeah, sounds like you have an older version, which at least answers
> the
> > question of which direction they're moving in.
>
> *shrug* I checked in https://github.com/landley/toybox/commit/5b7cc6d6c2a5
> as my
> best guess how to fix all this. Does that cover it? It removes the commas
> and
> replaces it with an HR_NODOT flag to not do the 0.0 thing for single digit
> outputs, and keeps the "force megabytes for 10G and up". Wastes horizontal
> space, but...
>

i'm not sure "use all 80 columns" is actually a goal :-)

the current code definitely looks good on a medium-sized machine:

  Mem:    63978M total,    55294M used,     8684M free,     1889M buffers
 Swap:    56095M total,        7M used,    56088M free,    37331M cached

ironically it's less readable on low and mid-range phones, here a mid-range
4GiB device:

  Mem:  4024836K total,  3976272K used,    48564K free,     4276K buffers
 Swap:  3018620K total,        0K used,  3018620K free,  3258468K cached

personally i'd have gone with 1GiB rather than 10GiB so you get at most 6
digits rather than 7 --- i guess i'm just below average and you're above[1]
:-)

time and Moore's law will solve this anyway, given that the largest phones
already have 12GiB! (although laptops for real people seem to have stalled
at 8GiB, so maybe that will happen with phones too.)


> Rob
>


____
1. https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20200914/7e45fedc/attachment.htm>


More information about the Toybox mailing list