Spaces:
Sleeping
Sleeping
from functools import wraps | |
import time | |
from loguru import logger | |
# https://qiita.com/hisatoshi/items/7354c76a4412dffc4fd7 | |
def stop_watch(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 |