On Jan 13, 3:50 pm, "William Stein" <wst...@gmail.com> wrote:
> On Tue, Jan 13, 2009 at 3:42 PM, mabshoff
<SNIP>
> > In general we are using crappy interfaces to measure memory
> > consumption from Sage, i.e. get_memory_usage(). We are even parsing
> > the output from "top" on non-Linux platforms!
>
> Sage uses /proc/pid/status on Linux. I don't know if this is "crappy"
> or not; it's code that I got
> fromhttp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286222
> Python Cookbook, by Jean Brouwers
Yes, that is the same "crappy" interface that top uses :). top's
numbers are somewhat accurate if you have a single program linking
against a couple shared libs that aren't used by other programs. But
in many situations these days, i.e. running a KDE or Gnome application
with often dozens of shared libs used by a lot of different programs
the numbers are just crap and inaccurate. This is what those blog
posts complain about since top makes KDE and Gnome look much more
bloated than they actually are.
> On OSX, indeed it just naively reads top, which is... well just as
> good or bad as top at reporting a valid number. I don't know whether
> OS X top is sensible or not, though I don't see why it would be wrong.
Solaris doesn't even ship top, you have to compile it yourself. And
even then if you compile a top in 32 bit mode it will not tell you the
amount of memory consumed by 64 bit programs. All this can and has
been worked around, but something more native on some platforms might
come in useful. I am bot sure if the answer here is getrusage(), but I
don't think it will be. If you know the limitations of
get_memory_usage() you can work around them. Case in point from 3.2.3
right after startup:
64 bit linux, i.e. sage.math:
sage: get_memory_usage()
668.32421875
----
32 bit OSX 10.5:
sage: get_memory_usage()
'131M+'
----
64 bit OSX 10.5:
sage: get_memory_usage()
'171M+'
---
32 bit Solaris/Sparc:
sage: get_memory_usage()
'81M'
While there should be a difference between 32 and 64 bit, i.e 64 bit
code is larger and consumes more memory, the result from Linux is not
even close to the truth, i.e. I don't think 32 bit Solaris is roughly
a magnitude more efficient than 64 bit Linux.
Either way, the result of get_memory_usage() should be consistent
across platforms and not return a string in some cases and something
else on Linux. It should be a float of the memory used in MB.
> William
Cheers,
Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---