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

xoraxax at codespeak.net xoraxax at codespeak.net
Thu Nov 27 15:23:35 CET 2008


Author: xoraxax
Date: Thu Nov 27 15:23:34 2008
New Revision: 60183

Modified:
   pypy/build/benchmem/runbench.py
Log:
Refactored runbench to support writing the benchmarkfile.
Can be used together with the python-launcher as well; do not forget to use su,
and create "/etc/python-launcher/daemon.conf" with e.g.:
import decimal, sys
sys.modules['gtk'] = type(sys)("gtk")



Modified: pypy/build/benchmem/runbench.py
==============================================================================
--- pypy/build/benchmem/runbench.py	(original)
+++ pypy/build/benchmem/runbench.py	Thu Nov 27 15:23:34 2008
@@ -119,12 +119,12 @@
         for _ in xrange(self.numiter):
             popen = Popen(cmds, shell=True, stdout=PIPE,
                     stderr=PIPE, close_fds=True, env=env)
-            output_error = popen.stderr.read()
-            output = popen.stdout.read()
             if popen.wait():
                 print "ERROR in command", cmds
-		print "stderr:", output_error 
+                print "stderr:", output_error
                 continue
+            output_error = popen.stderr.read()
+            output = popen.stdout.read()
 
             timelines = output_error.strip().splitlines()[-3:]
             times = {}
@@ -145,12 +145,16 @@
 
     def run(self):
         self.write_benchheader("basetime")
-        for name, cmdpostfix in (('site', '-c pass'), ('nosite', '-S -c pass'),
-                ('importos', '-S -c "import os"'),
-                ('importoptparse', '-S -c "import optparse"'),
+        for name, opts, code in (('site', '', 'pass'), ('nosite', '-S', 'pass'),
+                ('importos', '-S', "import os"),
+                ('importdecimal', '-S', "import decimal"),
             ):
             executable = py.path.local.sysfind(self.executable)
-            cmd = "%s %s " % (executable, cmdpostfix)
+            p = self.tmpdir.join("launcher.py")
+            p.write(code)
+            if "launcher" in str(self.executable):
+                opts = "" # any option will disable the launcher magic
+            cmd = "%s %s %s" % (executable, opts, str(p))
             times = self.timecommand(cmd)
             print >>self.logstream, "%s:%r" % (name, times)
 



More information about the Pypy-commit mailing list