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, 8 insertions, 8 deletions
diff --git a/scripts/thready-time-signature.py b/scripts/thready-time-signature.py
index fb84c1e..e3bd0bf 100755
--- a/scripts/thready-time-signature.py
+++ b/scripts/thready-time-signature.py
@@ -8,7 +8,7 @@ import collections
import threading
import argparse
import datetime
-import Queue
+import queue
import sys
from Crypto.Hash.SHA256 import SHA256Hash as SHA256
@@ -101,7 +101,7 @@ class Results(object):
self.sum += t1 - t0
self.n += 1
if not args.quiet:
- print "{:4d} {}".format(self.n, delta)
+ print("{:4d} {}".format(self.n, delta))
@property
def mean(self):
@@ -119,7 +119,7 @@ class Results(object):
with self.lock:
if self.t1 is None:
self.t1 = datetime.datetime.now()
- 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)
+ 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):
@@ -158,19 +158,19 @@ def main():
args = parser.parse_args()
global q
- q = Queue.Queue()
+ q = queue.Queue()
global p11
p11 = PKCS11(args.libpkcs11)
if not args.quiet:
- print "Initializing"
+ print("Initializing")
p11.C_Initialize(CKF_OS_LOCKING_OK)
session = p11.C_OpenSession(args.slot)
p11.C_Login(session, CKU_USER, args.pin)
- for i in xrange(args.threads):
+ for i in range(args.threads):
w = Worker()
w.setDaemon(True)
w.start()
@@ -178,7 +178,7 @@ def main():
for name in args.keys:
if not args.quiet:
- print "Starting test with key {}, {} iterations".format(name, args.iterations)
+ print("Starting test with key {}, {} iterations".format(name, args.iterations))
k = key_table[name]
@@ -187,7 +187,7 @@ def main():
global results
results = Results(name)
- for i in xrange(args.iterations):
+ for i in range(args.iterations):
q.put(k)
q.join()