[Zodb-checkins] SVN: zodbbench/trunk/zodbbench/ BenchBase
subclasses must now supply a .summary()
Tim Peters
tim.one at comcast.net
Fri Oct 7 17:13:09 EDT 2005
Log message for revision 38909:
BenchBase subclasses must now supply a .summary()
method, which returns a string giving the results
of running the benchmark. The base report() method
uses this. In the future, higher-level drivers
should be able to accumulate result strings from
multiple runs of multiple tests this way.
Changed:
U zodbbench/trunk/zodbbench/benchmarks/one_minute_commit.py
U zodbbench/trunk/zodbbench/utils.py
-=-
Modified: zodbbench/trunk/zodbbench/benchmarks/one_minute_commit.py
===================================================================
--- zodbbench/trunk/zodbbench/benchmarks/one_minute_commit.py 2005-10-07 21:04:21 UTC (rev 38908)
+++ zodbbench/trunk/zodbbench/benchmarks/one_minute_commit.py 2005-10-07 21:13:08 UTC (rev 38909)
@@ -56,12 +56,12 @@
finally:
self.close_and_delete()
- def report(self):
+ def summary(self):
msg = "Did %d commits in %.1f seconds, for %.2f txn/sec." % (
self.ntransactions,
self.elapsed,
self.ntransactions / self.elapsed)
- BenchBase.report(self, msg)
+ return msg
def main():
om = OneMinute()
Modified: zodbbench/trunk/zodbbench/utils.py
===================================================================
--- zodbbench/trunk/zodbbench/utils.py 2005-10-07 21:04:21 UTC (rev 38908)
+++ zodbbench/trunk/zodbbench/utils.py 2005-10-07 21:13:08 UTC (rev 38909)
@@ -76,6 +76,11 @@
name = None # subclass should override with benchmark name
version = None # " " " " " version number
+ # Subclass must override.
+ def summary(self):
+ """Return a string summarizing the result of the benchmark run."""
+ raise NotImplementedError
+
def open_fs(self, path=None):
"""Open a FileStorage.
@@ -108,13 +113,12 @@
# exist before ZODB 3.2, though.
self.storage.cleanup()
-
- def report(self, msg):
+ def report(self):
"""Display a report to stdout.
- The starts by listing the name of the benchmark (self.name and
+ This starts by listing the name of the benchmark (self.name and
self.version), then gives the ZODB and Python versions in use, and
- then displays `msg`.
+ then prints the string self.summary() returns.
"""
print "Benchmark %s, version %s" % (self.name, self.version)
@@ -127,4 +131,4 @@
print " ", sys.executable
print " ", sys.platform
- print msg
+ print self.summary()
More information about the Zodb-checkins
mailing list