From: Martin Quinson Date: Sat, 24 Mar 2018 10:00:05 +0000 (+0100) Subject: Move modifiedSet from Resource to lmm::System X-Git-Tag: v3.20~644 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/14660963acc18c2eb718c139755d8e9133d45623 Move modifiedSet from Resource to lmm::System --- diff --git a/include/simgrid/kernel/resource/Model.hpp b/include/simgrid/kernel/resource/Model.hpp index 3478fee4be..9ef9a4653f 100644 --- a/include/simgrid/kernel/resource/Model.hpp +++ b/include/simgrid/kernel/resource/Model.hpp @@ -47,7 +47,7 @@ public: ActionList* getDoneActionSet() const { return doneActionSet_; } /** @brief Get the set of modified [actions](@ref Action) */ - ActionLmmListPtr getModifiedSet() const { return modifiedSet_; } + ActionLmmListPtr getModifiedSet() const; /** @brief Get the maxmin system of the current Model */ lmm_system_t getMaxminSystem() const { return maxminSystem_; } @@ -94,7 +94,6 @@ public: virtual bool nextOccuringEventIsIdempotent() { return true; } protected: - ActionLmmListPtr modifiedSet_ = nullptr; lmm_system_t maxminSystem_ = nullptr; private: diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index b9c5b41bee..879813e0ec 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -150,7 +150,6 @@ System::System(bool selective_update) : selective_update_active(selective_update XBT_DEBUG("Setting selective_update_active flag to %d", selective_update_active); - keep_track = nullptr; variable_mallocator = xbt_mallocator_new(65536, System::variable_mallocator_new_f, System::variable_mallocator_free_f, nullptr); solve_fun = &lmm_solve; @@ -171,6 +170,7 @@ System::~System() cnst_free(cnst); xbt_mallocator_free(variable_mallocator); + delete modified_set_; } void System::cnst_free(Constraint* cnst) @@ -536,8 +536,8 @@ template void System::solve(CnstList& cnst_list) elem.make_active(); simgrid::kernel::resource::Action* action = static_cast(elem.variable->id); - if (keep_track && not action->isLinkedModifiedSet()) - keep_track->push_back(*action); + if (modified_set_ && not action->isLinkedModifiedSet()) + modified_set_->push_back(*action); } } XBT_DEBUG("Constraint '%d' usage: %f remaining: %f concurrency: %i<=%i<=%i", cnst.id_int, cnst.usage, diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index c37a5aa071..f294e72252 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -601,7 +601,7 @@ public: &Constraint::saturated_constraint_set_hook>> saturated_constraint_set; - simgrid::kernel::resource::ActionLmmListPtr keep_track; + simgrid::kernel::resource::ActionLmmListPtr modified_set_ = nullptr; void (*solve_fun)(lmm_system_t self); diff --git a/src/kernel/resource/Model.cpp b/src/kernel/resource/Model.cpp index 54b03920ca..2755f5d2bf 100644 --- a/src/kernel/resource/Model.cpp +++ b/src/kernel/resource/Model.cpp @@ -20,7 +20,6 @@ Model::~Model() delete runningActionSet_; delete failedActionSet_; delete doneActionSet_; - delete modifiedSet_; delete maxminSystem_; } @@ -32,6 +31,11 @@ Action* Model::actionHeapPop() return action; } +ActionLmmListPtr Model::getModifiedSet() const +{ + return maxminSystem_->modified_set_; +} + double Model::nextOccuringEvent(double now) { // FIXME: set the good function once and for all @@ -45,13 +49,13 @@ double Model::nextOccuringEvent(double now) double Model::nextOccuringEventLazy(double now) { - XBT_DEBUG("Before share resources, the size of modified actions set is %zu", modifiedSet_->size()); + XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxminSystem_->modified_set_->size()); lmm_solve(maxminSystem_); - XBT_DEBUG("After share resources, The size of modified actions set is %zu", modifiedSet_->size()); + XBT_DEBUG("After share resources, The size of modified actions set is %zu", maxminSystem_->modified_set_->size()); - while (not modifiedSet_->empty()) { - Action* action = &(modifiedSet_->front()); - modifiedSet_->pop_front(); + while (not maxminSystem_->modified_set_->empty()) { + Action* action = &(maxminSystem_->modified_set_->front()); + maxminSystem_->modified_set_->pop_front(); bool max_dur_flag = false; if (action->getStateSet() != runningActionSet_) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index de2b88e90a..3e416478f5 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -53,10 +53,8 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel() maxminSystem_ = new simgrid::kernel::lmm::System(select); - if (getUpdateMechanism() == UM_LAZY) { - modifiedSet_ = new kernel::resource::ActionLmmList(); - maxminSystem_->keep_track = modifiedSet_; - } + if (getUpdateMechanism() == UM_LAZY) + maxminSystem_->modified_set_ = new kernel::resource::ActionLmmList(); } CpuCas01Model::~CpuCas01Model() diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 05778dca32..44d21c902a 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -154,10 +154,8 @@ NetworkCm02Model::NetworkCm02Model() maxminSystem_ = new simgrid::kernel::lmm::System(select); loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE); - if (getUpdateMechanism() == UM_LAZY) { - modifiedSet_ = new kernel::resource::ActionLmmList(); - maxminSystem_->keep_track = modifiedSet_; - } + if (getUpdateMechanism() == UM_LAZY) + maxminSystem_->modified_set_ = new kernel::resource::ActionLmmList(); } NetworkCm02Model::NetworkCm02Model(void (*specificSolveFun)(lmm_system_t self)) : NetworkCm02Model()