Commit 81622d4f authored by David Hendriks's avatar David Hendriks
Browse files

added thingy to log runtimes

parent c25c0843
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -876,6 +876,9 @@ class Population:
        This function is called by _evolve_population_grid
        """

        # set start timer
        start_process_time = datetime.datetime.now()

        self.process_ID = (
            ID  # Store the ID as a object property again, lets see if that works.
        )
@@ -942,9 +945,18 @@ class Population:
                        binary_cmdline_string = self._return_argline(full_system_dict)
                        f.write(binary_cmdline_string)

                    start_runtime_binary_c = time.time()

                    # Evolve the system
                    self._evolve_system_mp(full_system_dict)

                    end_runtime_binary_c = time.time()

                    # Debug line: logging all the lines
                    with open(os.path.join(self.grid_options["tmp_dir"], "thread_{}_runtime_systems.txt".format(self.process_ID)), 'a+') as f:
                        binary_cmdline_string = self._return_argline(full_system_dict)
                        f.write("{} {}\n".format(end_runtime_binary_c-start_runtime_binary_c, binary_cmdline_string))

                    # Keep track of systems:
                    probability_of_systems_run += full_system_dict["probability"]
                    number_of_systems_run += 1
@@ -1008,10 +1020,14 @@ class Population:
            "_count": number_of_systems_run,
        }

        end_process_time = datetime.datetime.now()

        verbose_print(
            "Process {}: generator done at {}. Ran {} systems with a total probability of {}. This thread had {} failing systems with a total probability of {}".format(
            "Process {} finished:\n\tgenerator started at {}, done at {} (total: {}s).\n\tRan {} systems with a total probability of {}.\n\tThis thread had {} failing systems with a total probability of {}".format(
                ID,
                datetime.datetime.now().isoformat(),
                start_process_time.isoformat(),
                end_process_time.isoformat(),
                (end_process_time-start_process_time).total_seconds(),
                number_of_systems_run,
                probability_of_systems_run,
                self.grid_options["_failed_count"],