From 17aef51e6e4612b06ffc15a1efdc0c0aad2d8164 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 29 Mar 2018 14:36:43 +0545 Subject: [PATCH] tests: Import .local() latency test --- tests/bench/local.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/bench/local.py diff --git a/tests/bench/local.py b/tests/bench/local.py new file mode 100644 index 00000000..25a67b00 --- /dev/null +++ b/tests/bench/local.py @@ -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)