#define SIMGRID_KERNEL_RESOURCE_RESOURCE_HPP
#include "simgrid/forward.h"
+#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/actor/Simcall.hpp"
#include "src/kernel/lmm/maxmin.hpp" // Constraint
#include "src/kernel/resource/profile/Event.hpp"
Model* model_ = nullptr;
lmm::Constraint* constraint_ = nullptr;
+protected:
+ void cancel_actions()
+ {
+ const kernel::lmm::Element* elem = nullptr;
+ double now = EngineImpl::get_clock();
+ while (const auto* var = get_constraint()->get_variable(&elem)) {
+ Action* action = var->get_id();
+ if (action->get_state() == Action::State::INITED || action->get_state() == Action::State::STARTED ||
+ action->get_state() == Action::State::IGNORED) {
+ action->set_finish_time(now);
+ action->set_state(Action::State::FAILED);
+ }
+ }
+ }
+
public:
using Resource::Resource;
/** @brief setup the profile file with states events (ON or OFF). The profile must contain boolean values. */
/** @brief returns the current load due to activities (in flops per second, byte per second or similar)
*
* The load due to external usages modeled by profile files is ignored.*/
- virtual double get_load() const { return constraint_->get_usage(); }
+ virtual double get_load() const { return constraint_->get_load(); }
bool is_used() const override { return model_->get_maxmin_system()->constraint_used(constraint_); }
};