Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alaydshah committed Jun 23, 2024
1 parent 0af69f4 commit 809c52d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/fedml/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ def wrapper(*args, **kwargs):

return decorator(_func)


def timeit(func: Callable):
"""Print the runtime of the decorated function"""
functools.wraps(func)

def wrapper(*args, **kwargs):
start = time.perf_counter()
func(*args, **kwargs)
value = func(*args, **kwargs)
end = time.perf_counter()
run_time = end - start
print(f"Finished {func.__name__!r} in {run_time:.4f} seconds")
return value

return wrapper

0 comments on commit 809c52d

Please sign in to comment.