System::~System()
{
- Variable* var;
- Constraint* cnst;
-
- while ((var = extract_variable())) {
+ while (Variable* var = extract_variable()) {
std::string demangled = boost::core::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.c_str(),
var->rank_);
var_free(var);
}
- while ((cnst = extract_constraint()))
+ while (Constraint* cnst = extract_constraint())
cnst_free(cnst);
xbt_mallocator_free(variable_mallocator_);
void System::variable_free_all()
{
- Variable* var;
- while ((var = extract_variable()))
+ while (Variable* var = extract_variable())
variable_free(var);
}
auto const* wifi_link = static_cast<simgrid::kernel::resource::NetworkWifiLink*>(link_->get_impl());
- const kernel::lmm::Variable* var;
const kernel::lmm::Element* elem = nullptr;
/**
* used by the flow with the longest active time since the previous update
*/
double durUsage = 0;
- while((var = wifi_link->get_constraint()->get_variable(&elem))) {
+ while (const auto* var = wifi_link->get_constraint()->get_variable(&elem)) {
auto* action = static_cast<kernel::resource::NetworkWifiAction*>(var->get_id());
XBT_DEBUG("cost: %f action value: %f link rate 1: %f link rate 2: %f", action->get_cost(), action->get_variable()->get_value(), wifi_link->get_host_rate(&action->get_src()),wifi_link->get_host_rate(&action->get_dst()));
void Global::wake_all_waiting_actors() const
{
for (auto const& model : simgrid::kernel::EngineImpl::get_instance()->get_all_models()) {
- kernel::resource::Action* action;
-
XBT_DEBUG("Handling the failed actions (if any)");
- while ((action = model->extract_failed_action())) {
+ while (auto* action = model->extract_failed_action()) {
XBT_DEBUG(" Handling Action %p", action);
if (action->get_activity() != nullptr)
kernel::activity::ActivityImplPtr(action->get_activity())->post();
}
XBT_DEBUG("Handling the terminated actions (if any)");
- while ((action = model->extract_done_action())) {
+ while (auto* action = model->extract_done_action()) {
XBT_DEBUG(" Handling Action %p", action);
if (action->get_activity() == nullptr)
XBT_DEBUG("probably vcpu's action %p, skip", action);
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::on_speed_change()
{
- const lmm::Variable* var;
const lmm::Element* elem = nullptr;
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
get_core_count() * speed_.scale * speed_.peak);
- while ((var = get_constraint()->get_variable(&elem))) {
- const CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
+ const auto* action = static_cast<CpuCas01Action*>(var->get_id());
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
action->requested_core() * speed_.scale * speed_.peak);
get_iface()->turn_on();
}
} else {
- const lmm::Constraint* cnst = get_constraint();
- const lmm::Variable* var;
const lmm::Element* elem = nullptr;
double date = surf_get_clock();
get_iface()->turn_off();
- while ((var = cnst->get_variable(&elem))) {
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
Action* action = var->get_id();
if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED ||
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);
- const kernel::lmm::Variable* var;
const kernel::lmm::Element* elem = nullptr;
const kernel::lmm::Element* nextelem = nullptr;
int numelem = 0;
- while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
+ while (const auto* var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem)) {
auto* action = static_cast<NetworkCm02Action*>(var->get_id());
action->sharing_penalty_ += delta;
if (not action->is_suspended())
latency_check(value);
double delta = value - latency_.peak;
- const kernel::lmm::Variable* var;
const kernel::lmm::Element* elem = nullptr;
const kernel::lmm::Element* nextelem = nullptr;
int numelem = 0;
latency_.scale = 1.0;
latency_.peak = value;
- while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
+ while (const auto* var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem)) {
auto* action = static_cast<NetworkCm02Action*>(var->get_id());
action->lat_current_ += delta;
action->sharing_penalty_ += delta;
Resource::turn_off();
s4u::Link::on_state_change(this->piface_);
- const kernel::lmm::Variable* var;
const kernel::lmm::Element* elem = nullptr;
double now = surf_get_clock();
- while ((var = get_constraint()->get_variable(&elem))) {
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
Action* action = var->get_id();
if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
action->set_finish_time(now);
/** @brief take into account changes of speed (either load or max) */
void CpuL07::on_speed_change()
{
- const kernel::lmm::Variable* var;
const kernel::lmm::Element* elem = nullptr;
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), speed_.peak * speed_.scale);
- while ((var = get_constraint()->get_variable(&elem))) {
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
const kernel::resource::Action* action = var->get_id();
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
kernel::resource::LinkImpl* LinkL07::set_latency(double value)
{
latency_check(value);
- const kernel::lmm::Variable* var;
- L07Action* action;
const kernel::lmm::Element* elem = nullptr;
latency_.peak = value;
- while ((var = get_constraint()->get_variable(&elem))) {
- action = static_cast<L07Action*>(var->get_id());
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
+ auto* action = static_cast<L07Action*>(var->get_id());
action->updateBound();
}
return this;
if (next_event_date > NOW)
break;
- simgrid::kernel::profile::Event* event;
double value = -1.0;
simgrid::kernel::resource::Resource* resource = nullptr;
- while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
+ while (auto* event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource)) {
if (value >= 0)
resource->apply_event(event, value);
}
double time_delta = -1.0; /* duration */
double value = -1.0;
simgrid::kernel::resource::Resource* resource = nullptr;
- simgrid::kernel::profile::Event* event = nullptr;
if (max_date != -1.0) {
xbt_assert(max_date >= NOW, "You asked to simulate up to %f, but that's in the past already", max_date);
XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", time_delta, NOW, next_event_date);
- while ((event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource))) {
+ while (auto* event = simgrid::kernel::profile::future_evt_set.pop_leq(next_event_date, &value, &resource)) {
if (resource->is_used() || (watched_hosts().find(resource->get_cname()) != watched_hosts().end())) {
time_delta = next_event_date - NOW;
XBT_DEBUG("This event invalidates the next_occurring_event() computation of models. Next event set to %f",