Ticket #9170: trac_9170.patch

File trac_9170.patch, 912 bytes (added by Dima Pasechnik, 10 years ago)

enabling it on Cygwin

  • sage/misc/getusage.py

    # HG changeset patch
    # User Dmitrii Pasechnik <dimpase@gmail.com>
    # Date 1359277558 -28800
    # Node ID 02809377141cf668718d67b4d26f5ec299ca991f
    # Parent  f4cbda7c354e4f5c27adb054b495dcafce5d5db1
    make get_memory_usage() to work on Cygwin
    
    diff --git a/sage/misc/getusage.py b/sage/misc/getusage.py
    a b  
    5353        cmd = 'top -l 1 |grep "^ *%s "' % pid
    5454    elif U == 'sunos':
    5555        cmd = '/usr/bin/prstat -n 100000 1 1  | grep "^ *%s "' % pid
     56    elif U[:6] == 'cygwin':
     57        cmd = 'top -b -n 1 -p %s' % pid
    5658    else:
    5759        raise NotImplementedError("top not implemented on platform %s" % U)
    5860   
     
    109111          ``top`` is not used on OS X.
    110112    """
    111113    U = os.uname()[0].lower()
    112     if U == 'linux':
     114    if U == 'linux' or U[:6] == 'cygwin':
    113115        m = linux_memory_usage()
    114116    elif U == 'darwin':
    115117        try: