mitogen/tests/bench/local.py

21 lines
387 B
Python
Raw Normal View History

2018-03-29 08:51:43 +00:00
"""
Measure latency of .local() setup.
"""
import mitogen
import time
2018-06-10 15:36:08 +00:00
@mitogen.main()
2018-03-29 08:51:43 +00:00
def main(router):
for x in range(1000):
2018-03-29 08:51:43 +00:00
t = time.time()
f = router.local()# debug=True)
tt = time.time()
print(x, 1000 * (tt - t))
2018-03-29 08:51:43 +00:00
print(f)
print('EEK', f.call(socket.gethostname))
print('MY PID', os.getpid())
print('EEKERY', f.call(os.getpid))