aboutsummaryrefslogtreecommitdiff
path: root/scripts/thready-time-signature.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/thready-time-signature.py')
-rwxr-xr-xscripts/thready-time-signature.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/thready-time-signature.py b/scripts/thready-time-signature.py
index c7240df..fb84c1e 100755
--- a/scripts/thready-time-signature.py
+++ b/scripts/thready-time-signature.py
@@ -87,8 +87,9 @@ class ECDSAKey(object):
class Results(object):
- def __init__(self):
+ def __init__(self, name):
self.lock = threading.RLock()
+ self.name = name
self.sum = datetime.timedelta(seconds = 0)
self.t0 = datetime.datetime.now()
self.t1 = None
@@ -107,14 +108,18 @@ class Results(object):
return self.sum / self.n
@property
- def tmean(self):
+ def throughput(self):
return (self.t1 - self.t0) / self.n
+ @property
+ def sigs_per_second(self):
+ return self.n / (self.t1 - self.t0).total_seconds()
+
def report(self):
with self.lock:
if self.t1 is None:
self.t1 = datetime.datetime.now()
- print "n {0.n} t0 {0.t0} t1 {0.t1} mean {0.mean} tmean {0.tmean}".format(self)
+ print "{0.name} sigs/second {0.sigs_per_second} mean {0.mean} throughput {0.throughput} (n {0.n}, t0 {0.t0}, t1 {0.t1})".format(self)
class Worker(threading.Thread):
@@ -172,14 +177,15 @@ def main():
for name in args.keys:
- print "Starting test with key {}, {} iterations".format(name, args.iterations)
+ if not args.quiet:
+ print "Starting test with key {}, {} iterations".format(name, args.iterations)
k = key_table[name]
k.create(args, p11, session, "Your mother was a hamster")
global results
- results = Results()
+ results = Results(name)
for i in xrange(args.iterations):
q.put(k)