tests/bench: run roundtrip.py a ton more to reduce variance
This commit is contained in:
parent
d1b7c232bf
commit
3836c6a220
|
@ -5,13 +5,22 @@ Measure latency of local RPC.
|
||||||
import mitogen
|
import mitogen
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import ansible_mitogen.process
|
||||||
|
ansible_mitogen.process.setup_gil()
|
||||||
|
|
||||||
|
try:
|
||||||
|
xrange
|
||||||
|
except NameError:
|
||||||
|
xrange = range
|
||||||
|
|
||||||
def do_nothing():
|
def do_nothing():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@mitogen.main()
|
@mitogen.main()
|
||||||
def main(router):
|
def main(router):
|
||||||
f = router.fork()
|
f = router.fork()
|
||||||
|
f.call(do_nothing)
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
for x in range(1000):
|
for x in xrange(20000):
|
||||||
f.call(do_nothing)
|
f.call(do_nothing)
|
||||||
print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec'
|
print('++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec')
|
||||||
|
|
Loading…
Reference in New Issue