Comment 2 for bug 1185508

Revision history for this message
Jeff Lane  (bladernr) wrote : Re: [Bug 1185508] Re: memory/info test returns incorrect memory units

On Wed, May 29, 2013 at 12:59 PM, Daniel Manrique
<email address hidden> wrote:
> The parser (checkbox/parsers/meminfo.py) multiplies the number taken
> from /proc/meminfo by 1024; thus, the parser returns *bytes* and not kB:
>
> meminfo[key] = int(integer) * 1024
>
> Then, the memory_compare script considers this is in kB already, hence
> the mismatch; we're off by a factor of 2^10:
>
> print("\t/proc/meminfo reports:\t%s kB" % visible_memory,
> file=sys.stderr)

I thought that may be the case but at the time didn't have time to do
any real investigation.

>
> The dmi parser does the same, here's an instance of a memory module with
> the size reported in bytes:
>
> path: /devices/virtual/dmi/id/device
> category: DEVICE
> vendor: Samsung
> serial: 96FC8ED6
> size: 2147483648
> form: SODIMM
>
>
> So at least memory_compare is comparing apples to apples, even if our apples' size is off by 1024 (yum, a 300-kg apple).
>
> I think this just needs fixing the display in memory_compare script. I'd
> vote for displaying sizes in MB (those large kB numbers are awfully hard
> to visually parse), or maybe being smart enough to choose an appropriate
> unit (for this system with 132 GB, the numbers will also be somewhat
> awkward).

Maybe the best thing to do, really, since the parsers are "back-end"
is have them return the common number (KB) and let the scripts accept
that and do what they will, be it using them as presented or
converting to MB, GB or whatever.