Commit b459aaa9 authored by Jeremy Hylton's avatar Jeremy Hylton

Print mean, min, and max for summary.

Also print # conflicts for each test (appears to be zero).
parent 12dba8b2
...@@ -151,6 +151,7 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None): ...@@ -151,6 +151,7 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None):
for j in range(nrep): for j in range(nrep):
for r in 1, 10, 100, 1000: for r in 1, 10, 100, 1000:
t = time.time() t = time.time()
conflicts = 0
jar = db.open() jar = db.open()
while 1: while 1:
...@@ -171,7 +172,7 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None): ...@@ -171,7 +172,7 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None):
setattr(p, str(i), v) setattr(p, str(i), v)
get_transaction().commit() get_transaction().commit()
except ConflictError: except ConflictError:
pass conflicts = conflicts + 1
else: else:
break break
jar.close() jar.close()
...@@ -179,10 +180,11 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None): ...@@ -179,10 +180,11 @@ def work(db, results, nrep, compress, data, detailed, minimize, threadno=None):
t = time.time() - t t = time.time() - t
if detailed: if detailed:
if threadno is None: if threadno is None:
print "%s\t%s\t%.4f" % (j, r, t) print "%s\t%s\t%.4f\t%d" % (j, r, t, conflicts)
else: else:
print "%s\t%s\t%.4f\t%d" % (j, r, t, threadno) print "%s\t%s\t%.4f\t%d\t%d" % (j, r, t, conflicts,
results[r] = results[r] + t threadno)
results[r].append((t, conflicts))
rt=d=p=v=None # release all references rt=d=p=v=None # release all references
if minimize: if minimize:
time.sleep(3) time.sleep(3)
...@@ -238,7 +240,7 @@ def main(args): ...@@ -238,7 +240,7 @@ def main(args):
cache_deactivate_after=6000,) cache_deactivate_after=6000,)
print "Beginning work..." print "Beginning work..."
results={1:0, 10:0, 100:0, 1000:0} results={1:[], 10:[], 100:[], 1000:[]}
if threads > 1: if threads > 1:
import threading import threading
l = [threading.Thread(target=work, l = [threading.Thread(target=work,
...@@ -259,9 +261,17 @@ def main(args): ...@@ -259,9 +261,17 @@ def main(args):
if detailed: if detailed:
print '-'*24 print '-'*24
print "num\tmean\tmin\tmax"
for r in 1, 10, 100, 1000: for r in 1, 10, 100, 1000:
t=results[r]/(nrep * threads) times = [time for time, conf in results[r]]
print "mean:\t%s\t%.4f\t%.4f (s/o)" % (r, t, t/r) t = mean(times)
print "%d\t%.4f\t%.4f\t%.4f" % (r, t, min(times), max(times))
def mean(l):
tot = 0
for v in l:
tot = tot + v
return tot / len(l)
##def compress(s): ##def compress(s):
## c = zlib.compressobj() ## c = zlib.compressobj()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment