linly / src /cost_time.py
David Victor
init
bc3753a
raw
history blame
319 Bytes
import time
# ๅฎšไน‰่ฃ…้ฅฐๅ™จ
def calculate_time(func):
def wrapper(*args, **kwargs):
start_time = time.time()
result = func(*args, **kwargs)
end_time = time.time()
print(f"ๅ‡ฝๆ•ฐ {func.__name__} ่ฟ่กŒๆ—ถ้—ด๏ผš {end_time - start_time} ็ง’")
return result
return wrapper