Skip to content

Commit

Permalink
Add utilities function
Browse files Browse the repository at this point in the history
  • Loading branch information
ekouts committed Feb 29, 2024
1 parent 549a182 commit ec78946
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions firecrest/utilities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import time
from contextlib import contextmanager

@contextmanager
def time_block(label, logger):
start_time = time.time()
try:
yield
finally:
end_time = time.time()
logger.debug(f"{label} took {end_time - start_time:.6f} seconds")

0 comments on commit ec78946

Please sign in to comment.