// if I am wearing a latency hat
if (action->get_type() == ActionHeap::Type::latency) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
- get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+ get_maxmin_system()->update_variable_penalty(action->get_variable(), action->sharing_penalty_);
get_action_heap().remove(action);
action->set_last_update();
action.latency_ = 0.0;
}
if (action.latency_ <= 0.0 && not action.is_suspended())
- get_maxmin_system()->update_variable_weight(action.get_variable(), action.weight_);
+ get_maxmin_system()->update_variable_penalty(action.get_variable(), action.sharing_penalty_);
}
if (not action.get_variable()->get_number_of_constraint()) {
if (action.get_max_duration() != NO_MAX_DURATION)
action.update_max_duration(delta);
- if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) ||
+ if (((action.get_remains() <= 0) && (action.get_variable()->get_penalty() > 0)) ||
((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) {
action.finish(Action::State::FINISHED);
}
}
NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
- action->weight_ = latency;
+ action->sharing_penalty_ = latency;
action->latency_ = latency;
action->rate_ = rate;
if (get_update_algorithm() == Model::UpdateAlgo::LAZY) {
}
if (sg_weight_S_parameter > 0) {
- action->weight_ =
- std::accumulate(route.begin(), route.end(), action->weight_, [](double total, LinkImpl* const& link) {
+ action->sharing_penalty_ =
+ std::accumulate(route.begin(), route.end(), action->sharing_penalty_, [](double total, LinkImpl* const& link) {
return total + sg_weight_S_parameter / link->get_bandwidth();
});
}
simgrid::s4u::Link::on_creation(this->piface_);
}
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, std::vector<double> bandwidths,
+ s4u::Link::SharingPolicy policy, lmm::System* system)
+ : NetworkCm02Link(model, name, 0, 0, policy, system)
+{
+ /* Setup Metrics for bandwidths_ */
+ for (auto bandwith : bandwidths) {
+ bandwidths_.push_back({bandwith, 1.0, nullptr});
+ }
+}
+
void NetworkCm02Link::apply_event(kernel::profile::Event* triggered, double value)
{
/* Find out which of my iterators was triggered, and react accordingly */
if (value > 0)
turn_on();
else {
- kernel::lmm::Variable* var = nullptr;
- const kernel::lmm::Element* elem = nullptr;
- double now = surf_get_clock();
-
turn_off();
- while ((var = get_constraint()->get_variable(&elem))) {
- Action* action = static_cast<Action*>(var->get_id());
-
- if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED) {
- action->set_finish_time(now);
- action->set_state(Action::State::FAILED);
- }
- }
}
tmgr_trace_event_unref(&state_event_);
} else {
int numelem = 0;
while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
- action->weight_ += delta;
+ action->sharing_penalty_ += delta;
if (not action->is_suspended())
- get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+ get_model()->get_maxmin_system()->update_variable_penalty(action->get_variable(), action->sharing_penalty_);
}
}
}
while ((var = get_constraint()->get_variable_safe(&elem, &nextelem, &numelem))) {
NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
action->lat_current_ += delta;
- action->weight_ += delta;
+ action->sharing_penalty_ += delta;
if (action->rate_ < 0)
get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), NetworkModel::cfg_tcp_gamma /
(2.0 * action->lat_current_));
}
}
if (not action->is_suspended())
- get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
+ get_model()->get_maxmin_system()->update_variable_penalty(action->get_variable(), action->sharing_penalty_);
}
}
update_max_duration(delta);
- if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) ||
+ if ((get_remains_no_update() <= 0 && (get_variable()->get_penalty() > 0)) ||
((get_max_duration() != NO_MAX_DURATION) && (get_max_duration() <= 0))) {
finish(Action::State::FINISHED);
get_model()->get_action_heap().remove(this);