+ int result;
+ process* proc;
+ try {
+ proc = opt::loba_algorithms.new_instance(opt::loba_algo, argc, argv);
+
+ xbt_mutex_acquire(proc_mutex);
+ ++proc_counter;
+ xbt_mutex_release(proc_mutex);
+
+ result = proc->run();
+
+ xbt_mutex_acquire(proc_mutex);
+ comps.push(proc->get_comp());
+ loads.push(proc->get_real_load());
+
+ // Synchronization barrier...
+ // The goal is to circumvent a limitation in SimGrid (at least
+ // in version 3.5): a process must be alive when another one
+ // destroys a communication they had together.
+
+ --proc_counter;
+ xbt_cond_broadcast(proc_cond);
+ while (proc_counter > 0)
+ xbt_cond_wait(proc_cond, proc_mutex);
+ xbt_mutex_release(proc_mutex);
+
+ delete proc;
+ }
+ catch (std::invalid_argument& e) {
+ THROW1(arg_error, 0, "%s", e.what());
+ }
+ return result;
+}
+
+static void check_for_lost_load()
+{
+ double total_init = process::get_total_load_init();
+
+ double total_exit = process::get_total_load_exit();
+ double lost = total_init - total_exit;
+ double lost_ratio = 100.0 * lost / total_init;
+ if (lost_ratio < -opt::load_ratio_threshold)
+ XBT_CRITICAL("Gained load at exit! %g (%g%%) <============",
+ -lost, -lost_ratio);
+ else if (lost_ratio > opt::load_ratio_threshold)
+ XBT_CRITICAL("Lost load at exit! %g (%g%%) <============",
+ lost, lost_ratio);
+ else
+ XBT_VERB("Total load at exit looks good: %g (%g%%)", lost, lost_ratio);
+
+ double total_running = process::get_total_load_running();
+ double running_ratio = 100.0 * total_running / total_init;
+ if (running_ratio < -opt::load_ratio_threshold)
+ XBT_CRITICAL("Negative running load at exit! %g (%g%%) <============",
+ total_running, running_ratio);
+ else if (running_ratio > opt::load_ratio_threshold)
+ XBT_CRITICAL("Remaining running load at exit! %g (%g%%) <============",
+ total_running, running_ratio);
+ else
+ XBT_VERB("Running load at exit looks good: %g (%g%%)",
+ total_running, running_ratio);