mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-01 09:27:43 +00:00
20 lines
525 B
Python
20 lines
525 B
Python
|
|
import time
|
||
|
|
from functools import wraps
|
||
|
|
|
||
|
|
from rdagent.log import rdagent_logger as logger
|
||
|
|
|
||
|
|
|
||
|
|
def measure_time(method):
|
||
|
|
@wraps(method)
|
||
|
|
def timed(*args, **kwargs):
|
||
|
|
start_time = time.time()
|
||
|
|
result = method(*args, **kwargs)
|
||
|
|
end_time = time.time()
|
||
|
|
duration = end_time - start_time
|
||
|
|
method_name = method.__name__
|
||
|
|
# logger.log_object(f"{method_name} took {duration:.2f} sec")
|
||
|
|
logger.info(f"{method_name} took {duration:.2f} sec")
|
||
|
|
return result
|
||
|
|
|
||
|
|
return timed
|