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