[pypy-svn] r39910 - in pypy/dist/pypy/tool/bench: . test
hpk at codespeak.net
hpk at codespeak.net
Sun Mar 4 18:44:54 CET 2007
Author: hpk
Date: Sun Mar 4 18:44:52 2007
New Revision: 39910
Modified:
pypy/dist/pypy/tool/bench/pypyresult.py
pypy/dist/pypy/tool/bench/test/test_pypyresult.py
Log:
can now parse complete pypy benchmark results
Modified: pypy/dist/pypy/tool/bench/pypyresult.py
==============================================================================
--- pypy/dist/pypy/tool/bench/pypyresult.py (original)
+++ pypy/dist/pypy/tool/bench/pypyresult.py Sun Mar 4 18:44:52 2007
@@ -12,6 +12,7 @@
for id in id2numrun:
besttime = id2bestspeed[id]
numruns = id2numrun[id]
+ print id
bench = BenchResult(id, besttime, numruns)
self.benchmarks.append(bench)
@@ -28,10 +29,30 @@
self._id = id
if id.startswith("./"):
id = id[2:]
- parts = id.split("-")
- self.name = parts.pop(-1)
- self.backend = parts[1]
- self.revision = int(parts[2])
- self.executable = "-".join(parts)
+ if id.startswith("pypy"):
+ parts = id.rsplit("_", 1)
+ self.executable = parts[0]
+ self.name = parts[1]
+ parts = self.executable.split("-")
+ self.backend = parts[1]
+ try:
+ self.revision = int(parts[2])
+ except ValueError:
+ self.revision = None
+ else: # presumably cpython
+ version, name = id.split("_", 1)
+ self.name = name
+ self.backend = None
+ self.revision = version
+ self.executable = "cpython"
self.besttime = besttime
self.numruns = numruns
+ def __repr__(self):
+ return "<BenchResult %r>" %(self._id, )
+
+
+if __name__ == "__main__":
+ x = py.magic.autopath().dirpath("bench-unix.benchmark_result")
+ db = ResultDB()
+ db.parsepickle(x)
+
Modified: pypy/dist/pypy/tool/bench/test/test_pypyresult.py
==============================================================================
--- pypy/dist/pypy/tool/bench/test/test_pypyresult.py (original)
+++ pypy/dist/pypy/tool/bench/test/test_pypyresult.py Sun Mar 4 18:44:52 2007
@@ -1,7 +1,7 @@
import py
-from pypy.tool.bench.pypyresult import ResultDB
+from pypy.tool.bench.pypyresult import ResultDB, BenchResult
import pickle
def setup_module(mod):
@@ -23,12 +23,25 @@
db = ResultDB()
db.parsepickle(pp)
assert len(db.benchmarks) == 1
- l = db.getbenchmarks(name="c_richards")
+ l = db.getbenchmarks(name="richards")
assert len(l) == 1
bench = l[0]
- assert bench.executable == "pypy-llvm-39474-faassen"
- assert bench.name == "c_richards"
- assert bench.revision == 39474
- assert bench.numruns == 5
- assert bench.besttime == 42.0
-
+ l = db.getbenchmarks(name="xyz")
+ assert not l
+
+def test_BenchResult_cpython():
+ res = BenchResult("2.3.5_pystone", besttime=2.0, numruns=3)
+ assert res.executable == "cpython"
+ assert res.revision == "2.3.5"
+ assert res.name == "pystone"
+ assert res.numruns == 3
+ assert res.besttime == 2.0
+
+def test_BenchResult_pypy():
+ res = BenchResult("pypy-llvm-39474-faassen-c_richards",
+ besttime=2.0, numruns=3)
+ assert res.executable == "pypy-llvm-39474-faassen-c"
+ assert res.revision == 39474
+ assert res.name == "richards"
+ assert res.numruns == 3
+ assert res.besttime == 2.0
More information about the Pypy-commit
mailing list