Ticket #11971: 11971_getrusage.patch

File 11971_getrusage.patch, 2.4 KB (added by jdemeyer, 8 years ago)
  • sage/misc/getusage.py

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1320083936 -3600
    # Node ID 3ecc6dc8be815f6585717d8dc5a7fa5a37890ce1
    # Parent  4b9edadd8ff03d9a4e865c6119b9ddac3f6e3609
    Fix get_memory_usage() test
    
    diff --git a/sage/misc/getusage.py b/sage/misc/getusage.py
    a b  
    7676    - ``Linux`` - Returns float number (in megabytes)
    7777   
    7878    - ``OS X`` - Returns float number (in megabytes) that matches
    79       VSIZE column of 'top'
     79      VSIZE column of ``top``
    8080
    8181    - ``Solaris or OpenSolaris`` - Returns float number (in megabytes)
    82       that matches RSS column of 'prstat'. Depending on the memory
    83       usage, 'prstat' will output the data in KB, MB or GB. In each
     82      that matches RSS column of ``prstat``. Depending on the memory
     83      usage, ``prstat`` will output the data in KB, MB or GB. In each
    8484      case, the value returned by this function will always be in MB.
    8585
    8686    - ``other`` - not implemented for any other operating systems
    8787
    88     EXAMPLES:
     88    EXAMPLES::
    8989   
    90     We test that memory usage doesn't change instantly::
    91    
     90        sage: t = get_memory_usage(); t  # random
     91        873.98046875
     92
     93    We test that memory usage doesn't change instantly.  Hopefully,
     94    re-using the variable `t` means no additional memory will be
     95    allocated::
     96
    9297        sage: t = get_memory_usage()
    93         sage: get_memory_usage(t)          # amount of memory more than when we defined t.
     98        sage: get_memory_usage(t)
    9499        0.0
    95100
    96     NOTES:
     101    .. NOTE::
    97102     
    98     - Currently, :func:`get_memory_usage` calls 'prstat' on Solaris
    99       and OpenSolaris to get the data it requires. In the long term, a
    100       better solution would be to use Solaris system calls.
     103        * Currently, :func:`get_memory_usage` calls ``prstat`` on Solaris
     104          and OpenSolaris to get the data it requires. In the long term, a
     105          better solution would be to use Solaris system calls.
    101106
    102     - In some instances, 'top' may be used on OS X. This may break if
    103       the memory usage is greater than 9999 MB. However, normally
    104       'top' is not used on OS X.
     107        * In some instances, ``top`` may be used on OS X. This may break
     108          if the memory usage is greater than 9999 MB. However, normally
     109          ``top`` is not used on OS X.
    105110    """
    106111    U = os.uname()[0].lower()
    107112    if U == 'linux':