You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
439 B
Python
27 lines
439 B
Python
"""
|
|
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 xrange(20000):
|
|
f.call(do_nothing)
|
|
print('++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec')
|