You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/bench/fork.py

16 lines
328 B
Python

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