func_running_time
- pyhelpers.ops.func_running_time(func)[source]
A decorator to measure the time of a function or class method.
- Parameters:
func (Callable) – any function or class method
- Returns:
the decorated function or class method with the time of running
- Return type:
Callable
Examples:
>>> from pyhelpers.ops import func_running_time >>> import time >>> @func_running_time >>> def test_func(): ... print("Testing if the function works.") ... time.sleep(3) >>> test_func() INFO Begin to run function: test_func … Testing if the function works. INFO Finished running function: test_func, total: 3s