From 6c3e20794e923d90a982a96f8a465e425f7fb86b Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Sat, 29 May 2021 15:56:23 +0100 Subject: [PATCH] small edit --- binarycpython/utils/grid.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/binarycpython/utils/grid.py b/binarycpython/utils/grid.py index a7f135c59..da0239e41 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 -- GitLab