* under the terms of the license (GNU LGPL) which comes with this package. */
#include <algorithm>
+#include <numeric>
#include "network_cm02.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/sg_config.hpp"
-#include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
#include "src/surf/surf_interface.hpp"
#include "surf/surf.hpp"
/* } */
void surf_network_model_init_CM02()
{
-
if (surf_network_model)
return;
NetworkCm02Action* action = static_cast<NetworkCm02Action*>(get_action_heap().pop());
XBT_DEBUG("Something happened to action %p", action);
- if (TRACE_is_enabled()) {
- int n = action->get_variable()->get_number_of_constraint();
-
- for (int i = 0; i < n; i++){
- kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i);
- NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
- double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i);
- TRACE_surf_link_set_utilization(link->get_cname(), action->get_category(), value, action->get_last_update(),
- now - action->get_last_update());
- }
- }
// if I am wearing a latency hat
if (action->get_type() == ActionHeap::Type::latency) {
if (action.latency_ <= 0.0 && not action.is_suspended())
get_maxmin_system()->update_variable_weight(action.get_variable(), action.weight_);
}
- if (TRACE_is_enabled()) {
- int n = action.get_variable()->get_number_of_constraint();
- for (int i = 0; i < n; i++) {
- kernel::lmm::Constraint* constraint = action.get_variable()->get_constraint(i);
- NetworkCm02Link* link = static_cast<NetworkCm02Link*>(constraint->get_id());
- TRACE_surf_link_set_utilization(
- link->get_cname(), action.get_category(),
- (action.get_variable()->get_value() * action.get_variable()->get_constraint_weight(i)),
- action.get_last_update(), now - action.get_last_update());
- }
- }
+
if (not action.get_variable()->get_number_of_constraint()) {
/* There is actually no link used, hence an infinite bandwidth. This happens often when using models like
* vivaldi. In such case, just make sure that the action completes immediately.
Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate)
{
- bool failed = false;
double latency = 0.0;
std::vector<LinkImpl*> back_route;
std::vector<LinkImpl*> route;
"You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
src->get_cname(), dst->get_cname());
- failed = std::any_of(route.begin(), route.end(), [](LinkImpl* link) { return link->is_off(); });
+ bool failed = std::any_of(route.begin(), route.end(), [](LinkImpl* link) { return link->is_off(); });
if (cfg_crosstraffic) {
dst->routeTo(src, back_route, nullptr);
- failed = std::any_of(back_route.begin(), back_route.end(), [](LinkImpl* const& link) { return link->is_off(); });
+ if (not failed)
+ failed = std::any_of(back_route.begin(), back_route.end(), [](LinkImpl* const& link) { return link->is_off(); });
}
NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
}
XBT_OUT();
- simgrid::s4u::Link::onCommunicate(action, src, dst);
+ simgrid::s4u::Link::on_communicate(action, src, dst);
return action;
}
if (policy == s4u::Link::SharingPolicy::FATPIPE)
get_constraint()->unshare();
- simgrid::s4u::Link::onCreation(this->piface_);
+ simgrid::s4u::Link::on_creation(this->piface_);
}
void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value)
get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(),
sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
- TRACE_surf_link_set_bandwidth(surf_get_clock(), get_cname(),
- sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
+
+ LinkImpl::on_bandwidth_change();
if (sg_weight_S_parameter > 0) {
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale);