X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b87fc0829538ec066fd077e6c30ee6270b8abd78..1dbdb7cb3a16885ab4749222c48f7bf83a7e0ef3:/src/surf/network_cm02.cpp diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 54418ed840..d3e8809e05 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -165,7 +165,7 @@ NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self)) maxminSystem_->solve_fun = specificSolveFun; } -LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency, +LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy) { return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_); @@ -204,8 +204,7 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) // assume that flows that reached max_duration have remaining of 0 XBT_DEBUG("Action %p finished", action); action->setRemains(0); - action->finish(); - action->setState(Action::State::done); + action->finish(Action::State::done); action->heapRemove(actionHeap_); } } @@ -259,8 +258,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) if (((action->getRemains() <= 0) && (lmm_get_variable_weight(action->getVariable()) > 0)) || ((action->getMaxDuration() > NO_MAX_DURATION) && (action->getMaxDuration() <= 0))) { - action->finish(); - action->setState(Action::State::done); + action->finish(Action::State::done); } } } @@ -279,14 +277,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz "You're trying to send data from %s to %s but there is no connecting path between these two hosts.", src->getCname(), dst->getCname()); - for (auto link: *route) + for (auto const& link : *route) if (link->isOff()) failed = 1; if (sg_network_crosstraffic == 1) { back_route = new std::vector(); dst->routeTo(src, back_route, nullptr); - for (auto link: *back_route) + for (auto const& link : *back_route) if (link->isOff()) failed = 1; } @@ -302,10 +300,10 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz double bandwidth_bound = -1.0; if (sg_weight_S_parameter > 0) - for (auto link : *route) + for (auto const& link : *route) action->weight_ += sg_weight_S_parameter / link->bandwidth(); - for (auto link : *route) { + for (auto const& link : *route) { double bb = bandwidthFactor(size) * link->bandwidth(); bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb); } @@ -334,12 +332,12 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->latCurrent_ > 0) ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)) : action->rate_); } - for (auto link: *route) + for (auto const& link : *route) lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), 1.0); if (back_route != nullptr) { // sg_network_crosstraffic was activated XBT_DEBUG("Fullduplex active adding backward flow using 5%%"); - for (auto link : *back_route) + for (auto const& link : *back_route) lmm_expand(maxminSystem_, link->constraint(), action->getVariable(), .05); //Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency @@ -358,7 +356,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz /************ * Resource * ************/ -NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency, +NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency, e_surf_link_sharing_policy_t policy, lmm_system_t system) : LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth)) { @@ -492,8 +490,7 @@ void NetworkCm02Action::updateRemainingLazy(double now) if ((remains_ <= 0 && (lmm_get_variable_weight(getVariable()) > 0)) || ((maxDuration_ > NO_MAX_DURATION) && (maxDuration_ <= 0))) { - finish(); - setState(Action::State::done); + finish(Action::State::done); heapRemove(getModel()->getActionHeap()); }