Spaces:
Sleeping
Sleeping
File size: 603 Bytes
371a1e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from functools import wraps
import time
from loguru import logger
# https://qiita.com/hisatoshi/items/7354c76a4412dffc4fd7
def stop_watch(func):
"""
ε¦ηγ«γγγζιθ¨ζΈ¬γγγγγ³γ¬γΌγΏ
"""
@wraps(func)
def wrapper(*args, **kargs):
logger.debug(f"π¦ [@stop_watch] measure time to run `{func.__name__}`.")
start = time.time()
result = func(*args, **kargs)
elapsed_time = time.time() - start
logger.debug(f"π¦ [@stop_watch] take {elapsed_time:.3f} sec to run `{func.__name__}`.")
return result
return wrapper |