From: Martin Quinson Date: Mon, 26 Mar 2018 16:59:02 +0000 (+0200) Subject: further snake_casing in resource::Action X-Git-Tag: v3.20~627^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/627cef048b8d7a523fa6d2ccaec750eccb0468e9 further snake_casing in resource::Action I think that's the third time I'm sure I'm done with this file. This gonna be a long one refactoring :( --- diff --git a/include/simgrid/kernel/resource/Action.hpp b/include/simgrid/kernel/resource/Action.hpp index 7b876d0840..141df6402d 100644 --- a/include/simgrid/kernel/resource/Action.hpp +++ b/include/simgrid/kernel/resource/Action.hpp @@ -178,33 +178,36 @@ private: double max_duration_ = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */ double remains_; /**< How much of that cost remains to be done in the currently running task */ double start_time_; /**< start time */ - char* category_ = nullptr; /**< tracing category for categorized resource utilization monitoring */ - double finish_time_ = - -1; /**< finish time : this is modified during the run and fluctuates until the task is completed */ + double finish_time_ = -1; /**< finish time (may fluctuate until the task is completed) */ + char* category_ = nullptr; /**< tracing category for categorized resource utilization monitoring */ double cost_; simgrid::kernel::resource::Model* model_; void* data_ = nullptr; /**< for your convenience */ /* LMM */ - double last_update_ = 0; - double last_value_ = 0; - kernel::lmm::Variable* variable_ = nullptr; - Action::Type type_ = Action::Type::NOTSET; - boost::optional heap_handle_ = boost::none; + double last_update_ = 0; + double last_value_ = 0; + kernel::lmm::Variable* variable_ = nullptr; + Action::Type type_ = Action::Type::NOTSET; + boost::optional heap_hook_ = boost::none; public: void heapInsert(heap_type& heap, double key, Action::Type hat); void heapRemove(heap_type& heap); void heapUpdate(heap_type& heap, double key, Action::Type hat); - void clearHeapHandle() { heap_handle_ = boost::none; } - kernel::lmm::Variable* getVariable() const { return variable_; } - void setVariable(kernel::lmm::Variable* var) { variable_ = var; } - double getLastUpdate() const { return last_update_; } - void refreshLastUpdate(); - double getLastValue() const { return last_value_; } - void setLastValue(double val) { last_value_ = val; } - Action::Type getType() const { return type_; } + void clearHeapHandle() { heap_hook_ = boost::none; } + + lmm::Variable* get_variable() const { return variable_; } + void set_variable(lmm::Variable* var) { variable_ = var; } + + double get_last_update() const { return last_update_; } + void set_last_update(); + + double get_last_value() const { return last_value_; } + void set_last_value(double val) { last_value_ = val; } + + Action::Type get_type() const { return type_; } protected: Action::SuspendStates suspended_ = Action::SuspendStates::not_suspended; diff --git a/src/kernel/resource/Action.cpp b/src/kernel/resource/Action.cpp index 3fd917cffe..99e9ddf888 100644 --- a/src/kernel/resource/Action.cpp +++ b/src/kernel/resource/Action.cpp @@ -34,8 +34,8 @@ Action::~Action() { if (state_set_hook_.is_linked()) simgrid::xbt::intrusive_erase(*state_set_, *this); - if (getVariable()) - get_model()->getMaxminSystem()->variable_free(getVariable()); + if (get_variable()) + get_model()->getMaxminSystem()->variable_free(get_variable()); if (get_model()->getUpdateMechanism() == UM_LAZY) { /* remove from heap */ heapRemove(get_model()->getActionHeap()); @@ -101,7 +101,7 @@ void Action::set_bound(double bound) if (variable_) get_model()->getMaxminSystem()->update_variable_bound(variable_, bound); - if (get_model()->getUpdateMechanism() == UM_LAZY && getLastUpdate() != surf_get_clock()) + if (get_model()->getUpdateMechanism() == UM_LAZY && get_last_update() != surf_get_clock()) heapRemove(get_model()->getActionHeap()); XBT_OUT(); } @@ -127,7 +127,7 @@ void Action::set_priority(double weight) { XBT_IN("(%p,%g)", this, weight); sharing_priority_ = weight; - get_model()->getMaxminSystem()->update_variable_weight(getVariable(), weight); + get_model()->getMaxminSystem()->update_variable_weight(get_variable(), weight); if (get_model()->getUpdateMechanism() == UM_LAZY) heapRemove(get_model()->getActionHeap()); @@ -158,7 +158,7 @@ void Action::suspend() { XBT_IN("(%p)", this); if (suspended_ != SuspendStates::sleeping) { - get_model()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0); + get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0); if (get_model()->getUpdateMechanism() == UM_LAZY) { heapRemove(get_model()->getActionHeap()); if (get_model()->getUpdateMechanism() == UM_LAZY && state_set_ == get_model()->getRunningActionSet() && @@ -176,7 +176,7 @@ void Action::resume() { XBT_IN("(%p)", this); if (suspended_ != SuspendStates::sleeping) { - get_model()->getMaxminSystem()->update_variable_weight(getVariable(), get_priority()); + get_model()->getMaxminSystem()->update_variable_weight(get_variable(), get_priority()); suspended_ = SuspendStates::not_suspended; if (get_model()->getUpdateMechanism() == UM_LAZY) heapRemove(get_model()->getActionHeap()); @@ -198,14 +198,14 @@ bool Action::is_suspended() void Action::heapInsert(heap_type& heap, double key, Action::Type hat) { type_ = hat; - heap_handle_ = heap.emplace(std::make_pair(key, this)); + heap_hook_ = heap.emplace(std::make_pair(key, this)); } void Action::heapRemove(heap_type& heap) { type_ = Action::Type::NOTSET; - if (heap_handle_) { - heap.erase(*heap_handle_); + if (heap_hook_) { + heap.erase(*heap_hook_); clearHeapHandle(); } } @@ -213,10 +213,10 @@ void Action::heapRemove(heap_type& heap) void Action::heapUpdate(heap_type& heap, double key, Action::Type hat) { type_ = hat; - if (heap_handle_) { - heap.update(*heap_handle_, std::make_pair(key, this)); + if (heap_hook_) { + heap.update(*heap_hook_, std::make_pair(key, this)); } else { - heap_handle_ = heap.emplace(std::make_pair(key, this)); + heap_hook_ = heap.emplace(std::make_pair(key, this)); } } @@ -239,7 +239,7 @@ void Action::update_remains(double delta) double_update(&remains_, delta, sg_maxmin_precision * sg_surf_precision); } -void Action::refreshLastUpdate() +void Action::set_last_update() { last_update_ = surf_get_clock(); } diff --git a/src/kernel/resource/Model.cpp b/src/kernel/resource/Model.cpp index a09aeb6ef0..2b2954c63d 100644 --- a/src/kernel/resource/Model.cpp +++ b/src/kernel/resource/Model.cpp @@ -62,13 +62,13 @@ double Model::nextOccuringEventLazy(double now) continue; /* bogus priority, skip it */ - if (action->get_priority() <= 0 || action->getType() == Action::Type::LATENCY) + if (action->get_priority() <= 0 || action->get_type() == Action::Type::LATENCY) continue; action->update_remains_lazy(now); double min = -1; - double share = action->getVariable()->get_value(); + double share = action->get_variable()->get_value(); if (share > 0) { double time_to_completion; @@ -87,7 +87,7 @@ double Model::nextOccuringEventLazy(double now) max_dur_flag = true; } - XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->getVariable()->id_int); + XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->get_variable()->id_int); XBT_DEBUG("Action(%p) Start %f. May finish at %f (got a share of %f). Max_duration %f", action, action->get_start_time(), min, share, action->get_max_duration()); @@ -117,7 +117,7 @@ double Model::nextOccuringEventFull(double /*now*/) double min = -1; for (Action& action : *getRunningActionSet()) { - double value = action.getVariable()->get_value(); + double value = action.get_variable()->get_value(); if (value > 0) { if (action.get_remains() > 0) value = action.get_remains_no_update() / value; diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index da17d4a188..4a3881d7a2 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -92,8 +92,9 @@ double VMModel::nextOccuringEvent(double now) surf::Cpu* cpu = ws_vm->pimpl_cpu; xbt_assert(cpu, "cpu-less host"); - double solved_value = ws_vm->getImpl()->action_->getVariable()->get_value(); // this is X1 in comment above, what - // this VM got in the sharing on the PM + double solved_value = + ws_vm->getImpl()->action_->get_variable()->get_value(); // this is X1 in comment above, what + // this VM got in the sharing on the PM XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->getPm()->getCname()); xbt_assert(cpu->model() == surf_cpu_model_vm); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index de1baf8ccf..477e392809 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -100,7 +100,7 @@ void CpuCas01::onSpeedChange() { while ((var = constraint()->get_variable(&elem))) { CpuCas01Action* action = static_cast(var->get_id()); - model()->getMaxminSystem()->update_variable_bound(action->getVariable(), + model()->getMaxminSystem()->update_variable_bound(action->get_variable(), action->requestedCore() * speed_.scale * speed_.peak); } @@ -180,7 +180,7 @@ CpuAction *CpuCas01::sleep(double duration) action->get_state_set()->push_back(*action); } - model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0); + model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0); if (model()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap action->heapRemove(model()->getActionHeap()); // this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its @@ -202,10 +202,10 @@ CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool , requestedCore_(requestedCore) { if (model->getUpdateMechanism() == UM_LAZY) { - refreshLastUpdate(); - setLastValue(0.0); + set_last_update(); + set_last_value(0.0); } - model->getMaxminSystem()->expand(constraint, getVariable(), 1.0); + model->getMaxminSystem()->expand(constraint, get_variable(), 1.0); } CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed, diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index b3afee5483..4307bd86d0 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -27,9 +27,9 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/) CpuAction* action = static_cast(actionHeapPop()); XBT_CDEBUG(surf_kernel, "Something happened to action %p", action); if (TRACE_is_enabled()) { - Cpu* cpu = static_cast(action->getVariable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->getVariable()->get_value(), - action->getLastUpdate(), now - action->getLastUpdate()); + Cpu* cpu = static_cast(action->get_variable()->get_constraint(0)->get_id()); + TRACE_surf_host_set_utilization(cpu->getCname(), action->get_category(), action->get_variable()->get_value(), + action->get_last_update(), now - action->get_last_update()); } action->finish(kernel::resource::Action::State::done); @@ -40,8 +40,8 @@ void CpuModel::updateActionsStateLazy(double now, double /*delta*/) //without losing the event ascending order (considering all CPU's) double smaller = -1; for (kernel::resource::Action const& action : *getRunningActionSet()) { - if (smaller < 0 || action.getLastUpdate() < smaller) - smaller = action.getLastUpdate(); + if (smaller < 0 || action.get_last_update() < smaller) + smaller = action.get_last_update(); } if (smaller > 0) { TRACE_last_timestamp_to_dump = smaller; @@ -55,18 +55,18 @@ void CpuModel::updateActionsStateFull(double now, double delta) CpuAction& action = static_cast(*it); ++it; // increment iterator here since the following calls to action.finish() may invalidate it if (TRACE_is_enabled()) { - Cpu* cpu = static_cast(action.getVariable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.getVariable()->get_value(), + Cpu* cpu = static_cast(action.get_variable()->get_constraint(0)->get_id()); + TRACE_surf_host_set_utilization(cpu->getCname(), action.get_category(), action.get_variable()->get_value(), now - delta, delta); TRACE_last_timestamp_to_dump = now - delta; } - action.update_remains(action.getVariable()->get_value() * delta); + action.update_remains(action.get_variable()->get_value() * delta); if (action.get_max_duration() != NO_MAX_DURATION) action.update_max_duration(delta); - if (((action.get_remains_no_update() <= 0) && (action.getVariable()->get_weight() > 0)) || + if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) || ((action.get_max_duration() != NO_MAX_DURATION) && (action.get_max_duration() <= 0))) { action.finish(kernel::resource::Action::State::done); } @@ -175,23 +175,23 @@ void CpuAction::update_remains_lazy(double now) xbt_assert(get_state_set() == get_model()->getRunningActionSet(), "You're updating an action that is not running."); xbt_assert(get_priority() > 0, "You're updating an action that seems suspended."); - double delta = now - getLastUpdate(); + double delta = now - get_last_update(); if (get_remains_no_update() > 0) { XBT_CDEBUG(surf_kernel, "Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(), - getLastUpdate()); - update_remains(getLastValue() * delta); + get_last_update()); + update_remains(get_last_value() * delta); if (TRACE_is_enabled()) { - Cpu* cpu = static_cast(getVariable()->get_constraint(0)->get_id()); - TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), getLastValue(), getLastUpdate(), - now - getLastUpdate()); + Cpu* cpu = static_cast(get_variable()->get_constraint(0)->get_id()); + TRACE_surf_host_set_utilization(cpu->getCname(), get_category(), get_last_value(), get_last_update(), + now - get_last_update()); } XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, get_remains_no_update()); } - refreshLastUpdate(); - setLastValue(getVariable()->get_value()); + set_last_update(); + set_last_value(get_variable()->get_value()); } simgrid::xbt::signal CpuAction::onStateChange; @@ -217,13 +217,13 @@ void CpuAction::set_state(Action::State state) /** @brief returns a list of all CPUs that this action is using */ std::list CpuAction::cpus() { std::list retlist; - int llen = getVariable()->get_number_of_constraint(); + int llen = get_variable()->get_number_of_constraint(); for (int i = 0; i < llen; i++) { /* Beware of composite actions: ptasks put links and cpus together */ // extra pb: we cannot dynamic_cast from void*... kernel::resource::Resource* resource = - static_cast(getVariable()->get_constraint(i)->get_id()); + static_cast(get_variable()->get_constraint(i)->get_id()); Cpu* cpu = dynamic_cast(resource); if (cpu != nullptr) retlist.push_back(cpu); diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 87c29933ef..f3e83138a0 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -176,27 +176,27 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) NetworkCm02Action* action = static_cast(actionHeapPop()); XBT_DEBUG("Something happened to action %p", action); if (TRACE_is_enabled()) { - int n = action->getVariable()->get_number_of_constraint(); + int n = action->get_variable()->get_number_of_constraint(); for (int i = 0; i < n; i++){ - kernel::lmm::Constraint* constraint = action->getVariable()->get_constraint(i); + kernel::lmm::Constraint* constraint = action->get_variable()->get_constraint(i); NetworkCm02Link* link = static_cast(constraint->get_id()); - double value = action->getVariable()->get_value() * action->getVariable()->get_constraint_weight(i); - TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->getLastUpdate(), - now - action->getLastUpdate()); + double value = action->get_variable()->get_value() * action->get_variable()->get_constraint_weight(i); + TRACE_surf_link_set_utilization(link->getCname(), action->get_category(), value, action->get_last_update(), + now - action->get_last_update()); } } // if I am wearing a latency hat - if (action->getType() == kernel::resource::Action::Type::LATENCY) { + if (action->get_type() == kernel::resource::Action::Type::LATENCY) { XBT_DEBUG("Latency paid for action %p. Activating", action); - maxmin_system_->update_variable_weight(action->getVariable(), action->weight_); + maxmin_system_->update_variable_weight(action->get_variable(), action->weight_); action->heapRemove(getActionHeap()); - action->refreshLastUpdate(); + action->set_last_update(); - // if I am wearing a max_duration or normal hat - } else if (action->getType() == kernel::resource::Action::Type::MAX_DURATION || - action->getType() == kernel::resource::Action::Type::NORMAL) { + // if I am wearing a max_duration or normal hat + } else if (action->get_type() == kernel::resource::Action::Type::MAX_DURATION || + action->get_type() == kernel::resource::Action::Type::NORMAL) { // no need to communicate anymore // assume that flows that reached max_duration have remaining of 0 XBT_DEBUG("Action %p finished", action); @@ -223,31 +223,31 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) action.latency_ = 0.0; } if (action.latency_ <= 0.0 && not action.is_suspended()) - maxmin_system_->update_variable_weight(action.getVariable(), action.weight_); + maxmin_system_->update_variable_weight(action.get_variable(), action.weight_); } if (TRACE_is_enabled()) { - int n = action.getVariable()->get_number_of_constraint(); + int n = action.get_variable()->get_number_of_constraint(); for (int i = 0; i < n; i++) { - kernel::lmm::Constraint* constraint = action.getVariable()->get_constraint(i); + kernel::lmm::Constraint* constraint = action.get_variable()->get_constraint(i); NetworkCm02Link* link = static_cast(constraint->get_id()); TRACE_surf_link_set_utilization( link->getCname(), action.get_category(), - (action.getVariable()->get_value() * action.getVariable()->get_constraint_weight(i)), - action.getLastUpdate(), now - action.getLastUpdate()); + (action.get_variable()->get_value() * action.get_variable()->get_constraint_weight(i)), + action.get_last_update(), now - action.get_last_update()); } } - if (not action.getVariable()->get_number_of_constraint()) { + 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.update_remains(action.get_remains()); } - action.update_remains(action.getVariable()->get_value() * delta); + action.update_remains(action.get_variable()->get_value() * delta); if (action.get_max_duration() > NO_MAX_DURATION) action.update_max_duration(delta); - if (((action.get_remains() <= 0) && (action.getVariable()->get_weight() > 0)) || + if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) || ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) { action.finish(kernel::resource::Action::State::done); } @@ -284,7 +284,7 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos action->latency_ = latency; action->rate_ = rate; if (getUpdateMechanism() == UM_LAZY) { - action->refreshLastUpdate(); + action->set_last_update(); } double bandwidth_bound = -1.0; @@ -305,34 +305,34 @@ kernel::resource::Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Hos constraints_per_variable += back_route.size(); if (action->latency_ > 0) { - action->setVariable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable)); + action->set_variable(maxmin_system_->variable_new(action, 0.0, -1.0, constraints_per_variable)); if (getUpdateMechanism() == UM_LAZY) { // add to the heap the event when the latency is payed - XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->getLastUpdate()); - action->heapInsert(getActionHeap(), action->latency_ + action->getLastUpdate(), + XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->latency_ + action->get_last_update()); + action->heapInsert(getActionHeap(), action->latency_ + action->get_last_update(), route.empty() ? kernel::resource::Action::Type::NORMAL : kernel::resource::Action::Type::LATENCY); } } else - action->setVariable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable)); + action->set_variable(maxmin_system_->variable_new(action, 1.0, -1.0, constraints_per_variable)); if (action->rate_ < 0) { maxmin_system_->update_variable_bound( - action->getVariable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0); + action->get_variable(), (action->latCurrent_ > 0) ? sg_tcp_gamma / (2.0 * action->latCurrent_) : -1.0); } else { - maxmin_system_->update_variable_bound(action->getVariable(), + maxmin_system_->update_variable_bound(action->get_variable(), (action->latCurrent_ > 0) ? std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)) : action->rate_); } for (auto const& link : route) - maxmin_system_->expand(link->constraint(), action->getVariable(), 1.0); + maxmin_system_->expand(link->constraint(), action->get_variable(), 1.0); if (not back_route.empty()) { // sg_network_crosstraffic was activated XBT_DEBUG("Crosstraffic active adding backward flow using 5%%"); for (auto const& link : back_route) - maxmin_system_->expand(link->constraint(), action->getVariable(), .05); + maxmin_system_->expand(link->constraint(), action->get_variable(), .05); // Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency // (You would also have to change simgrid::kernel::lmm::Element::get_concurrency()) @@ -420,7 +420,7 @@ void NetworkCm02Link::setBandwidth(double value) NetworkCm02Action* action = static_cast(var->get_id()); action->weight_ += delta; if (not action->is_suspended()) - model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_); + model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_); } } } @@ -440,11 +440,11 @@ void NetworkCm02Link::setLatency(double value) action->latCurrent_ += delta; action->weight_ += delta; if (action->rate_ < 0) - model()->getMaxminSystem()->update_variable_bound(action->getVariable(), + model()->getMaxminSystem()->update_variable_bound(action->get_variable(), sg_tcp_gamma / (2.0 * action->latCurrent_)); else { model()->getMaxminSystem()->update_variable_bound( - action->getVariable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))); + action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_))); if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) { XBT_INFO("Flow is limited BYBANDWIDTH"); @@ -453,7 +453,7 @@ void NetworkCm02Link::setLatency(double value) } } if (not action->is_suspended()) - model()->getMaxminSystem()->update_variable_weight(action->getVariable(), action->weight_); + model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_); } } @@ -466,13 +466,13 @@ void NetworkCm02Action::update_remains_lazy(double now) if (suspended_ != Action::SuspendStates::not_suspended) return; - double delta = now - getLastUpdate(); + double delta = now - get_last_update(); double max_duration = get_max_duration(); if (get_remains_no_update() > 0) { XBT_DEBUG("Updating action(%p): remains was %f, last_update was: %f", this, get_remains_no_update(), - getLastUpdate()); - update_remains(getLastValue() * delta); + get_last_update()); + update_remains(get_last_value() * delta); XBT_DEBUG("Updating action(%p): remains is now %f", this, get_remains_no_update()); } @@ -482,14 +482,14 @@ void NetworkCm02Action::update_remains_lazy(double now) set_max_duration(max_duration); } - if ((get_remains_no_update() <= 0 && (getVariable()->get_weight() > 0)) || + if ((get_remains_no_update() <= 0 && (get_variable()->get_weight() > 0)) || ((max_duration > NO_MAX_DURATION) && (max_duration <= 0))) { finish(Action::State::done); heapRemove(get_model()->getActionHeap()); } - refreshLastUpdate(); - setLastValue(getVariable()->get_value()); + set_last_update(); + set_last_value(get_variable()->get_value()); } } diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index ceb99fc87d..354b99d308 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -174,7 +174,7 @@ void NetworkIBModel::computeIBfactors(IBNode* root) if (not double_equals(penalized_bw, rate_before_update, sg_surf_precision)) { XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id, (*it)->destination->id, (*it)->action, penalized_bw, (*it)->action->get_bound(), (*it)->init_rate); - maxmin_system_->update_variable_bound((*it)->action->getVariable(), penalized_bw); + maxmin_system_->update_variable_bound((*it)->action->get_variable(), penalized_bw); } else { XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id, (*it)->destination->id, (*it)->action, penalized_bw, (*it)->init_rate); diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index d49a04e864..1834d386b2 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -196,13 +196,13 @@ namespace simgrid { std::list NetworkAction::links() { std::list retlist; - int llen = getVariable()->get_number_of_constraint(); + int llen = get_variable()->get_number_of_constraint(); for (int i = 0; i < llen; i++) { /* Beware of composite actions: ptasks put links and cpus together */ // extra pb: we cannot dynamic_cast from void*... kernel::resource::Resource* resource = - static_cast(getVariable()->get_constraint(i)->get_id()); + static_cast(get_variable()->get_constraint(i)->get_id()); LinkImpl* link = dynamic_cast(resource); if (link != nullptr) retlist.push_back(link); diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 9e80916f4f..4a7d7c1d95 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -95,12 +95,12 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) } if ((action.latency_ <= 0.0) && (action.is_suspended() == 0)) { action.updateBound(); - maxmin_system_->update_variable_weight(action.getVariable(), 1.0); + maxmin_system_->update_variable_weight(action.get_variable(), 1.0); } } XBT_DEBUG("Action (%p) : remains (%g) updated by %g.", &action, action.get_remains(), - action.getVariable()->get_value() * delta); - action.update_remains(action.getVariable()->get_value() * delta); + action.get_variable()->get_value() * delta); + action.update_remains(action.get_variable()->get_value() * delta); if (action.get_max_duration() > NO_MAX_DURATION) action.update_max_duration(delta); @@ -113,13 +113,13 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) * If it's not done, it may have failed. */ - if (((action.get_remains() <= 0) && (action.getVariable()->get_weight() > 0)) || + if (((action.get_remains() <= 0) && (action.get_variable()->get_weight() > 0)) || ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) { action.finish(kernel::resource::Action::State::done); } else { /* Need to check that none of the model has failed */ int i = 0; - kernel::lmm::Constraint* cnst = action.getVariable()->get_constraint(i); + kernel::lmm::Constraint* cnst = action.get_variable()->get_constraint(i); while (cnst != nullptr) { i++; void* constraint_id = cnst->get_id(); @@ -128,7 +128,7 @@ void HostL07Model::updateActionsState(double /*now*/, double delta) action.finish(kernel::resource::Action::State::failed); break; } - cnst = action.getVariable()->get_constraint(i); + cnst = action.get_variable()->get_constraint(i); } } } @@ -181,13 +181,13 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos XBT_DEBUG("Creating a parallel task (%p) with %d hosts and %d unique links.", this, host_nb, nb_link); latency_ = latency; - setVariable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link)); + set_variable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link)); if (latency_ > 0) - model->getMaxminSystem()->update_variable_weight(getVariable(), 0.0); + model->getMaxminSystem()->update_variable_weight(get_variable(), 0.0); for (int i = 0; i < host_nb; i++) - model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), getVariable(), flops_amount[i]); + model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]); if(bytes_amount != nullptr) { for (int i = 0; i < host_nb; i++) { @@ -197,7 +197,7 @@ L07Action::L07Action(kernel::resource::Model* model, int host_nb, sg_host_t* hos hostList_->at(i)->routeTo(hostList_->at(j), route, nullptr); for (auto const& link : route) - model->getMaxminSystem()->expand_add(link->constraint(), this->getVariable(), + model->getMaxminSystem()->expand_add(link->constraint(), this->get_variable(), bytes_amount[i * host_nb + j]); } } @@ -275,7 +275,7 @@ kernel::resource::Action* CpuL07::sleep(double duration) L07Action *action = static_cast(execution_start(1.0)); action->set_max_duration(duration); action->suspended_ = kernel::resource::Action::SuspendStates::sleeping; - model()->getMaxminSystem()->update_variable_weight(action->getVariable(), 0.0); + model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0); return action; } @@ -293,7 +293,7 @@ void CpuL07::onSpeedChange() { while ((var = constraint()->get_variable(&elem))) { kernel::resource::Action* action = static_cast(var->get_id()); - model()->getMaxminSystem()->update_variable_bound(action->getVariable(), speed_.scale * speed_.peak); + model()->getMaxminSystem()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak); } Cpu::onSpeedChange(); @@ -401,9 +401,9 @@ void L07Action::updateBound() XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound); if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) { if (rate_ < 0) - get_model()->getMaxminSystem()->update_variable_bound(getVariable(), lat_bound); + get_model()->getMaxminSystem()->update_variable_bound(get_variable(), lat_bound); else - get_model()->getMaxminSystem()->update_variable_bound(getVariable(), std::min(rate_, lat_bound)); + get_model()->getMaxminSystem()->update_variable_bound(get_variable(), std::min(rate_, lat_bound)); } } diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index 68b0ca302f..2e3c492498 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -80,12 +80,12 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta) for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) { StorageAction& action = static_cast(*it); ++it; // increment iterator here since the following calls to action.finish() may invalidate it - action.update_remains(lrint(action.getVariable()->get_value() * delta)); + action.update_remains(lrint(action.get_variable()->get_value() * delta)); if (action.get_max_duration() > NO_MAX_DURATION) action.update_max_duration(delta); - if (((action.get_remains_no_update() <= 0) && (action.getVariable()->get_weight() > 0)) || + if (((action.get_remains_no_update() <= 0) && (action.get_variable()->get_weight() > 0)) || ((action.get_max_duration() > NO_MAX_DURATION) && (action.get_max_duration() <= 0))) { action.finish(kernel::resource::Action::State::done); } @@ -125,13 +125,13 @@ StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost, XBT_IN("(%s,%g", storage->getCname(), cost); // Must be less than the max bandwidth for all actions - model->getMaxminSystem()->expand(storage->constraint(), getVariable(), 1.0); + model->getMaxminSystem()->expand(storage->constraint(), get_variable(), 1.0); switch(type) { case READ: - model->getMaxminSystem()->expand(storage->constraintRead_, getVariable(), 1.0); + model->getMaxminSystem()->expand(storage->constraintRead_, get_variable(), 1.0); break; case WRITE: - model->getMaxminSystem()->expand(storage->constraintWrite_, getVariable(), 1.0); + model->getMaxminSystem()->expand(storage->constraintWrite_, get_variable(), 1.0); break; default: THROW_UNIMPLEMENTED; @@ -148,7 +148,7 @@ void StorageN11Action::suspend() { XBT_IN("(%p)", this); if (suspended_ != Action::SuspendStates::sleeping) { - get_model()->getMaxminSystem()->update_variable_weight(getVariable(), 0.0); + get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0); suspended_ = Action::SuspendStates::suspended; } XBT_OUT();