in evaluation_pipeline/retrieval.py [0:0]
def log_performance(func):
def wrapper(*args, **kwargs):
start_time = time.time()
tracemalloc.start()
result = func(*args, **kwargs)
current, peak = tracemalloc.get_traced_memory()
end_time = time.time()
logging.info(f"Function: {func.__name__}")
logging.info(f"Execution Time: {end_time - start_time:.2f} seconds")
logging.info(f"Current Memory Usage: {current / 10**6:.2f} MB")
logging.info(f"Peak Memory Usage: {peak / 10**6:.2f} MB")
tracemalloc.stop()
return result
return wrapper