[pypy-svn] r58927 - in pypy/build/benchmem: . testing
hpk at codespeak.net
hpk at codespeak.net
Fri Oct 10 19:07:30 CEST 2008
Author: hpk
Date: Fri Oct 10 19:07:30 2008
New Revision: 58927
Modified:
pypy/build/benchmem/runbench.py
pypy/build/benchmem/testing/test_benchtool.py
Log:
(xoraxax,hpk) specialize names for objsize benchmarks
Modified: pypy/build/benchmem/runbench.py
==============================================================================
--- pypy/build/benchmem/runbench.py (original)
+++ pypy/build/benchmem/runbench.py Fri Oct 10 19:07:30 2008
@@ -16,7 +16,7 @@
class BenchRunner:
SEPBENCH = "=" * 80
-class BenchRunnerSizes(BenchRunner):
+class BenchRunnerObjsize(BenchRunner):
def __init__(self, executable, fsname, logpath, options):
self.executable = executable
self.benchpath = benchmarkdir.join(fsname)
@@ -131,27 +131,12 @@
def parse(self, logpath):
f = logpath.open()
- for result in BenchmarkResult.parse(f):
+ for result in Result.parse(f):
#print "parsed", result
self.results.append(result)
f.close()
-
-class BenchmarkResult:
- benchtype = "sizes"
- def __init__(self, snapshots, executable, benchpath, benchname, benchargs):
- assert snapshots
- self.snapshots = snapshots
- self.executable = executable
- self.benchpath = benchpath
- self.benchname = benchname
- self.benchargs = benchargs
-
- def max(self, attrname):
- maxvalue = 0
- for snap in self.snapshots:
- maxvalue = max(maxvalue, getattr(snap, attrname))
- return maxvalue
-
+
+class Result(object):
@classmethod
def parseheader(cls, iterline):
kw = {}
@@ -194,14 +179,29 @@
#print "reading", line.strip()
snapshots.append(Snapshot(mappings))
lineno, line = iterline()
- print "reading %d: %s" %(lineno, line)
+ #print "reading %d: %s" %(lineno, line)
if not line or line.startswith(BenchRunner.SEPBENCH):
break
- print "yielding result", kw['benchname']
- yield BenchmarkResult(snapshots, **kw)
+ #print "yielding result", kw['benchname']
+ yield ObjsizeResult(snapshots, **kw)
else:
assert 0, benchtype
- print "end"
+
+class ObjsizeResult(Result):
+ benchtype = "sizes"
+ def __init__(self, snapshots, executable, benchpath, benchname, benchargs):
+ assert snapshots
+ self.snapshots = snapshots
+ self.executable = executable
+ self.benchpath = benchpath
+ self.benchname = benchname
+ self.benchargs = benchargs
+
+ def max(self, attrname):
+ maxvalue = 0
+ for snap in self.snapshots:
+ maxvalue = max(maxvalue, getattr(snap, attrname))
+ return maxvalue
def _verify_integrity(self):
for snap in self.snapshots:
@@ -267,7 +267,7 @@
def getrunnerclass(fsname):
if fsname == "sizes.py":
- return BenchRunnerSizes
+ return BenchRunnerObjsize
if __name__ == '__main__':
(options, args) = parser.parse_args()
Modified: pypy/build/benchmem/testing/test_benchtool.py
==============================================================================
--- pypy/build/benchmem/testing/test_benchtool.py (original)
+++ pypy/build/benchmem/testing/test_benchtool.py Fri Oct 10 19:07:30 2008
@@ -27,7 +27,7 @@
benchlog=tmpdir.join("log")
class options:
numiter = 10
- runner = runbench.BenchRunnerSizes("python2.5", "sizes.py", benchlog, options)
+ runner = runbench.BenchRunnerObjsize("python2.5", "sizes.py", benchlog, options)
assert runner.benchpath.basename == "sizes.py"
runner.run()
resultset = runbench.ResultSet()
More information about the Pypy-commit
mailing list