chemicalchecker.util.decorator.profilehooks.timecall

timecall(fn=None, immediate=True, timer=None)[source]

Wrap fn and print its execution time.

Example:

@timecall
def somefunc(x, y):
    time.sleep(x * y)

somefunc(2, 3)

will print the time taken by somefunc on every call. If you want just a summary at program termination, use

@timecall(immediate=False)

You can also choose a timing method other than the default timeit.default_timer(), e.g.:

@timecall(timer=time.clock)