tests: import various bench/ scripts.

pull/296/head
David Wilson 7 years ago
parent 8a2e8964a9
commit e1402b2214

@ -0,0 +1,15 @@
"""
Measure latency of .fork() setup/teardown.
"""
import mitogen
import time
@mitogen.main()
def main(router):
t0 = time.time()
for x in xrange(200):
t = time.time()
ctx = router.fork()
ctx.shutdown(wait=True)
print '++', 1000 * ((time.time() - t0) / (1.0+x))

@ -2,13 +2,11 @@
Measure latency of .local() setup.
"""
import os
import socket
import mitogen
import time
@mitogen.main() #(log_level='DEBUG')
@mitogen.main()
def main(router):
for x in range(1000):
t = time.time()

@ -0,0 +1,17 @@
"""
Measure latency of local RPC.
"""
import mitogen
import time
def do_nothing():
pass
@mitogen.main()
def main(router):
f = router.fork()
t0 = time.time()
for x in xrange(1000):
f.call(do_nothing)
print '++', int(1e6 * ((time.time() - t0) / (1.0+x))), 'usec'
Loading…
Cancel
Save