, current_speed_(host_->get_speed())
, current_flops_(host_->pimpl_cpu->get_constraint()->get_usage())
, theor_max_flops_(0)
- , was_prev_idle_(current_flops_ == 0)
{
}
~HostLoad() = default;
double last_updated_ = 0;
double last_reset_ = 0;
/**
- * current_speed each core is running at right now
+ * current_speed each core is running at; we need to store this as the speed
+ * will already have changed once we get notified
*/
double current_speed_ = 0;
/**
double idle_time_ = 0;
double total_idle_time_ = 0; /* This gets never reset */
double theor_max_flops_ = 0;
- bool was_prev_idle_ = true; /* A host is idle at the beginning */
};
simgrid::xbt::Extension<simgrid::s4u::Host, HostLoad> HostLoad::EXTENSION_ID;
{
double now = surf_get_clock();
- /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k @in {0, 1, ..., cores}
- * number of active cores */
+ /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k @in {0, 1, ..., cores-1}
+ * designates number of active cores; will be 0 if CPU is currently idle */
current_flops_ = host_->pimpl_cpu->get_constraint()->get_usage();
/* flops == pstate_speed * cores_being_currently_used */
computed_flops_ += (now - last_updated_) * current_flops_;
- if (was_prev_idle_) {
+ if (current_flops_ == 0) {
idle_time_ += (now - last_updated_);
total_idle_time_ += (now - last_updated_);
+ XBT_DEBUG("[%s]: Currently idle -> Added %f seconds to idle time (totaling %fs)", host_->get_cname(), (now - last_updated_), idle_time_);
}
theor_max_flops_ += current_speed_ * host_->get_core_count() * (now - last_updated_);
current_speed_ = host_->get_speed();
last_updated_ = now;
- was_prev_idle_ = (current_flops_ == 0);
}
/**
theor_max_flops_ = 0;
current_flops_ = host_->pimpl_cpu->get_constraint()->get_usage();
current_speed_ = host_->get_speed();
- was_prev_idle_ = (current_flops_ == 0);
}
} // namespace plugin
} // namespace simgrid