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