tests/bench: run roundtrip.py a ton more to reduce variance

This commit is contained in:
David Wilson 2018-11-04 19:43:52 +00:00
parent d1b7c232bf
commit 3836c6a220
1 changed files with 11 additions and 2 deletions

View File

@ -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')