diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index a7f135c5921e2325e8ee1257a6d12ada5a63d5a3..da0239e41179532942a4954bff5a8398494cfa88 100644 --- a/binarycpython/utils/grid.py +++ b/binarycpython/utils/grid.py @@ -38,6 +38,9 @@ import argparse import subprocess import importlib.util +import cProfile + + from typing import Union, Any from pathos.helpers import mp as pathos_multiprocess @@ -832,6 +835,10 @@ class Population: 0, ) + + def profile_worker(self, num): + cProfile.runctx('import os;self._process_run_population_grid(num)', globals(), locals(), 'profile-%d.out' %num) + def _evolve_population_grid(self): """ Function to evolve the population with multiprocessing approach. @@ -2657,6 +2664,7 @@ class Population: Tasks: - TODO: test this function + - TODO: make sure the binary_c_python .. output file has a unique name Args: output_dir: (optional, default = None) directory where to write the file to. If custom_options['data_dir'] is present, then that one will be used first, and then the output_dir