From fada3b2a44977aca17ab9e8163df0795378ad129 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 25 May 2018 01:59:06 +0200 Subject: [PATCH] enum class values should be UPPER_CASE --- include/simgrid/kernel/resource/Model.hpp | 4 ++-- src/kernel/resource/Action.cpp | 14 +++++++------- src/kernel/resource/Model.cpp | 8 ++++---- src/surf/HostImpl.hpp | 2 +- src/surf/StorageImpl.cpp | 2 +- src/surf/cpu_cas01.cpp | 10 +++++----- src/surf/cpu_ti.hpp | 2 +- src/surf/network_cm02.cpp | 8 ++++---- src/surf/network_constant.hpp | 2 +- src/surf/network_ns3.cpp | 2 +- src/surf/ptask_L07.cpp | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/include/simgrid/kernel/resource/Model.hpp b/include/simgrid/kernel/resource/Model.hpp index 27cd6045ee..59a0ccec1b 100644 --- a/include/simgrid/kernel/resource/Model.hpp +++ b/include/simgrid/kernel/resource/Model.hpp @@ -20,8 +20,8 @@ class XBT_PUBLIC Model { public: /** @brief Possible update mechanisms */ enum class UpdateAlgo { - Full, /**< Full update mechanism: the remaining time of every action is recomputed at each step */ - Lazy /**< Lazy update mechanism: only the modified actions get recomputed. + FULL, /**< Full update mechanism: the remaining time of every action is recomputed at each step */ + LAZY /**< Lazy update mechanism: only the modified actions get recomputed. It may be slower than full if your system is tightly coupled to the point where every action gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for a simple full update. */ diff --git a/src/kernel/resource/Action.cpp b/src/kernel/resource/Action.cpp index 02aee24eba..86f2e2a460 100644 --- a/src/kernel/resource/Action.cpp +++ b/src/kernel/resource/Action.cpp @@ -106,7 +106,7 @@ void Action::set_bound(double bound) if (variable_) get_model()->get_maxmin_system()->update_variable_bound(variable_, bound); - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy && get_last_update() != surf_get_clock()) + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY && get_last_update() != surf_get_clock()) get_model()->get_action_heap().remove(this); XBT_OUT(); } @@ -124,7 +124,7 @@ void Action::ref() void Action::set_max_duration(double duration) { max_duration_ = duration; - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) // remove action from the heap + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) // remove action from the heap get_model()->get_action_heap().remove(this); } @@ -134,7 +134,7 @@ void Action::set_priority(double weight) sharing_priority_ = weight; get_model()->get_maxmin_system()->update_variable_weight(get_variable(), weight); - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) get_model()->get_action_heap().remove(this); XBT_OUT(); } @@ -142,7 +142,7 @@ void Action::set_priority(double weight) void Action::cancel() { set_state(Action::State::FAILED); - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) { + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) { if (modified_set_hook_.is_linked()) simgrid::xbt::intrusive_erase(*get_model()->get_modified_set(), *this); get_model()->get_action_heap().remove(this); @@ -164,7 +164,7 @@ void Action::suspend() XBT_IN("(%p)", this); if (suspended_ != SuspendStates::sleeping) { get_model()->get_maxmin_system()->update_variable_weight(get_variable(), 0.0); - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) { + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) { get_model()->get_action_heap().remove(this); if (state_set_ == get_model()->get_started_action_set() && sharing_priority_ > 0) { // If we have a lazy model, we need to update the remaining value accordingly @@ -182,7 +182,7 @@ void Action::resume() if (suspended_ != SuspendStates::sleeping) { get_model()->get_maxmin_system()->update_variable_weight(get_variable(), get_priority()); suspended_ = SuspendStates::not_suspended; - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) get_model()->get_action_heap().remove(this); } XBT_OUT(); @@ -197,7 +197,7 @@ double Action::get_remains() { XBT_IN("(%p)", this); /* update remains before return it */ - if (get_model()->get_update_algorithm() == Model::UpdateAlgo::Lazy) /* update remains before return it */ + if (get_model()->get_update_algorithm() == Model::UpdateAlgo::LAZY) /* update remains before return it */ update_remains_lazy(surf_get_clock()); XBT_OUT(); return remains_; diff --git a/src/kernel/resource/Model.cpp b/src/kernel/resource/Model.cpp index 63e662a208..65c0350da5 100644 --- a/src/kernel/resource/Model.cpp +++ b/src/kernel/resource/Model.cpp @@ -32,9 +32,9 @@ Action::ModifiedSet* Model::get_modified_set() const double Model::next_occuring_event(double now) { // FIXME: set the good function once and for all - if (update_algorithm_ == Model::UpdateAlgo::Lazy) + if (update_algorithm_ == Model::UpdateAlgo::LAZY) return next_occuring_event_lazy(now); - else if (update_algorithm_ == Model::UpdateAlgo::Full) + else if (update_algorithm_ == Model::UpdateAlgo::FULL) return next_occuring_event_full(now); else xbt_die("Invalid cpu update mechanism!"); @@ -133,9 +133,9 @@ double Model::next_occuring_event_full(double /*now*/) void Model::update_actions_state(double now, double delta) { - if (update_algorithm_ == Model::UpdateAlgo::Full) + if (update_algorithm_ == Model::UpdateAlgo::FULL) update_actions_state_full(now, delta); - else if (update_algorithm_ == Model::UpdateAlgo::Lazy) + else if (update_algorithm_ == Model::UpdateAlgo::LAZY) update_actions_state_lazy(now, delta); else xbt_die("Invalid cpu update mechanism!"); diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 4aa758f268..a0a1892549 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -25,7 +25,7 @@ namespace surf { */ class XBT_PRIVATE HostModel : public kernel::resource::Model { public: - HostModel() : Model(Model::UpdateAlgo::Full) {} + HostModel() : Model(Model::UpdateAlgo::FULL) {} virtual void ignore_empty_vm_in_pm_LMM(); virtual kernel::resource::Action* execute_parallel(int host_nb, sg_host_t* host_list, double* flops_amount, diff --git a/src/surf/StorageImpl.cpp b/src/surf/StorageImpl.cpp index 5df10ecc2f..05dee157ee 100644 --- a/src/surf/StorageImpl.cpp +++ b/src/surf/StorageImpl.cpp @@ -20,7 +20,7 @@ namespace surf { * Model * *********/ -StorageModel::StorageModel() : Model(Model::UpdateAlgo::Full) +StorageModel::StorageModel() : Model(Model::UpdateAlgo::FULL) { set_maxmin_system(new simgrid::kernel::lmm::System(true /* selective update */)); } diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 1cf6f1b7cf..c3bdc57cdd 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -44,9 +44,9 @@ void surf_cpu_model_init_Cas01() simgrid::kernel::resource::Model::UpdateAlgo algo; if (cpu_optim_opt == "Lazy") - algo = simgrid::kernel::resource::Model::UpdateAlgo::Lazy; + algo = simgrid::kernel::resource::Model::UpdateAlgo::LAZY; else - algo = simgrid::kernel::resource::Model::UpdateAlgo::Full; + algo = simgrid::kernel::resource::Model::UpdateAlgo::FULL; surf_cpu_model_pm = new simgrid::surf::CpuCas01Model(algo); all_existing_models->push_back(surf_cpu_model_pm); @@ -62,7 +62,7 @@ CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid { bool select = simgrid::config::get_value("cpu/maxmin-selective-update"); - if (algo == Model::UpdateAlgo::Lazy) { + if (algo == Model::UpdateAlgo::LAZY) { xbt_assert(select || simgrid::config::is_default("cpu/maxmin-selective-update"), "You cannot disable cpu selective update when using the lazy update mechanism"); select = true; @@ -185,7 +185,7 @@ CpuAction *CpuCas01::sleep(double 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 + if (get_model()->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::LAZY) { // remove action from the heap get_model()->get_action_heap().remove(action); // 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 @@ -205,7 +205,7 @@ CpuCas01Action::CpuCas01Action(kernel::resource::Model* model, double cost, bool model->get_maxmin_system()->variable_new(this, 1.0 / requested_core, requested_core * speed, 1)) , requested_core_(requested_core) { - if (model->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::Lazy) + if (model->get_update_algorithm() == kernel::resource::Model::UpdateAlgo::LAZY) set_last_update(); model->get_maxmin_system()->expand(constraint, get_variable(), 1.0); } diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 5e961dba56..57515468ab 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -139,7 +139,7 @@ typedef boost::intrusive::list CpuTiList; *********/ class CpuTiModel : public CpuModel { public: - CpuTiModel() : CpuModel(Model::UpdateAlgo::Full){}; + CpuTiModel() : CpuModel(Model::UpdateAlgo::FULL){}; ~CpuTiModel() override; Cpu* create_cpu(simgrid::s4u::Host* host, std::vector* speed_per_pstate, int core) override; double next_occuring_event(double now) override; diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index a0c0de0650..dccd34a8b5 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -133,8 +133,8 @@ namespace kernel { namespace resource { NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool)) - : NetworkModel(simgrid::config::get_value("network/optim") == "Full" ? Model::UpdateAlgo::Full - : Model::UpdateAlgo::Lazy) + : NetworkModel(simgrid::config::get_value("network/optim") == "Full" ? Model::UpdateAlgo::FULL + : Model::UpdateAlgo::LAZY) { std::string optim = simgrid::config::get_value("network/optim"); bool select = simgrid::config::get_value("network/maxmin-selective-update"); @@ -242,7 +242,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz action->weight_ = latency; action->latency_ = latency; action->rate_ = rate; - if (get_update_algorithm() == Model::UpdateAlgo::Lazy) { + if (get_update_algorithm() == Model::UpdateAlgo::LAZY) { action->set_last_update(); } @@ -267,7 +267,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz if (action->latency_ > 0) { action->set_variable(get_maxmin_system()->variable_new(action, 0.0, -1.0, constraints_per_variable)); - if (get_update_algorithm() == Model::UpdateAlgo::Lazy) { + if (get_update_algorithm() == Model::UpdateAlgo::LAZY) { // add to the heap the event when the latency is payed double date = action->latency_ + action->get_last_update(); diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index d8e37a7454..b3eb6292ad 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -26,7 +26,7 @@ class XBT_PRIVATE NetworkConstantAction; *********/ class NetworkConstantModel : public NetworkModel { public: - NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::Full) {} + NetworkConstantModel() : NetworkModel(Model::UpdateAlgo::FULL) {} Action* communicate(simgrid::s4u::Host* src, simgrid::s4u::Host* dst, double size, double rate) override; double next_occuring_event(double now) override; void update_actions_state(double now, double delta) override; diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index f9d8731294..0312d24790 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -150,7 +150,7 @@ namespace simgrid { namespace kernel { namespace resource { -NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::Full) +NetworkNS3Model::NetworkNS3Model() : NetworkModel(Model::UpdateAlgo::FULL) { xbt_assert(not sg_link_energy_is_inited(), "LinkEnergy plugin and NS3 network models are not compatible. Are you looking for Ecofen, maybe?"); diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 9338334758..8c6ec46fc8 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -43,7 +43,7 @@ HostL07Model::~HostL07Model() } CpuL07Model::CpuL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) - : CpuModel(Model::UpdateAlgo::Full), hostModel_(hmodel) + : CpuModel(Model::UpdateAlgo::FULL), hostModel_(hmodel) { set_maxmin_system(sys); } @@ -54,7 +54,7 @@ CpuL07Model::~CpuL07Model() } NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) - : NetworkModel(Model::UpdateAlgo::Full), hostModel_(hmodel) + : NetworkModel(Model::UpdateAlgo::FULL), hostModel_(hmodel) { set_maxmin_system(sys); loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); -- 2.20.1