mitogen/tests/bench/roundtrip.py

18 lines
293 B
Python
Raw Normal View History

2018-06-10 15:36:08 +00:00
"""
Measure latency of local RPC.
"""
import mitogen
import time
def do_nothing():
pass
@mitogen.main()
def main(router):
f = router.fork()
t0 = time.time()
2018-07-30 02:24:01 +00:00
for x in xrange(10000):
2018-06-10 15:36:08 +00:00
f.call(do_nothing)
print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec'