[yt-svn] commit/yt: 2 new changesets
Bitbucket
commits-noreply at bitbucket.org
Sun Nov 20 10:52:26 PST 2011
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/changeset/87be29b08d14/
changeset: 87be29b08d14
branch: yt
user: brittonsmith
date: 2011-11-19 21:27:42
summary: Added fallback for getting memory usage for systems that don't
have /proc directory.
affected #: 1 file
diff -r 68227951f9b3fd2ed391ef63c44fbb49c06760a0 -r 87be29b08d149defdc57f9f9600d5806f014a268 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -124,14 +124,15 @@
"""
Returning resident size in megabytes
"""
+ pid = os.getpid()
+ fallback = float(os.popen('ps -o rss= -p %d' % pid).read()) / 1024
try:
pagesize = resource.getpagesize()
except NameError:
- return 0
- pid = os.getpid()
+ return fallback
status_file = "/proc/%s/statm" % (pid)
if not os.path.isfile(status_file):
- return 0.0
+ return fallback
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
https://bitbucket.org/yt_analysis/yt/changeset/a9d0a3e89a59/
changeset: a9d0a3e89a59
branch: yt
user: brittonsmith
date: 2011-11-20 19:44:40
summary: Put fallback method for getting memory usage inside the if tree so
it doesn't get called all the time.
affected #: 1 file
diff -r 87be29b08d149defdc57f9f9600d5806f014a268 -r a9d0a3e89a5994dcaa63ab876051b160025a79a2 yt/funcs.py
--- a/yt/funcs.py
+++ b/yt/funcs.py
@@ -125,14 +125,13 @@
Returning resident size in megabytes
"""
pid = os.getpid()
- fallback = float(os.popen('ps -o rss= -p %d' % pid).read()) / 1024
try:
pagesize = resource.getpagesize()
except NameError:
- return fallback
+ return float(os.popen('ps -o rss= -p %d' % pid).read()) / 1024
status_file = "/proc/%s/statm" % (pid)
if not os.path.isfile(status_file):
- return fallback
+ return float(os.popen('ps -o rss= -p %d' % pid).read()) / 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