Files
BiliNote/backend/app/decorators/timeit.py
Jefferyhcool 0e0b8da317 first commit
2025-04-13 17:44:54 +08:00

14 lines
366 B
Python

import time
import functools
def timeit(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start = time.perf_counter()
result = func(*args, **kwargs)
end = time.perf_counter()
duration = end - start
print(f"⏱️ {func.__name__} executed in {duration:.4f} seconds")
return result
return wrapper