X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/95a02a8febe84fd1c2ed98c78c594a5e8a0116f7..7c480b01951b33f03d72ede0a47a45a88bd40b61:/include/simgrid/kernel/resource/Model.hpp diff --git a/include/simgrid/kernel/resource/Model.hpp b/include/simgrid/kernel/resource/Model.hpp index 5855dda94c..dc228ad614 100644 --- a/include/simgrid/kernel/resource/Model.hpp +++ b/include/simgrid/kernel/resource/Model.hpp @@ -8,6 +8,19 @@ #include +extern "C" { + +/** @brief Possible update mechanisms */ +enum e_UM_t { + UM_FULL, /**< Full update mechanism: the remaining time of every action is recomputed at each step */ + UM_LAZY, /**< Lazy update mechanism: only the modified actions get recomputed. + It may be slower than full if your system is tightly coupled to the point where every action + gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for + a simple full update. */ + UM_UNDEFINED /**< Mechanism not defined */ +}; +} + namespace simgrid { namespace kernel { namespace resource { @@ -22,36 +35,36 @@ public: virtual ~Model(); /** @brief Get the set of [actions](@ref Action) in *ready* state */ - virtual ActionList* getReadyActionSet() const { return readyActionSet_; } + Action::StateSet* get_ready_action_set() const { return ready_action_set_; } /** @brief Get the set of [actions](@ref Action) in *running* state */ - virtual ActionList* getRunningActionSet() const { return runningActionSet_; } + Action::StateSet* get_running_action_set() const { return running_action_set_; } /** @brief Get the set of [actions](@ref Action) in *failed* state */ - virtual ActionList* getFailedActionSet() const { return failedActionSet_; } + Action::StateSet* get_failed_action_set() const { return failed_action_set_; } /** @brief Get the set of [actions](@ref Action) in *done* state */ - virtual ActionList* getDoneActionSet() const { return doneActionSet_; } + Action::StateSet* get_done_action_set() const { return done_action_set_; } /** @brief Get the set of modified [actions](@ref Action) */ - virtual ActionLmmListPtr getModifiedSet() const { return modifiedSet_; } + Action::ModifiedSet* get_modified_set() const; /** @brief Get the maxmin system of the current Model */ - lmm_system_t getMaxminSystem() const { return maxminSystem_; } + lmm::System* get_maxmin_system() const { return maxmin_system_; } /** * @brief Get the update mechanism of the current Model * @see e_UM_t */ - e_UM_t getUpdateMechanism() const { return updateMechanism_; } - void setUpdateMechanism(e_UM_t mechanism) { updateMechanism_ = mechanism; } + e_UM_t getUpdateMechanism() const { return update_mechanism_; } + void setUpdateMechanism(e_UM_t mechanism) { update_mechanism_ = mechanism; } /** @brief Get Action heap */ - heap_type& getActionHeap() { return actionHeap_; } + heap_type& getActionHeap() { return action_heap_; } - double actionHeapTopDate() const { return actionHeap_.top().first; } + double actionHeapTopDate() const { return action_heap_.top().first; } Action* actionHeapPop(); - bool actionHeapIsEmpty() const { return actionHeap_.empty(); } + bool actionHeapIsEmpty() const { return action_heap_.empty(); } /** * @brief Share the resources between the actions @@ -59,9 +72,9 @@ public: * @param now The current time of the simulation * @return The delta of time till the next action will finish */ - virtual double nextOccuringEvent(double now); - virtual double nextOccuringEventLazy(double now); - virtual double nextOccuringEventFull(double now); + virtual double next_occuring_event(double now); + virtual double next_occuring_event_lazy(double now); + virtual double next_occuring_event_full(double now); /** * @brief Update action to the current time @@ -69,9 +82,9 @@ public: * @param now The current time of the simulation * @param delta The delta of time since the last update */ - virtual void updateActionsState(double now, double delta); - virtual void updateActionsStateLazy(double now, double delta); - virtual void updateActionsStateFull(double now, double delta); + virtual void update_actions_state(double now, double delta); + virtual void update_actions_state_lazy(double now, double delta); + virtual void update_actions_state_full(double now, double delta); /** @brief Returns whether this model have an idempotent shareResource() * @@ -81,17 +94,15 @@ public: virtual bool nextOccuringEventIsIdempotent() { return true; } protected: - ActionLmmListPtr modifiedSet_; - lmm_system_t maxminSystem_ = nullptr; - bool selectiveUpdate_; + lmm::System* maxmin_system_ = nullptr; private: - e_UM_t updateMechanism_ = UM_UNDEFINED; - ActionList* readyActionSet_; /**< Actions in state SURF_ACTION_READY */ - ActionList* runningActionSet_; /**< Actions in state SURF_ACTION_RUNNING */ - ActionList* failedActionSet_; /**< Actions in state SURF_ACTION_FAILED */ - ActionList* doneActionSet_; /**< Actions in state SURF_ACTION_DONE */ - heap_type actionHeap_; + e_UM_t update_mechanism_ = UM_UNDEFINED; + Action::StateSet* ready_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_READY */ + Action::StateSet* running_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_RUNNING */ + Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_FAILED */ + Action::StateSet* done_action_set_ = new Action::StateSet(); /**< Actions in state SURF_ACTION_DONE */ + heap_type action_heap_; }; } // namespace resource