Get resource usage of process

AUTHORS:

  • William Stein (2006-03-04): initial version
sage.misc.getusage.VmB(VmKey)
Function used internally by this module.
sage.misc.getusage.get_memory_usage(t=None)

Return memory usage.

INPUT:

  • t - None or output of previous call; (only used on Linux)

OUTPUT:

  • Linux - Returns float number (in megabytes)
  • OS X - Returns float number (in megabytes) that matches VSIZE column of top
  • other - not implemented for any other operating systems

EXAMPLES:

We test that memory usage doesn’t change instantly:

sage: t = get_memory_usage()
sage: get_memory_usage(t)          # amount of memory more than when we defined t.
0.0
sage.misc.getusage.linux_memory_usage()
Return memory usage in megabytes.
sage.misc.getusage.top()

Return the top output line that contains this running Sage process.

EXAMPLES:
sage: top() # random output ‘72373 python 0.0% 0:01.36 1 14+ 1197 39M+ 34M+ 55M+ 130M+’

Previous topic

A tool for inspecting Python pickles

Next topic

Multidimensional enumeration

This Page