On Thu, 21 Jul 2005 04:27:51 -0600
Tres Melton <[EMAIL PROTECTED]> wrote:

> On Thu, 2005-07-21 at 11:07 +0200, gimpel wrote:
> > On Thu, 21 Jul 2005 10:42:51 +0200
> > gimpel <[EMAIL PROTECTED]> wrote:
> > 
> > > Oh heh. BUG BUG!
> > > It currently still shows KB in memory module where it
> > > should be MB :)
> > > 
> > > cheers!
> > 
> > To answer myself.... 
> > i edited the mem_swap_get() and mem_real_get()
> > stuff in e_mod_main.c line 488ff : MB to GB, KB to MB and B to KB
> > they both seem to return KB values...
> > 
> >   if (bytes > 1048576 )
> >     snprintf(buf, 64, "%ldGB", bytes/1048576);
> >   else if (bytes > 1024 && bytes < 1048576 )
> >     snprintf(buf, 64, "%ldMB", bytes/1024);
> >   else
> >     snprintf(buf, 64, "%ldKB", bytes);
> 
> Regarding the above snippet:  What if bytes == 1048576?  It prints
> lots of bytes.  The second part of the 'else if' is unnecessary since
> it will have short circuited on the 'if'.  And most importantly, I
> have 2GB of ram and at the point where I'm using 1.801GB I don't want
> the thing to say "1GB" or even (2GB) with better rounding, I want to
> know that I'm using 1827MB.  The same thing applies when talking
> about KB although that will probably never show up.  I propose that
> the quantity is kept in the lower units up through 4 digits and roll
> on the fifth.  That will provide a much more accurate display.
> 
>   if (bytes >= 10240000)
>     snprintf(buf, 64, "%ldGB", bytes/1048576);
>   else if (bytes >= 10000)
>     snprintf(buf, 64, "%ldMB", bytes/1024);
>   else
>     snprintf(buf, 64, "%ldKB", bytes);
> 
> Just a thought,
> -- 
> Tres
> 

Forwarded to the mailinglist!  ;)

The above was only a temporary fix to force it to show MB instead of
KB. Not meant to be a real solution. 
if RAM > 1GB is in use, it would simply (and ugly) round it up, right.

Ed ^^ :)

regards!
tom

Attachment: pgpork0xx8uvo.pgp
Description: PGP signature

Reply via email to