Jaymon / captain

command line python scripts for humans
MIT License
13 stars 1 forks source link

echo profile #48

Closed Jaymon closed 5 years ago

Jaymon commented 5 years ago

something like this:

def profile(start, stop=None, msg=""):
    if not stop:
        stop = time.time()
    elapsed = round(abs(stop - start) * 1000.0, 1)
    if msg: msg += " "
    out("{}{:.1f} ms", msg, total, elapsed)

Or I could make similar to pout's profiler so you could do with echo.profile("...")