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

fijal at codespeak.net fijal at codespeak.net
Thu Oct 30 21:59:18 CET 2008


Author: fijal
Date: Thu Oct 30 21:59:15 2008
New Revision: 59581

Modified:
   pypy/build/benchmem/report_graphic.py
Log:
some support for plotting graphs... intermediate check in 


Modified: pypy/build/benchmem/report_graphic.py
==============================================================================
--- pypy/build/benchmem/report_graphic.py	(original)
+++ pypy/build/benchmem/report_graphic.py	Thu Oct 30 21:59:15 2008
@@ -4,20 +4,46 @@
 
 import sys, py
 import smaps, runbench
-from pylab import plot, show, title
+from pylab import plot, show, title, bar, axes, xticks, legend, subplot, axis
+import numpy
+
+HEAP = runbench.Mappings.HEAP
+CODE = runbench.Mappings.CODE
+DATA = runbench.Mappings.DATA
+
+def process_baseint_sizes(results):
+    lgt = len(results)
+    ind = [float(i)/lgt for i in range(lgt)]
+    heap_private = numpy.array([result.snapshot.filter(group=HEAP).private
+                    for result in results])
+    ip_code = numpy.array([result.snapshot.filter(group=result.executable,
+                                                  kind=CODE).
+                           private for result in results])
+    ip_data = numpy.array([result.snapshot.filter(group=result.executable,
+                                                  kind=DATA).
+                           private for result in results])
+    rest = numpy.array([result.snapshot.filter(group=result.executable,
+                                               inv=True).
+                        filter(group=HEAP, inv=True).private for result in
+                        results])
+    bar(ind, heap_private, .1, color='r')
+    bar(ind, ip_code, .1, color='b', bottom=heap_private)
+    bar(ind, ip_data, .1, color='w', bottom=heap_private+ip_code)
+    bar(ind, rest, .1, color='black', bottom=heap_private+ip_code+ip_data)
+    show()
 
 def main(filename):
     resultset = runbench.ResultSet()
-    resultset.parse(py.path.local(filename), True)
-    # by default it shows all graphs, a bit boring, but educating ;)
-    for name, results in resultset.filter(benchtype="appprofiles").getname2results():
-        for result in results:
-            lgt = len(result.snapshots)
-            x = [float(i)/lgt for i in range(lgt)]
-            y = [snapshot.private for snapshot in result.snapshots]
-            title(name)
-            plot(x, y)
-        show()
+    resultset.parse(py.path.local(filename))
+    process_baseint_sizes(resultset.filter(benchtype="basesize").results)
+    #for name, results in resultset.filter(benchtype="appprofiles").getname2results():
+    #    for result in results:
+    #        lgt = len(result.snapshots)
+    #        x = [float(i)/lgt for i in range(lgt)]
+    #        y = [snapshot.private for snapshot in result.snapshots]
+    #        title(name)
+    #        plot(x, y)
+    #    show()
 
 if __name__ == '__main__':
     if len(sys.argv) > 3:



More information about the Pypy-commit mailing list