surf_cpu_model_pm = nullptr;
}
-Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, std::vector<double>* speedPerPstate, int core)
+Cpu* CpuTiModel::create_cpu(simgrid::s4u::Host* host, std::vector<double>* speed_per_pstate, int core)
{
- return new CpuTi(this, host, speedPerPstate, core);
+ return new CpuTi(this, host, speed_per_pstate, core);
}
double CpuTiModel::next_occuring_event(double now)
while (not get_action_heap().empty() && double_equals(get_action_heap().top_date(), now, sg_surf_precision)) {
CpuTiAction* action = static_cast<CpuTiAction*>(get_action_heap().pop());
XBT_DEBUG("Action %p: finish", action);
- action->finish(kernel::resource::Action::State::done);
+ action->finish(kernel::resource::Action::State::FINISHED);
/* update remaining amount of all actions */
action->cpu_->update_remaining_amount(surf_get_clock());
}
tmgr_trace_event_unref(&speed_.event);
- } else if (event == stateEvent_) {
+ } else if (event == state_event_) {
if (value > 0) {
if (is_off())
- host_that_restart.push_back(getHost());
+ host_that_restart.push_back(get_host());
turn_on();
} else {
turn_off();
/* put all action running on cpu to failed */
for (CpuTiAction& action : action_set_) {
- if (action.get_state() == kernel::resource::Action::State::inited ||
- action.get_state() == kernel::resource::Action::State::running ||
- action.get_state() == kernel::resource::Action::State::ignored) {
+ if (action.get_state() == kernel::resource::Action::State::INITED ||
+ action.get_state() == kernel::resource::Action::State::STARTED ||
+ action.get_state() == kernel::resource::Action::State::IGNORED) {
action.set_finish_time(date);
- action.set_state(kernel::resource::Action::State::failed);
+ action.set_state(kernel::resource::Action::State::FAILED);
get_model()->get_action_heap().remove(&action);
}
}
}
- tmgr_trace_event_unref(&stateEvent_);
+ tmgr_trace_event_unref(&state_event_);
} else {
xbt_die("Unknown event!\n");
sum_priority_ = 0.0;
for (CpuTiAction const& action : action_set_) {
/* action not running, skip it */
- if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
+ if (action.get_state_set() != surf_cpu_model_pm->get_started_action_set())
continue;
/* bogus priority, skip it */
for (CpuTiAction& action : action_set_) {
double min_finish = -1;
/* action not running, skip it */
- if (action.get_state_set() != surf_cpu_model_pm->get_running_action_set())
+ if (action.get_state_set() != surf_cpu_model_pm->get_started_action_set())
continue;
/* verify if the action is really running on cpu */
return not action_set_.empty();
}
-double CpuTi::get_available_speed()
+double CpuTi::get_speed_ratio()
{
speed_.scale = speed_integrated_trace_->get_power_scale(surf_get_clock());
- return Cpu::get_available_speed();
+ return Cpu::get_speed_ratio();
}
/** @brief Update the remaining amount of actions */
XBT_DEBUG("Flops total: %f, Last update %f", area_total, last_update_);
for (CpuTiAction& action : action_set_) {
/* action not running, skip it */
- if (action.get_state_set() != get_model()->get_running_action_set())
+ if (action.get_state_set() != get_model()->get_started_action_set())
continue;
/* bogus priority, skip it */
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);
void CpuTiAction::cancel()
{
- this->set_state(Action::State::failed);
+ this->set_state(Action::State::FAILED);
get_model()->get_action_heap().remove(this);
cpu_->set_modified(true);
}