[Toybox] [PATCH] top: don't report GiB sizes in KiB.
jmakip87 at gmail.com
Fri Sep 4 23:42:06 PDT 2020
On Fri, Sep 4, 2020 at 9:22 AM Rob Landley <rob at landley.net> wrote:
> On 9/3/20 9:56 AM, enh wrote:
> > I think hard-coded MiB would be fine for me right now,
> I'm worried that on embedded systems that _don't_ have gigs of memory, kilobytes
> may be the desired units, so auto-adjusting makes sense. (If you have 16 megs
> ram you care about a 300k fluctuation which you can't even SEE if the units are
> > but -- re-reading the
> > full discussion from last time rather than relying on my memory -- it seems like
> > your main complaint the first time I tried to fix this was that you didn't like
> > the possibility of not using the same unit for every value.
> I don't, but it's a lesser of two evils kind of thing.
> > So hard-coding MiB
> > might be better in that it would be more likely to stick rather than getting
> > reverted.
> Given that I'd be the one doing the reverting and I'm suggesting this solution... :)
> Ok, human_readable_long() is more or less only used directly by ps.c. (The other
> 2 files are demo_number.c and lib/lib.c wrapping it in human_readable()
> providing defaults for the micromanagement fields.) So instead of detecting
> "units" from 0 I can feed it a minimum units (k=1, M=2, and so on). So I can
> have the ps.c check the total size field and if it's 10 gig or larger force
> megabytes, and otherwise do kilobytes. (It's gotta be at least kilobytes because
> the granularity of the input is kilobytes anyway...)
> I pushed a change. On my laptop it now looks like:
> Mem: 15,955M total, 15,426M used, 528M free, 151M buffers
> Swap: 16,286M total, 523M used, 15,763M free, 1594M cached
Comma is a decimal separator in Finland and also in some other parts
of Europe. So quick glance I thought you have 16megs of ram.
I would drop thousands separators since it's probably more confusing
Ubuntu with my locale settings actually gives me this, and i'm not
even sure what is the meaning of the number after comma :)
MiB Mem : 15936,4 total, 13507,9 free, 1196,7 used, 1231,9 buff/cache
MiB Swap: 2048,0 total, 2048,0 free, 0,0 used. 14407,5 avail Mem
> Even though the top in debian is still doing:
> KiB Mem : 16337976 total, 524876 free, 13746900 used, 2066200 buff/cache
> KiB Swap: 16677884 total, 16141660 free, 536224 used. 1502312 avail Mem
> Which is why my output ooked like it did before. Sigh. I have NO idea why they
> renamed "cached" to "avail mem", it isn't unless you wanna fight the balance
> logic or echo 3 > /proc/sys/vm/drop_caches
> > Want me to send that patch?
> I have a tropism for "what we're doing makes logical sense" vs just "tweak to
> fix the problem I hit". I tend to want a _systemic_ fix, which is inconvenient
> at times. :)
> Toybox mailing list
> Toybox at lists.landley.net
More information about the Toybox