[pypy-svn] r60101 - pypy/build/benchmem

hpk at codespeak.net hpk at codespeak.net
Mon Nov 24 00:29:29 CET 2008


Author: hpk
Date: Mon Nov 24 00:29:29 2008
New Revision: 60101

Modified:
   pypy/build/benchmem/report.py
Log:
ReST basesize table. 


Modified: pypy/build/benchmem/report.py
==============================================================================
--- pypy/build/benchmem/report.py	(original)
+++ pypy/build/benchmem/report.py	Mon Nov 24 00:29:29 2008
@@ -242,8 +242,65 @@
         makerow("REST-RSS", lambda result:
                 result.snapshot.filter(group=result.executable, inv=True).
                 filter(group=self.HEAP, inv=True).rss)
+
         tw.line(asciitable(rows))
 
+    def run_rest(self, filename="table-basesize.txt"):
+        p = py.path.local(filename)
+        executables = self.getexecutables()
+        row0 = ['Group-Pagestate'] + executables
+        rows = [row0]
+        row_kinds = "shared_clean shared_dirty private_clean private_dirty".split()
+        results = self.resultset.results
+        def makerow(rowname, mapping_func):
+            row = [rowname]
+            for result in results:
+                row.append(mapping_func(result))
+            rows.append(row)
+        #makerow("HEAP-RSS", lambda result: 
+        #        result.snapshot.filter(group=self.HEAP).rss)
+        #makerow("HEAP-shared_clean", lambda result:
+        #        result.snapshot.filter(group=self.HEAP).shared_clean)
+        #makerow("HEAP-private_clean", lambda result:
+        #        result.snapshot.filter(group=self.HEAP).private_clean)
+        makerow("HEAP private", lambda result:
+                result.snapshot.filter(group=self.HEAP).private_dirty)
+        # we only show the clean bits of the code, this might not really work
+        # out if the code is not compiled position-indepently, likewise the often
+        # seen dirty code page might be a dispatch table (correct term?) of the linker
+        makerow("IP-CODE share", lambda result: # can be used to see if the linker dirtied the code segment
+                result.snapshot.filter(group=result.executable, kind=self.CODE).rss)
+        #makerow("IP-CODE-shared_clean", lambda result:
+        #        result.snapshot.filter(group=result.executable, kind=self.CODE).shared_clean)
+        #makerow("IP-CODE-private_clean", lambda result:
+        #        result.snapshot.filter(group=result.executable, kind=self.CODE).private_clean)
+        # whole static data of the process in memory, also including e.g. shared data with other processes
+        #makerow("IP-DATA-RSS", lambda result:
+        #        result.snapshot.filter(group=result.executable, kind=self.DATA).rss)
+        # static data that is not shared with another process and was not modified by the process
+        # can be easily shared with another process
+        makerow("IP-DATA share", lambda result:
+                result.snapshot.filter(group=result.executable, kind=self.DATA).shared_clean +
+                result.snapshot.filter(group=result.executable, kind=self.DATA).private_clean)
+        #makerow("IP-DATA-private_clean", lambda result:
+        #        result.snapshot.filter(group=result.executable, kind=self.DATA).private_clean)
+        # static data that is not shared with another process and was modified by the process
+        makerow("IP-DATA private", lambda result:
+                result.snapshot.filter(group=result.executable, kind=self.DATA).private_dirty)
+        # rest includes other shared libraries that are neither the interpreter nor the heap
+        #makerow("REST-private_clean", lambda result:
+        #        result.snapshot.filter(group=result.executable, inv=True).
+        #        filter(group=self.HEAP, inv=True).private_clean)
+        makerow("REST private", lambda result:
+                result.snapshot.filter(group=result.executable, inv=True).
+                filter(group=self.HEAP, inv=True).private_dirty)
+        makerow("REST-RSS", lambda result:
+                result.snapshot.filter(group=result.executable, inv=True).
+                filter(group=self.HEAP, inv=True).rss)
+
+        p.write(ReSTtable("Interpreter resident base usage", rows))
+        print "writing", p
+
     def run_graphic(self, plotter):
         """ This function plots base interpreter sizes of various interpreters
         with bars specifying:



More information about the Pypy-commit mailing list