#define SIMIX_H_NO_DEPRECATED_WARNING // avoid deprecation warning on include (remove with XBT_ATTRIB_DEPRECATED_v335)
#include <simgrid/simix.h>
+#include <cmath>
+
void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, simgrid::kernel::activity::MailboxImpl* mbox,
double task_size, double rate, void* src_buff, size_t src_buff_size,
bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/Synchro.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
-#include "src/kernel/resource/SplitDuplexLinkImpl.hpp"
#include <boost/intrusive/list.hpp>
#include <map>
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/resource/CpuImpl.hpp"
-#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/models/cpu_ti.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/simgrid/math_utils.h"
{
if (is_on()) {
Resource::turn_off();
-
- 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->set_finish_time(now);
- action->set_state(Action::State::FAILED);
- }
- }
+ cancel_actions();
}
}
Resource::turn_off();
s4u::Disk::on_onoff(piface_);
piface_.on_this_onoff(piface_);
-
- 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->set_finish_time(now);
- action->set_state(Action::State::FAILED);
- }
- }
+ cancel_actions();
}
}
#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. */
#include <simgrid/s4u/Engine.hpp>
-#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/StandardLinkImpl.hpp"
#include <numeric>
Resource::turn_off();
s4u::Link::on_onoff(piface_);
piface_.on_this_onoff(piface_);
-
- 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->set_finish_time(now);
- action->set_state(Action::State::FAILED);
- }
- }
+ cancel_actions();
}
}
get_iface()->turn_on();
}
} else {
- const lmm::Element* elem = nullptr;
- double date = EngineImpl::get_clock();
-
get_iface()->turn_off();
-
- 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(date);
- action->set_state(Action::State::FAILED);
- }
- }
+ cancel_actions();
}
unref_state_event();
}
} else {
get_iface()->turn_off();
- double date = EngineImpl::get_clock();
/* put all action running on cpu to failed */
+ double now = EngineImpl::get_clock();
for (CpuTiAction& action : action_set_) {
if (action.get_state() == Action::State::INITED || action.get_state() == Action::State::STARTED ||
action.get_state() == Action::State::IGNORED) {
- action.set_finish_time(date);
+ action.set_finish_time(now);
action.set_state(Action::State::FAILED);
get_model()->get_action_heap().remove(&action);
}
#include "src/kernel/EngineImpl.hpp"
#include "src/kernel/resource/DiskImpl.hpp"
#include "src/kernel/resource/HostImpl.hpp"
+#include "src/kernel/resource/StandardLinkImpl.hpp"
#include "src/kernel/resource/profile/Profile.hpp"
#include "src/kernel/xml/platf.hpp"
#include "src/kernel/xml/platf_private.hpp"