diff --git a/tests/bench/latch_roundtrip.py b/tests/bench/latch_roundtrip.py index 51492afc..49314fb9 100644 --- a/tests/bench/latch_roundtrip.py +++ b/tests/bench/latch_roundtrip.py @@ -7,9 +7,10 @@ import time import mitogen import mitogen.utils +import ansible_mitogen.affinity mitogen.utils.setup_gil() -mitogen.utils.reset_affinity() +ansible_mitogen.affinity.policy.assign_worker() X = 20000 diff --git a/tests/bench/local.py b/tests/bench/local.py index a4ec2428..2808d803 100644 --- a/tests/bench/local.py +++ b/tests/bench/local.py @@ -2,19 +2,23 @@ Measure latency of .local() setup. """ -import mitogen import time +import mitogen +import mitogen.utils +import ansible_mitogen.affinity + + +mitogen.utils.setup_gil() +#ansible_mitogen.affinity.policy.assign_worker() + @mitogen.main() def main(router): - for x in range(1000): + t0=time.time() + for x in range(100): 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)) + print('%.03f ms' % (1000 * (time.time() - t0) / (1.0 + x))) diff --git a/tests/bench/roundtrip.py b/tests/bench/roundtrip.py index fb8f5184..8d86d75b 100644 --- a/tests/bench/roundtrip.py +++ b/tests/bench/roundtrip.py @@ -6,8 +6,10 @@ import time import mitogen import mitogen.utils +import ansible_mitogen.affinity mitogen.utils.setup_gil() +ansible_mitogen.affinity.policy.assign_worker() try: xrange