X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/74c1bf2b26c5a3aa0d8c29674dc12993e7c0de15..dd89cc2577e61b4b86b1ae7bc58dfa2ad00747e6:/src/surf/network_cm02.cpp diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 30e3b08d65..9bd196ab18 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -9,7 +9,7 @@ #include "network_cm02.hpp" #include "simgrid/s4u/Host.hpp" #include "simgrid/sg_config.h" -#include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals +#include "src/instr/instr_private.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network); @@ -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_); @@ -186,7 +186,7 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) NetworkCm02Link *link = static_cast(lmm_constraint_id(constraint)); double value = lmm_variable_getvalue(action->getVariable())* lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i); - TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), value, action->getLastUpdate(), + TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), value, action->getLastUpdate(), now - action->getLastUpdate()); } } @@ -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_); } } @@ -240,7 +239,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i); NetworkCm02Link* link = static_cast(lmm_constraint_id(constraint)); - TRACE_surf_link_set_utilization(link->cname(), action->getCategory(), + TRACE_surf_link_set_utilization(link->getCname(), action->getCategory(), (lmm_variable_getvalue(action->getVariable()) * lmm_get_cnst_weight_from_var(maxminSystem_, action->getVariable(), i)), action->getLastUpdate(), now - action->getLastUpdate()); @@ -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); } } } @@ -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)) { @@ -419,7 +417,7 @@ void NetworkCm02Link::setBandwidth(double value) lmm_update_constraint_bound(model()->getMaxminSystem(), constraint(), sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale)); - TRACE_surf_link_set_bandwidth(surf_get_clock(), cname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale); + TRACE_surf_link_set_bandwidth(surf_get_clock(), getCname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale); if (sg_weight_S_parameter > 0) { double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (bandwidth_.peak * bandwidth_.scale); @@ -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()); }