virtual ~Model();
/** @brief Get the set of [actions](@ref Action) in *ready* state */
- Action::StateSet* getReadyActionSet() const { return ready_action_set_; }
+ Action::StateSet* get_ready_action_set() const { return ready_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *running* state */
- Action::StateSet* getRunningActionSet() const { return running_action_set_; }
+ Action::StateSet* get_running_action_set() const { return running_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *failed* state */
- Action::StateSet* getFailedActionSet() const { return failed_action_set_; }
+ Action::StateSet* get_failed_action_set() const { return failed_action_set_; }
/** @brief Get the set of [actions](@ref Action) in *done* state */
- Action::StateSet* getDoneActionSet() const { return done_action_set_; }
+ Action::StateSet* get_done_action_set() const { return done_action_set_; }
/** @brief Get the set of modified [actions](@ref Action) */
- Action::ModifiedSet* getModifiedSet() const;
+ Action::ModifiedSet* get_modified_set() const;
/** @brief Get the maxmin system of the current Model */
- lmm::System* getMaxminSystem() const { return maxmin_system_; }
+ lmm::System* get_maxmin_system() const { return maxmin_system_; }
/**
* @brief Get the update mechanism of the current Model
* @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
* @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()
*
: remains_(cost), start_time_(surf_get_clock()), cost_(cost), model_(model), variable_(var)
{
if (failed)
- state_set_ = get_model()->getFailedActionSet();
+ state_set_ = get_model()->get_failed_action_set();
else
- state_set_ = get_model()->getRunningActionSet();
+ state_set_ = get_model()->get_running_action_set();
state_set_->push_back(*this);
}
if (state_set_hook_.is_linked())
simgrid::xbt::intrusive_erase(*state_set_, *this);
if (get_variable())
- get_model()->getMaxminSystem()->variable_free(get_variable());
+ get_model()->get_maxmin_system()->variable_free(get_variable());
if (get_model()->getUpdateMechanism() == UM_LAZY) {
/* remove from heap */
heapRemove();
if (modified_set_hook_.is_linked())
- simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this);
+ simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
}
xbt_free(category_);
Action::State Action::get_state() const
{
- if (state_set_ == model_->getReadyActionSet())
+ if (state_set_ == model_->get_ready_action_set())
return Action::State::ready;
- if (state_set_ == model_->getRunningActionSet())
+ if (state_set_ == model_->get_running_action_set())
return Action::State::running;
- if (state_set_ == model_->getFailedActionSet())
+ if (state_set_ == model_->get_failed_action_set())
return Action::State::failed;
- if (state_set_ == model_->getDoneActionSet())
+ if (state_set_ == model_->get_done_action_set())
return Action::State::done;
return Action::State::not_in_the_system;
}
simgrid::xbt::intrusive_erase(*state_set_, *this);
switch (state) {
case Action::State::ready:
- state_set_ = model_->getReadyActionSet();
+ state_set_ = model_->get_ready_action_set();
break;
case Action::State::running:
- state_set_ = model_->getRunningActionSet();
+ state_set_ = model_->get_running_action_set();
break;
case Action::State::failed:
- state_set_ = model_->getFailedActionSet();
+ state_set_ = model_->get_failed_action_set();
break;
case Action::State::done:
- state_set_ = model_->getDoneActionSet();
+ state_set_ = model_->get_done_action_set();
break;
default:
state_set_ = nullptr;
{
XBT_IN("(%p,%g)", this, bound);
if (variable_)
- get_model()->getMaxminSystem()->update_variable_bound(variable_, bound);
+ get_model()->get_maxmin_system()->update_variable_bound(variable_, bound);
if (get_model()->getUpdateMechanism() == UM_LAZY && get_last_update() != surf_get_clock())
heapRemove();
{
XBT_IN("(%p,%g)", this, weight);
sharing_priority_ = weight;
- get_model()->getMaxminSystem()->update_variable_weight(get_variable(), weight);
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), weight);
if (get_model()->getUpdateMechanism() == UM_LAZY)
heapRemove();
set_state(Action::State::failed);
if (get_model()->getUpdateMechanism() == UM_LAZY) {
if (modified_set_hook_.is_linked())
- simgrid::xbt::intrusive_erase(*get_model()->getModifiedSet(), *this);
+ simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this);
heapRemove();
}
}
{
XBT_IN("(%p)", this);
if (suspended_ != SuspendStates::sleeping) {
- get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
if (get_model()->getUpdateMechanism() == UM_LAZY) {
heapRemove();
- if (state_set_ == get_model()->getRunningActionSet() && sharing_priority_ > 0) {
+ if (state_set_ == get_model()->get_running_action_set() && sharing_priority_ > 0) {
// If we have a lazy model, we need to update the remaining value accordingly
update_remains_lazy(surf_get_clock());
}
{
XBT_IN("(%p)", this);
if (suspended_ != SuspendStates::sleeping) {
- get_model()->getMaxminSystem()->update_variable_weight(get_variable(), get_priority());
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_priority());
suspended_ = SuspendStates::not_suspended;
if (get_model()->getUpdateMechanism() == UM_LAZY)
heapRemove();
return action;
}
-Action::ModifiedSet* Model::getModifiedSet() const
+Action::ModifiedSet* Model::get_modified_set() const
{
return maxmin_system_->modified_set_;
}
-double Model::nextOccuringEvent(double now)
+double Model::next_occuring_event(double now)
{
// FIXME: set the good function once and for all
if (update_mechanism_ == UM_LAZY)
- return nextOccuringEventLazy(now);
+ return next_occuring_event_lazy(now);
else if (update_mechanism_ == UM_FULL)
- return nextOccuringEventFull(now);
+ return next_occuring_event_full(now);
else
xbt_die("Invalid cpu update mechanism!");
}
-double Model::nextOccuringEventLazy(double now)
+double Model::next_occuring_event_lazy(double now)
{
XBT_DEBUG("Before share resources, the size of modified actions set is %zu", maxmin_system_->modified_set_->size());
lmm_solve(maxmin_system_);
while (not maxmin_system_->modified_set_->empty()) {
Action* action = &(maxmin_system_->modified_set_->front());
maxmin_system_->modified_set_->pop_front();
- bool max_dur_flag = false;
+ bool max_duration_flag = false;
if (action->get_state_set() != running_action_set_)
continue;
(min <= -1 || action->get_start_time() + action->get_max_duration() < min)) {
// when the task will complete anyway because of the deadline if any
min = action->get_start_time() + action->get_max_duration();
- max_dur_flag = true;
+ max_duration_flag = true;
}
XBT_DEBUG("Action(%p) corresponds to variable %d", action, action->get_variable()->id_int);
action->get_start_time(), min, share, action->get_max_duration());
if (min > -1) {
- action->heapUpdate(min, max_dur_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
+ action->heapUpdate(min, max_duration_flag ? Action::Type::MAX_DURATION : Action::Type::NORMAL);
XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min, now);
} else
DIE_IMPOSSIBLE;
}
}
-double Model::nextOccuringEventFull(double /*now*/)
+double Model::next_occuring_event_full(double /*now*/)
{
maxmin_system_->solve_fun(maxmin_system_);
double min = -1;
- for (Action& action : *getRunningActionSet()) {
+ for (Action& action : *get_running_action_set()) {
double value = action.get_variable()->get_value();
if (value > 0) {
if (action.get_remains() > 0)
return min;
}
-void Model::updateActionsState(double now, double delta)
+void Model::update_actions_state(double now, double delta)
{
if (update_mechanism_ == UM_FULL)
- updateActionsStateFull(now, delta);
+ update_actions_state_full(now, delta);
else if (update_mechanism_ == UM_LAZY)
- updateActionsStateLazy(now, delta);
+ update_actions_state_lazy(now, delta);
else
xbt_die("Invalid cpu update mechanism!");
}
-void Model::updateActionsStateLazy(double /*now*/, double /*delta*/)
+void Model::update_actions_state_lazy(double /*now*/, double /*delta*/)
{
THROW_UNIMPLEMENTED;
}
-void Model::updateActionsStateFull(double /*now*/, double /*delta*/)
+void Model::update_actions_state_full(double /*now*/, double /*delta*/)
{
THROW_UNIMPLEMENTED;
}
s4u::Host::onStateChange.connect(hostStateChange);
}
-double VMModel::nextOccuringEvent(double now)
+double VMModel::next_occuring_event(double now)
{
/* TODO: update action's cost with the total cost of processes on the VM. */
XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getCname(), ws_vm->getPm()->getCname());
xbt_assert(cpu->model() == surf_cpu_model_vm);
- kernel::lmm::System* vcpu_system = cpu->model()->getMaxminSystem();
+ kernel::lmm::System* vcpu_system = cpu->model()->get_maxmin_system();
vcpu_system->update_constraint_bound(cpu->constraint(), virt_overhead * solved_value);
}
ignoreEmptyVmInPmLMM();
/* 3. Ready. Get the next occurring event */
- return surf_cpu_model_vm->nextOccuringEvent(now);
+ return surf_cpu_model_vm->next_occuring_event(now);
}
/************
VMModel();
void ignoreEmptyVmInPmLMM() override{};
- double nextOccuringEvent(double now) override;
- void updateActionsState(double /*now*/, double /*delta*/) override{};
+ double next_occuring_event(double now) override;
+ void update_actions_state(double /*now*/, double /*delta*/) override{};
};
}
}
* Resource *
************/
CpuCas01::CpuCas01(CpuCas01Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
- : Cpu(model, host, model->getMaxminSystem()->constraint_new(this, core * speedPerPstate->front()), speedPerPstate,
+ : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, core * speedPerPstate->front()), speedPerPstate,
core)
{
}
bool CpuCas01::isUsed()
{
- return model()->getMaxminSystem()->constraint_used(constraint());
+ return model()->get_maxmin_system()->constraint_used(constraint());
}
/** @brief take into account changes of speed (either load or max) */
kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
- model()->getMaxminSystem()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
+ model()->get_maxmin_system()->update_constraint_bound(constraint(), coresAmount_ * speed_.scale * speed_.peak);
while ((var = constraint()->get_variable(&elem))) {
CpuCas01Action* action = static_cast<CpuCas01Action*>(var->get_id());
- model()->getMaxminSystem()->update_variable_bound(action->get_variable(),
- action->requestedCore() * speed_.scale * speed_.peak);
+ model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+ action->requestedCore() * speed_.scale * speed_.peak);
}
Cpu::onSpeedChange();
action->get_state_set()->push_back(*action);
}
- model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0);
+ model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
if (model()->getUpdateMechanism() == UM_LAZY) { // remove action from the heap
action->heapRemove();
// this is necessary for a variable with weight 0 since such variables are ignored in lmm and we need to set its
// max_duration correctly at the next call to share_resources
- model()->getModifiedSet()->push_front(*action);
+ model()->get_modified_set()->push_front(*action);
}
XBT_OUT();
CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
kernel::lmm::Constraint* constraint, int requestedCore)
: CpuAction(model, cost, failed,
- model->getMaxminSystem()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
+ model->get_maxmin_system()->variable_new(this, 1.0 / requestedCore, requestedCore * speed, 1))
, requestedCore_(requestedCore)
{
if (model->getUpdateMechanism() == UM_LAZY) {
set_last_update();
set_last_value(0.0);
}
- model->getMaxminSystem()->expand(constraint, get_variable(), 1.0);
+ model->get_maxmin_system()->expand(constraint, get_variable(), 1.0);
}
CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool failed, double speed,
* Model *
*********/
-void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
+void CpuModel::update_actions_state_lazy(double now, double /*delta*/)
{
while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
- for (kernel::resource::Action const& action : *getRunningActionSet()) {
+ for (kernel::resource::Action const& action : *get_running_action_set()) {
if (smaller < 0 || action.get_last_update() < smaller)
smaller = action.get_last_update();
}
}
}
-void CpuModel::updateActionsStateFull(double now, double delta)
+void CpuModel::update_actions_state_full(double now, double delta)
{
- for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
CpuAction& action = static_cast<CpuAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (TRACE_is_enabled()) {
void CpuAction::update_remains_lazy(double now)
{
- xbt_assert(get_state_set() == get_model()->getRunningActionSet(), "You're updating an action that is not running.");
+ xbt_assert(get_state_set() == get_model()->get_running_action_set(),
+ "You're updating an action that is not running.");
xbt_assert(get_priority() > 0, "You're updating an action that seems suspended.");
double delta = now - get_last_update();
*/
virtual Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double> *speedPerPstate, int core)=0;
- void updateActionsStateLazy(double now, double delta) override;
- void updateActionsStateFull(double now, double delta) override;
+ void update_actions_state_lazy(double now, double delta) override;
+ void update_actions_state_full(double now, double delta) override;
};
/************
return new CpuTi(this, host, speedPerPstate, core);
}
-double CpuTiModel::nextOccuringEvent(double now)
+double CpuTiModel::next_occuring_event(double now)
{
double min_action_duration = -1;
return min_action_duration;
}
-void CpuTiModel::updateActionsState(double now, double /*delta*/)
+void CpuTiModel::update_actions_state(double now, double /*delta*/)
{
while (not actionHeapIsEmpty() && actionHeapTopDate() <= now) {
CpuTiAction* action = static_cast<CpuTiAction*>(actionHeapPop());
for (CpuTiAction const& action : actionSet_) {
/* action not running, skip it */
- if (action.get_state_set() != surf_cpu_model_pm->getRunningActionSet())
+ if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
continue;
/* bogus priority, skip it */
for (CpuTiAction& action : actionSet_) {
double min_finish = -1;
/* action not running, skip it */
- if (action.get_state_set() != surf_cpu_model_pm->getRunningActionSet())
+ if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
continue;
/* verify if the action is really running on cpu */
XBT_DEBUG("Flops total: %f, Last update %f", area_total, lastUpdate_);
for (CpuTiAction& action : actionSet_) {
/* action not running, skip it */
- if (action.get_state_set() != model()->getRunningActionSet())
+ if (action.get_state_set() != model()->get_running_action_set())
continue;
/* bogus priority, skip it */
CpuTiModel() = default;
~CpuTiModel() override;
Cpu *createCpu(simgrid::s4u::Host *host, std::vector<double>* speedPerPstate, int core) override;
- double nextOccuringEvent(double now) override;
- void updateActionsState(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 modifiedCpu_;
namespace simgrid {
namespace surf {
-double HostCLM03Model::nextOccuringEvent(double now){
+double HostCLM03Model::next_occuring_event(double now)
+{
ignoreEmptyVmInPmLMM();
- double min_by_cpu = surf_cpu_model_pm->nextOccuringEvent(now);
- double min_by_net = surf_network_model->nextOccuringEventIsIdempotent() ? surf_network_model->nextOccuringEvent(now) : -1;
- double min_by_sto = surf_storage_model->nextOccuringEvent(now);
+ double min_by_cpu = surf_cpu_model_pm->next_occuring_event(now);
+ double min_by_net =
+ surf_network_model->nextOccuringEventIsIdempotent() ? surf_network_model->next_occuring_event(now) : -1;
+ double min_by_sto = surf_storage_model->next_occuring_event(now);
XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
this, typeid(surf_cpu_model_pm).name(), min_by_cpu,
return res;
}
-void HostCLM03Model::updateActionsState(double /*now*/, double /*delta*/){
+void HostCLM03Model::update_actions_state(double /*now*/, double /*delta*/)
+{
/* I won't do what you tell me */
}
class HostCLM03Model : public HostModel {
public:
- double nextOccuringEvent(double now) override;
- void updateActionsState(double now, double delta) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
};
}
}
return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxmin_system_);
}
-void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
+void NetworkCm02Model::update_actions_state_lazy(double now, double /*delta*/)
{
while (not actionHeapIsEmpty() && double_equals(actionHeapTopDate(), now, sg_surf_precision)) {
}
}
-
-void NetworkCm02Model::updateActionsStateFull(double now, double delta)
+void NetworkCm02Model::update_actions_state_full(double now, double delta)
{
- for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
NetworkCm02Action& action = static_cast<NetworkCm02Action&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
XBT_DEBUG("Something happened to action %p", &action);
{
bandwidth_.peak = value;
- model()->getMaxminSystem()->update_constraint_bound(constraint(),
- sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
+ model()->get_maxmin_system()->update_constraint_bound(constraint(),
+ sg_bandwidth_factor * (bandwidth_.peak * bandwidth_.scale));
TRACE_surf_link_set_bandwidth(surf_get_clock(), getCname(), sg_bandwidth_factor * bandwidth_.peak * bandwidth_.scale);
if (sg_weight_S_parameter > 0) {
NetworkCm02Action* action = static_cast<NetworkCm02Action*>(var->get_id());
action->weight_ += delta;
if (not action->is_suspended())
- model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_);
+ model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
}
}
}
action->latCurrent_ += delta;
action->weight_ += delta;
if (action->rate_ < 0)
- model()->getMaxminSystem()->update_variable_bound(action->get_variable(),
- sg_tcp_gamma / (2.0 * action->latCurrent_));
+ model()->get_maxmin_system()->update_variable_bound(action->get_variable(),
+ sg_tcp_gamma / (2.0 * action->latCurrent_));
else {
- model()->getMaxminSystem()->update_variable_bound(
+ model()->get_maxmin_system()->update_variable_bound(
action->get_variable(), std::min(action->rate_, sg_tcp_gamma / (2.0 * action->latCurrent_)));
if (action->rate_ < sg_tcp_gamma / (2.0 * action->latCurrent_)) {
}
}
if (not action->is_suspended())
- model()->getMaxminSystem()->update_variable_weight(action->get_variable(), action->weight_);
+ model()->get_maxmin_system()->update_variable_weight(action->get_variable(), action->weight_);
}
}
virtual ~NetworkCm02Model() = default;
LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
- void updateActionsStateLazy(double now, double delta) override;
- void updateActionsStateFull(double now, double delta) override;
+ void update_actions_state_lazy(double now, double delta) override;
+ void update_actions_state_full(double now, double delta) override;
kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
};
return nullptr;
}
-double NetworkConstantModel::nextOccuringEvent(double /*now*/)
+double NetworkConstantModel::next_occuring_event(double /*now*/)
{
double min = -1.0;
- for (kernel::resource::Action const& action : *getRunningActionSet()) {
+ for (kernel::resource::Action const& action : *get_running_action_set()) {
const NetworkConstantAction& net_action = static_cast<const NetworkConstantAction&>(action);
if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min))
min = net_action.latency_;
return min;
}
-void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
+void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
{
- for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
NetworkConstantAction& action = static_cast<NetworkConstantAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (action.latency_ > 0) {
public:
kernel::resource::Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size,
double rate) override;
- double nextOccuringEvent(double now) override;
- void updateActionsState(double now, double delta) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
LinkImpl* createLink(const std::string& name, double bw, double lat,
e_surf_link_sharing_policy_t policy) override;
return rate;
}
- double NetworkModel::nextOccuringEventFull(double now)
+ double NetworkModel::next_occuring_event_full(double now)
{
- double minRes = Model::nextOccuringEventFull(now);
+ double minRes = Model::next_occuring_event_full(now);
- for (kernel::resource::Action const& action : *getRunningActionSet()) {
+ for (kernel::resource::Action const& action : *get_running_action_set()) {
const NetworkAction& net_action = static_cast<const NetworkAction&>(action);
if (net_action.latency_ > 0)
minRes = (minRes < 0) ? net_action.latency_ : std::min(minRes, net_action.latency_);
bool LinkImpl::isUsed()
{
- return model()->getMaxminSystem()->constraint_used(constraint());
+ return model()->get_maxmin_system()->constraint_used(constraint());
}
double LinkImpl::latency()
* @return The new bandwidth.
*/
virtual double bandwidthConstraint(double rate, double bound, double size);
- double nextOccuringEventFull(double now) override;
+ double next_occuring_event_full(double now) override;
LinkImpl* loopback_ = nullptr;
};
return new NetworkNS3Action(this, size, src, dst);
}
-double NetworkNS3Model::nextOccuringEvent(double now)
+double NetworkNS3Model::next_occuring_event(double now)
{
double time_to_next_flow_completion;
XBT_DEBUG("ns3_next_occuring_event");
//get the first relevant value from the running_actions list
- if (not getRunningActionSet()->size() || now == 0.0)
+ if (not get_running_action_set()->size() || now == 0.0)
return -1.0;
else
do {
return time_to_next_flow_completion;
}
-void NetworkNS3Model::updateActionsState(double now, double delta)
+void NetworkNS3Model::update_actions_state(double now, double delta)
{
static std::vector<std::string> socket_to_destroy;
/* If there are no running flows, advance the NS3 simulator and return */
- if (getRunningActionSet()->empty()) {
+ if (get_running_action_set()->empty()) {
while(double_positive(now - ns3::Simulator::Now().GetSeconds(), sg_surf_precision))
ns3_simulator(now-ns3::Simulator::Now().GetSeconds());
LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
- double nextOccuringEvent(double now) override;
+ double next_occuring_event(double now) override;
bool nextOccuringEventIsIdempotent() override { return false; }
- void updateActionsState(double now, double delta) override;
+ void update_actions_state(double now, double delta) override;
};
/************
maxmin_system_ = nullptr;
}
-double HostL07Model::nextOccuringEvent(double now)
+double HostL07Model::next_occuring_event(double now)
{
- double min = HostModel::nextOccuringEventFull(now);
- for (kernel::resource::Action const& action : *getRunningActionSet()) {
+ double min = HostModel::next_occuring_event_full(now);
+ for (kernel::resource::Action const& action : *get_running_action_set()) {
const L07Action& net_action = static_cast<const L07Action&>(action);
if (net_action.latency_ > 0 && (min < 0 || net_action.latency_ < min)) {
min = net_action.latency_;
return min;
}
-void HostL07Model::updateActionsState(double /*now*/, double delta)
+void HostL07Model::update_actions_state(double /*now*/, double delta)
{
- for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
L07Action& action = static_cast<L07Action&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
if (action.latency_ > 0) {
XBT_DEBUG("Creating a parallel task (%p) with %d hosts and %d unique links.", this, host_nb, nb_link);
latency_ = latency;
- set_variable(model->getMaxminSystem()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
+ set_variable(model->get_maxmin_system()->variable_new(this, 1.0, (rate > 0 ? rate : -1.0), host_nb + nb_link));
if (latency_ > 0)
- model->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
+ model->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
for (int i = 0; i < host_nb; i++)
- model->getMaxminSystem()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]);
+ model->get_maxmin_system()->expand(host_list[i]->pimpl_cpu->constraint(), get_variable(), flops_amount[i]);
if(bytes_amount != nullptr) {
for (int i = 0; i < host_nb; i++) {
hostList_->at(i)->routeTo(hostList_->at(j), route, nullptr);
for (auto const& link : route)
- model->getMaxminSystem()->expand_add(link->constraint(), this->get_variable(),
- bytes_amount[i * host_nb + j]);
+ model->get_maxmin_system()->expand_add(link->constraint(), this->get_variable(),
+ bytes_amount[i * host_nb + j]);
}
}
}
************/
CpuL07::CpuL07(CpuL07Model* model, simgrid::s4u::Host* host, std::vector<double>* speedPerPstate, int core)
- : Cpu(model, host, model->getMaxminSystem()->constraint_new(this, speedPerPstate->front()), speedPerPstate, core)
+ : Cpu(model, host, model->get_maxmin_system()->constraint_new(this, speedPerPstate->front()), speedPerPstate, core)
{
}
LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
- : LinkImpl(model, name, model->getMaxminSystem()->constraint_new(this, bandwidth))
+ : LinkImpl(model, name, model->get_maxmin_system()->constraint_new(this, bandwidth))
{
bandwidth_.peak = bandwidth;
latency_.peak = latency;
L07Action *action = static_cast<L07Action*>(execution_start(1.0));
action->set_max_duration(duration);
action->suspended_ = kernel::resource::Action::SuspendStates::sleeping;
- model()->getMaxminSystem()->update_variable_weight(action->get_variable(), 0.0);
+ model()->get_maxmin_system()->update_variable_weight(action->get_variable(), 0.0);
return action;
}
bool CpuL07::isUsed(){
- return model()->getMaxminSystem()->constraint_used(constraint());
+ return model()->get_maxmin_system()->constraint_used(constraint());
}
/** @brief take into account changes of speed (either load or max) */
kernel::lmm::Variable* var = nullptr;
const_lmm_element_t elem = nullptr;
- model()->getMaxminSystem()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
+ model()->get_maxmin_system()->update_constraint_bound(constraint(), speed_.peak * speed_.scale);
while ((var = constraint()->get_variable(&elem))) {
kernel::resource::Action* action = static_cast<kernel::resource::Action*>(var->get_id());
- model()->getMaxminSystem()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
+ model()->get_maxmin_system()->update_variable_bound(action->get_variable(), speed_.scale * speed_.peak);
}
Cpu::onSpeedChange();
bool LinkL07::isUsed(){
- return model()->getMaxminSystem()->constraint_used(constraint());
+ return model()->get_maxmin_system()->constraint_used(constraint());
}
void CpuL07::apply_event(tmgr_trace_event_t triggered, double value)
void LinkL07::setBandwidth(double value)
{
bandwidth_.peak = value;
- model()->getMaxminSystem()->update_constraint_bound(constraint(), bandwidth_.peak * bandwidth_.scale);
+ model()->get_maxmin_system()->update_constraint_bound(constraint(), bandwidth_.peak * bandwidth_.scale);
}
void LinkL07::setLatency(double value)
XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
if ((latency_ <= 0.0) && (suspended_ == Action::SuspendStates::not_suspended)) {
if (rate_ < 0)
- get_model()->getMaxminSystem()->update_variable_bound(get_variable(), lat_bound);
+ get_model()->get_maxmin_system()->update_variable_bound(get_variable(), lat_bound);
else
- get_model()->getMaxminSystem()->update_variable_bound(get_variable(), std::min(rate_, lat_bound));
+ get_model()->get_maxmin_system()->update_variable_bound(get_variable(), std::min(rate_, lat_bound));
}
}
HostL07Model();
~HostL07Model();
- double nextOccuringEvent(double now) override;
- void updateActionsState(double now, double delta) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
kernel::resource::Action* executeParallelTask(int host_nb, sg_host_t* host_list, double* flops_amount,
double* bytes_amount, double rate) override;
};
return storage;
}
-double StorageN11Model::nextOccuringEvent(double now)
+double StorageN11Model::next_occuring_event(double now)
{
- return StorageModel::nextOccuringEventFull(now);
+ return StorageModel::next_occuring_event_full(now);
}
-void StorageN11Model::updateActionsState(double /*now*/, double delta)
+void StorageN11Model::update_actions_state(double /*now*/, double delta)
{
- for (auto it = std::begin(*getRunningActionSet()); it != std::end(*getRunningActionSet());) {
+ for (auto it = std::begin(*get_running_action_set()); it != std::end(*get_running_action_set());) {
StorageAction& action = static_cast<StorageAction&>(*it);
++it; // increment iterator here since the following calls to action.finish() may invalidate it
action.update_remains(lrint(action.get_variable()->get_value() * delta));
StorageN11Action::StorageN11Action(kernel::resource::Model* model, double cost, bool failed, StorageImpl* storage,
e_surf_action_storage_type_t type)
- : StorageAction(model, cost, failed, model->getMaxminSystem()->variable_new(this, 1.0, -1.0, 3), storage, type)
+ : StorageAction(model, cost, failed, model->get_maxmin_system()->variable_new(this, 1.0, -1.0, 3), storage, type)
{
XBT_IN("(%s,%g", storage->getCname(), cost);
// Must be less than the max bandwidth for all actions
- model->getMaxminSystem()->expand(storage->constraint(), get_variable(), 1.0);
+ model->get_maxmin_system()->expand(storage->constraint(), get_variable(), 1.0);
switch(type) {
case READ:
- model->getMaxminSystem()->expand(storage->constraintRead_, get_variable(), 1.0);
+ model->get_maxmin_system()->expand(storage->constraintRead_, get_variable(), 1.0);
break;
case WRITE:
- model->getMaxminSystem()->expand(storage->constraintWrite_, get_variable(), 1.0);
+ model->get_maxmin_system()->expand(storage->constraintWrite_, get_variable(), 1.0);
break;
default:
THROW_UNIMPLEMENTED;
{
XBT_IN("(%p)", this);
if (suspended_ != Action::SuspendStates::sleeping) {
- get_model()->getMaxminSystem()->update_variable_weight(get_variable(), 0.0);
+ get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0);
suspended_ = Action::SuspendStates::suspended;
}
XBT_OUT();
public:
StorageImpl* createStorage(std::string id, std::string type_id, std::string content_name,
std::string attach) override;
- double nextOccuringEvent(double now) override;
- void updateActionsState(double now, double delta) override;
+ double next_occuring_event(double now) override;
+ void update_actions_state(double now, double delta) override;
};
/************
XBT_DEBUG ("Set every models in the right state by updating them to 0.");
for (auto const& model : *all_existing_models)
- model->updateActionsState(NOW, 0.0);
+ model->update_actions_state(NOW, 0.0);
}
double surf_solve(double max_date)
/* Physical models MUST be resolved first */
XBT_DEBUG("Looking for next event in physical models");
- double next_event_phy = surf_host_model->nextOccuringEvent(NOW);
+ double next_event_phy = surf_host_model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_phy < time_delta) && next_event_phy >= 0.0) {
time_delta = next_event_phy;
}
if (surf_vm_model != nullptr) {
XBT_DEBUG("Looking for next event in virtual models");
- double next_event_virt = surf_vm_model->nextOccuringEvent(NOW);
+ double next_event_virt = surf_vm_model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_virt < time_delta) && next_event_virt >= 0.0)
time_delta = next_event_virt;
}
for (auto const& model : *all_existing_models) {
if (model != surf_host_model && model != surf_vm_model && model != surf_network_model &&
model != surf_storage_model) {
- double next_event_model = model->nextOccuringEvent(NOW);
+ double next_event_model = model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_model < time_delta) && next_event_model >= 0.0)
time_delta = next_event_model;
}
XBT_DEBUG("Run the NS3 network at most %fs", time_delta);
// run until min or next flow
- model_next_action_end = surf_network_model->nextOccuringEvent(time_delta);
+ model_next_action_end = surf_network_model->next_occuring_event(time_delta);
XBT_DEBUG("Min for network : %f", model_next_action_end);
if (model_next_action_end >= 0.0)
// Inform the models of the date change
for (auto const& model : *all_existing_models)
- model->updateActionsState(NOW, time_delta);
+ model->update_actions_state(NOW, time_delta);
simgrid::s4u::onTimeAdvance(time_delta);
simgrid::kernel::resource::Action* surf_model_extract_done_action_set(simgrid::kernel::resource::Model* model)
{
- return ActionListExtract(model->getDoneActionSet());
+ return ActionListExtract(model->get_done_action_set());
}
simgrid::kernel::resource::Action* surf_model_extract_failed_action_set(simgrid::kernel::resource::Model* model)
{
- return ActionListExtract(model->getFailedActionSet());
+ return ActionListExtract(model->get_failed_action_set());
}
int surf_model_running_action_set_size(simgrid::kernel::resource::Model* model)
{
- return model->getRunningActionSet()->size();
+ return model->get_running_action_set()->size();
}
void surf_cpu_action_set_bound(simgrid::kernel::resource::Action* action, double bound)
XBT_INFO("Next Event : %g", surf_get_clock());
XBT_DEBUG("\t CPU actions");
- simgrid::kernel::resource::Action::StateSet* action_list = surf_cpu_model_pm->getFailedActionSet();
+ simgrid::kernel::resource::Action::StateSet* action_list = surf_cpu_model_pm->get_failed_action_set();
while (not action_list->empty()) {
simgrid::kernel::resource::Action& action = action_list->front();
XBT_INFO(" CPU Failed action");
action.unref();
}
- action_list = surf_cpu_model_pm->getDoneActionSet();
+ action_list = surf_cpu_model_pm->get_done_action_set();
while (not action_list->empty()) {
simgrid::kernel::resource::Action& action = action_list->front();
XBT_INFO(" CPU Done action");
action.unref();
}
- action_list = surf_network_model->getFailedActionSet();
+ action_list = surf_network_model->get_failed_action_set();
while (not action_list->empty()) {
simgrid::kernel::resource::Action& action = action_list->front();
XBT_INFO(" Network Failed action");
action.unref();
}
- action_list = surf_network_model->getDoneActionSet();
+ action_list = surf_network_model->get_done_action_set();
while (not action_list->empty()) {
simgrid::kernel::resource::Action& action = action_list->front();
XBT_INFO(" Network Done action");
action.unref();
}
- } while ((surf_network_model->getRunningActionSet()->size() ||
- surf_cpu_model_pm->getRunningActionSet()->size()) && surf_solve(-1.0) >= 0.0);
+ } while (
+ (surf_network_model->get_running_action_set()->size() || surf_cpu_model_pm->get_running_action_set()->size()) &&
+ surf_solve(-1.0) >= 0.0);
XBT_DEBUG("Simulation Terminated");