Skip to content

Commit

Permalink
Add tracemalloc.start() and tracemalloc.reset_peak() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
IshaanDesai committed Dec 20, 2024
1 parent 1af9496 commit 9e18be2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion micro_manager/micro_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def _solve_micro_simulations(self, micro_sims_input: list, dt: float) -> tuple:
"""
micro_sims_output: list[dict] = [None] * self._local_number_of_sims

tracemalloc.reset_peak()
tracemalloc.start()

for count, sim in enumerate(self._micro_sims):
# If micro simulation has not crashed in a previous iteration, attempt to solve it
Expand Down Expand Up @@ -710,6 +710,8 @@ def _solve_micro_simulations(self, micro_sims_input: list, dt: float) -> tuple:
micro_sims_input, micro_sims_output, unset_sim
)

tracemalloc.reset_peak()

return micro_sims_output, 0.0

def _solve_micro_simulations_with_adaptivity(
Expand Down Expand Up @@ -755,6 +757,8 @@ def _solve_micro_simulations_with_adaptivity(

micro_sims_output = [None] * self._local_number_of_sims

tracemalloc.reset_peak()

# Solve all active micro simulations
for active_id in active_sim_ids:
# If micro simulation has not crashed in a previous iteration, attempt to solve it
Expand Down

0 comments on commit 9e18be2

Please sign in to comment.