[mnet-devel] Memory and FEC

Zooko zooko at zooko.com
Wed Jul 23 21:08:18 BST 2003


Here's a patch to your script.  (It still works only on Linux, though.)

--- fectest-orig.py     2003-07-23 16:07:42.000000000 -0400
+++ fectest.py  2003-07-23 16:07:38.000000000 -0400
@@ -2,6 +2,8 @@
 
 import sys
 
+from pyutil import memutil
+
 from mnetlib.filesystem import fec
 
 def memfec(fn):
@@ -10,22 +12,14 @@
     en = fec.RizzoEncoder(ff, 2048*1024, 2)
     
     for ii in range(en.k, en.m):
-        print "mem: %s" % getmem()
+        print "mem: %s" % memutil.get_mem_usage()
         print "block index: %s" % ii
         pkt = en.generate_packet(ii)
         del pkt
-        print "mem: %s" % getmem()
+        print "mem: %s" % memutil.get_mem_usage()
     
     print "done"
         
-def getmem():
-    info = file('/proc/self/stat', 'r').read()
-    info = info.split(' ')
-    rss = int(info[22])
-    return "rss: %rb %rkb %rmb" % (rss, int(rss/1024), int(rss/(1024*1024)),)
-
-
-    
 if __name__ == '__main__':
     memfec(sys.argv[1])
 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/python
Size: 498 bytes
Desc: not available
Url : http://lists.mnetproject.org/pipermail/mnet-devel/attachments/20030723/86c0c627/attachment-0001.bin


More information about the Mnet-devel mailing list