Revision: 8947
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8947&view=rev
Author: efiring
Date: 2011-02-05 21:57:21 +0000 (Sat, 05 Feb 2011)
Log Message:
-----------
cbook.report_memory: add Windows support via "tasklist"
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2011-02-05 20:56:02 UTC (rev 8946)
+++ trunk/matplotlib/CHANGELOG 2011-02-05 21:57:21 UTC (rev 8947)
@@ -1,3 +1,6 @@
+2011-02-05 Add cbook memory monitoring for Windows, using
+ tasklist. - EF
+
2011-02-05 Speed up Normalize and LogNorm by using in-place
operations and by using float32 for float32 inputs
and for ints of 2 bytes or shorter; based on
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2011-02-05 20:56:02 UTC (rev
8946)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2011-02-05 21:57:21 UTC (rev
8947)
@@ -1233,7 +1233,7 @@
def report_memory(i=0): # argument may go away
'return the memory consumed by process'
- from subprocess import Popen, PIPE
+ from subprocess import Popen, PIPE, check_output
pid = os.getpid()
if sys.platform=='sunos5':
a2 = Popen('ps -p %d -o osz' % pid, shell=True,
@@ -1247,7 +1247,12 @@
a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
stdout=PIPE).stdout.readlines()
mem = int(a2[1].split()[0])
-
+ elif sys.platform.startswith('win'):
+ a2 = check_output(["tasklist", "/nh", "/fi", "pid eq %d" % pid])
+ mem = int(a2.strip().split()[-2].replace(',',''))
+ else:
+ raise NotImplementedError(
+ "We don't have a memory monitor for %s" % sys.platform)
return mem
_safezip_msg = 'In safezip, len(args[0])=%d but len(args[%d])=%d'
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins