I create this working function for getting time of another function:
def get_execution_time(function, args, numberOfExecTime=1):
"""Return the execution time of a function in seconds.
"""
return round(Timer(partial(function, args)).timeit(numberOfExecTime), 5)
By the way I have a problem: I can't give multiple input (args) to the function to be timed. How can I do that? Is partial the right tool?
I tried decorator but I can't store the time which is what I need for doing some statistics.