From 90405d32719260adc75c9c23fb3b7d9e33485e85 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Sat, 3 Mar 2018 17:41:15 -0500 Subject: More useful script output. Overall performance numbers are still bad. Presumably having a single global PKCS #11 lock does not help here. Need a bitstream with more ModExp and ECDSA cores before this will matter much, but will likely need to figure out some way to do per-session locking instead of global for operations we want to run in parallel. At which point we'll be on the road to deadlock hell, so will need some care. --- scripts/thready-time-signature.py | 16 +++++++++++----- 1 file 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) -- cgit v1.2.3