pyufunc.func_time#

pyufunc.func_time(func)#

A decorator to measure the time of a function or class method. It is useful to use this function in test, debug, logging and running time measurement.

Parameters:

func (object) – the function or class method to be measured.

Note

It’s equivalent to the func_running_time as func_running_time have been used in many packages. We keep both of them for compatibility.

Location:

The function defined in pyufunc.util_common._func_time_decorator.py.

Examples

>>> @func_running_time
>>> def func():
>>>    print("main function...")
>>>    time.sleep(3)
>>>    return
>>> func()
main function...
INFO Finished running function: func, total: 3s
Returns:

the decorated function or class method.

Return type:

object