summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c0f3756)
Factorize stuff of CpuCas01Model and CpuTiModel into Model directly.
This way, Action::get_state() always knows in which set the action is.
No shit, no magic here.
STARTED, /**< Currently running */
FAILED, /**< either the resource failed, or the action was canceled */
FINISHED, /**< Successfully completed */
STARTED, /**< Currently running */
FAILED, /**< either the resource failed, or the action was canceled */
FINISHED, /**< Successfully completed */
- IGNORED /**< e.g. failure detectors, these infinite sleep actions that are put on resources which failure should be
- notified */
+ IGNORED /**< e.g. failure detectors: infinite sleep actions that are put on resources which failure should get
+ noticed */
};
enum class SuspendStates {
};
enum class SuspendStates {
/** @brief Get the set of [actions](@ref Action) in *finished* state */
Action::StateSet* get_finished_action_set() const { return finished_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *finished* state */
Action::StateSet* get_finished_action_set() const { return finished_action_set_; }
+ /** @brief Get the set of [actions](@ref Action) in *ignored* state */
+ Action::StateSet* get_ignored_action_set() const { return ignored_action_set_; }
+
/** @brief Get the set of modified [actions](@ref Action) */
Action::ModifiedSet* get_modified_set() const;
/** @brief Get the set of modified [actions](@ref Action) */
Action::ModifiedSet* get_modified_set() const;
Action::StateSet* started_action_set_ = new Action::StateSet(); /**< Started not done */
Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Done with failure */
Action::StateSet* finished_action_set_ = new Action::StateSet(); /**< Done successful */
Action::StateSet* started_action_set_ = new Action::StateSet(); /**< Started not done */
Action::StateSet* failed_action_set_ = new Action::StateSet(); /**< Done with failure */
Action::StateSet* finished_action_set_ = new Action::StateSet(); /**< Done successful */
+ Action::StateSet* ignored_action_set_ = new Action::StateSet(); /**< not considered (failure detectors?) */
+
ActionHeap action_heap_;
};
ActionHeap action_heap_;
};
return Action::State::FAILED;
if (state_set_ == model_->get_finished_action_set())
return Action::State::FINISHED;
return Action::State::FAILED;
if (state_set_ == model_->get_finished_action_set())
return Action::State::FINISHED;
- return Action::State::IGNORED;
+ if (state_set_ == model_->get_ignored_action_set())
+ return Action::State::IGNORED;
+ THROW_IMPOSSIBLE;
}
void Action::set_state(Action::State state)
}
void Action::set_state(Action::State state)
case Action::State::FINISHED:
state_set_ = model_->get_finished_action_set();
break;
case Action::State::FINISHED:
state_set_ = model_->get_finished_action_set();
break;
+ case Action::State::IGNORED:
+ state_set_ = model_->get_ignored_action_set();
+ break;
default:
state_set_ = nullptr;
break;
default:
state_set_ = nullptr;
break;
// FIXME: sleep variables should not consume 1.0 in System::expand()
action->set_max_duration(duration);
action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
// FIXME: sleep variables should not consume 1.0 in System::expand()
action->set_max_duration(duration);
action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
- if (duration < 0) { // NO_MAX_DURATION
- /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
- simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
- action->state_set_ = &static_cast<CpuCas01Model*>(get_model())->cpuRunningActionSetThatDoesNotNeedBeingChecked_;
- action->get_state_set()->push_back(*action);
- }
+ if (duration < 0) // NO_MAX_DURATION
+ action->set_state(simgrid::kernel::resource::Action::State::IGNORED);
get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
get_model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) { // remove action from the heap
~CpuCas01Model() override;
Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
~CpuCas01Model() override;
Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core) override;
- kernel::resource::Action::StateSet cpuRunningActionSetThatDoesNotNeedBeingChecked_;
action->set_max_duration(duration);
action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
action->set_max_duration(duration);
action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
- if (duration == NO_MAX_DURATION) {
- /* Move to the *end* of the corresponding action set. This convention is used to speed up update_resource_state */
- simgrid::xbt::intrusive_erase(*action->get_state_set(), *action);
- action->state_set_ = &static_cast<CpuTiModel*>(get_model())->runningActionSetThatDoesNotNeedBeingChecked_;
- action->get_state_set()->push_back(*action);
- }
+ if (duration < 0) // NO_MAX_DURATION
+ action->set_state(simgrid::kernel::resource::Action::State::IGNORED);
action_set_.push_back(*action);
action_set_.push_back(*action);
double next_occuring_event(double now) override;
void update_actions_state(double now, double delta) override;
double next_occuring_event(double now) override;
void update_actions_state(double now, double delta) override;
- kernel::resource::Action::StateSet runningActionSetThatDoesNotNeedBeingChecked_;
CpuTiList modified_cpus_;
};
CpuTiList modified_cpus_;
};