diff --git a/tests/bench/roundtrip.py b/tests/bench/roundtrip.py index 7c5a9252..33b3c5b8 100644 --- a/tests/bench/roundtrip.py +++ b/tests/bench/roundtrip.py @@ -5,13 +5,22 @@ Measure latency of local RPC. import mitogen import time +import ansible_mitogen.process +ansible_mitogen.process.setup_gil() + +try: + xrange +except NameError: + xrange = range + def do_nothing(): pass @mitogen.main() def main(router): f = router.fork() + f.call(do_nothing) t0 = time.time() - for x in range(1000): + for x in xrange(20000): f.call(do_nothing) - print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec' + print('++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec')