[yt-svn] commit/yt: MatthewTurk: Removing the memory fallback function.

Bitbucket commits-noreply at bitbucket.org
Wed May 9 18:29:32 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/cb1c91fa33e8/
changeset:   cb1c91fa33e8
branch:      yt
user:        MatthewTurk
date:        2012-05-10 03:29:24
summary:     Removing the memory fallback function.
affected #:  1 file

diff -r 2e81827abac46f1c973dfda9897047b1c4541e3b -r cb1c91fa33e87e778f992f2ff25c2e50849fcc96 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -94,22 +94,6 @@
 except ImportError:
     pass
 
-def __memory_fallback(pid):
-    """
-    Get process memory from a system call.
-    """
-    value = os.popen('ps -o rss= -p %d' % pid).read().strip().split('\n')
-    if len(value) == 1: return float(value[0])
-    value.pop(0)
-    for line in value:
-        online = line.split()
-        if online[0] != pid: continue
-        try:
-            return float(online[2])
-        except:
-            return 0.0
-    return 0.0
-
 def get_memory_usage():
     """
     Returning resident size in megabytes
@@ -118,10 +102,10 @@
     try:
         pagesize = resource.getpagesize()
     except NameError:
-        return __memory_fallback(pid) / 1024
+        return -1024
     status_file = "/proc/%s/statm" % (pid)
     if not os.path.isfile(status_file):
-        return __memory_fallback(pid) / 1024
+        return -1024
     line = open(status_file).read()
     size, resident, share, text, library, data, dt = [int(i) for i in line.split()]
     return resident * pagesize / (1024 * 1024) # return in megs

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list