tests: Import .local() latency test

This commit is contained in:
David Wilson 2018-03-29 14:36:43 +05:45
parent a8a31728a0
commit 17aef51e6e
1 changed files with 22 additions and 0 deletions

22
tests/bench/local.py Normal file
View File

@ -0,0 +1,22 @@
"""
Measure latency of .local() setup.
"""
import os
import socket
import mitogen
import time
@mitogen.main() #(log_level='DEBUG')
def main(router):
for x in xrange(1000):
t = time.time()
f = router.local()# debug=True)
tt = time.time()
print x, 1000 * (tt - t)
print f
print 'EEK', f.call(socket.gethostname)
print 'MY PID', os.getpid()
print 'EEKERY', f.call(os.getpid)