fork download
import time
from contextlib import contextmanager

@contextmanager
def benchmark():
    start = time.time()
    try:
        yield
    finally:
        print(time.time() - start)


with benchmark():
    time.sleep(1)

Success #stdin #stdout 0.02s 28384KB
stdin
Standard input is empty
stdout
1.0033495426177979