comp_iter = lb_iter = 0;
- compute_thread = new_msg_thread("compute",
- std::tr1::bind(&process::compute_loop,
- this));
+ lb_thread = new_msg_thread("loba",
+ std::tr1::bind(&process::load_balance_loop,
+ this));
e_xbt_log_priority_t logp = xbt_log_priority_verbose;
if (!LOG_ISENABLED(logp))
process::~process()
{
- delete compute_thread;
+ delete lb_thread;
total_load_exit += real_load;
if (opt::log_rate < 0)
return;
if (opt::log_rate >= 0)
XBT_INFO("Initial load: %g", real_load);
XBT_VERB("Starting...");
- compute_thread->start();
- load_balance_loop();
- compute_thread->wait();
+ mutex.acquire();
+ lb_thread->start();
+ while (lb_iter <= opt::comp_iter_delay)
+ cond.wait(mutex);
+ mutex.release();
+ double sleep_duration = opt::comp_time_delay - MSG_get_clock();
+ if (sleep_duration > 0.0)
+ MSG_process_sleep(sleep_duration);
+ compute_loop();
+ lb_thread->wait();
XBT_VERB("Done.");
return 0;
}
double next_iter_after_date = MSG_get_clock() + opt::min_lb_iter_duration;
while (still_running()) {
- ++lb_iter;
+ if (lb_iter == opt::comp_iter_delay) {
+ mutex.acquire();
+ ++lb_iter;
+ cond.signal();
+ mutex.release();
+ } else {
+ ++lb_iter;
+ }
if (opt::log_rate && lb_iter % opt::log_rate == 0) {
if (opt::bookkeeping)