From: Martin Quinson Date: Sat, 7 Jul 2018 19:32:50 +0000 (+0200) Subject: snake_case kernel::resource::NetworkModel X-Git-Tag: v3_21~544 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/171293b2177631594dafc0a8449ee370aebdd305 snake_case kernel::resource::NetworkModel --- diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index cac8eb5212..887cd21837 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -70,8 +70,8 @@ void VivaldiZone::set_peer_link(NetPoint* netpoint, double bw_in, double bw_out, std::string link_up = "link_" + netpoint->get_name() + "_UP"; std::string link_down = "link_" + netpoint->get_name() + "_DOWN"; - resource::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, s4u::Link::SharingPolicy::SHARED); - resource::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkUp = surf_network_model->create_link(link_up, bw_out, 0, s4u::Link::SharingPolicy::SHARED); + resource::LinkImpl* linkDown = surf_network_model->create_link(link_down, bw_in, 0, s4u::Link::SharingPolicy::SHARED); private_links_.insert({netpoint->id(), {linkUp, linkDown}}); } diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index e334a3e5a6..72d1a9af5d 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -146,11 +146,11 @@ NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(b } set_maxmin_system(make_new_lmm_system(select)); - loopback_ = NetworkCm02Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); + loopback_ = NetworkCm02Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); } -LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) +LinkImpl* NetworkCm02Model::create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) { return new NetworkCm02Link(this, name, bandwidth, latency, policy, get_maxmin_system()); } @@ -253,14 +253,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz }); } - double bandwidth_bound = route.empty() ? -1.0 : bandwidthFactor(size) * route.front()->get_bandwidth(); + double bandwidth_bound = route.empty() ? -1.0 : get_bandwidth_factor(size) * route.front()->get_bandwidth(); for (auto const& link : route) - bandwidth_bound = std::min(bandwidth_bound, bandwidthFactor(size) * link->get_bandwidth()); + bandwidth_bound = std::min(bandwidth_bound, get_bandwidth_factor(size) * link->get_bandwidth()); action->lat_current_ = action->latency_; - action->latency_ *= latencyFactor(size); - action->rate_ = bandwidthConstraint(action->rate_, bandwidth_bound, size); + action->latency_ *= get_latency_factor(size); + action->rate_ = get_bandwidth_constraint(action->rate_, bandwidth_bound, size); int constraints_per_variable = route.size(); constraints_per_variable += back_route.size(); diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index dbfdb8dad0..c2c3b3077c 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -32,8 +32,8 @@ class NetworkCm02Model : public NetworkModel { public: explicit NetworkCm02Model(lmm::System* (*make_new_sys)(bool) = &lmm::make_new_maxmin_system); virtual ~NetworkCm02Model() = default; - LinkImpl* createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) override; void update_actions_state_lazy(double now, double delta) override; void update_actions_state_full(double now, double delta) override; Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; diff --git a/src/surf/network_constant.cpp b/src/surf/network_constant.cpp index c1f0970c0c..6e0214f9f0 100644 --- a/src/surf/network_constant.cpp +++ b/src/surf/network_constant.cpp @@ -22,8 +22,8 @@ void surf_network_model_init_Constant() namespace simgrid { namespace kernel { namespace resource { -LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat, - s4u::Link::SharingPolicy policy) +LinkImpl* NetworkConstantModel::create_link(const std::string& name, double bw, double lat, + s4u::Link::SharingPolicy policy) { xbt_die("Refusing to create the link %s: there is no link in the Constant network model. " diff --git a/src/surf/network_constant.hpp b/src/surf/network_constant.hpp index b3eb6292ad..34fd6b1c3e 100644 --- a/src/surf/network_constant.hpp +++ b/src/surf/network_constant.hpp @@ -31,7 +31,7 @@ public: 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, s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, double bw, double lat, s4u::Link::SharingPolicy policy) override; }; /********** diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index 4960b2ac4c..337170fe73 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -38,17 +38,17 @@ simgrid::config::Flag NetworkModel::cfg_crosstraffic( NetworkModel::~NetworkModel() = default; -double NetworkModel::latencyFactor(double /*size*/) +double NetworkModel::get_latency_factor(double /*size*/) { return sg_latency_factor; } -double NetworkModel::bandwidthFactor(double /*size*/) +double NetworkModel::get_bandwidth_factor(double /*size*/) { return sg_bandwidth_factor; } -double NetworkModel::bandwidthConstraint(double rate, double /*bound*/, double /*size*/) +double NetworkModel::get_bandwidth_constraint(double rate, double /*bound*/, double /*size*/) { return rate; } @@ -89,7 +89,7 @@ LinkImpl::LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint /** @brief use destroy() instead of this destructor */ LinkImpl::~LinkImpl() { - xbt_assert(currentlyDestroying_, "Don't delete Links directly. Call destroy() instead."); + xbt_assert(currently_destroying_, "Don't delete Links directly. Call destroy() instead."); } /** @brief Fire the required callbacks and destroy the object * @@ -97,8 +97,8 @@ LinkImpl::~LinkImpl() */ void LinkImpl::destroy() { - if (not currentlyDestroying_) { - currentlyDestroying_ = true; + if (not currently_destroying_) { + currently_destroying_ = true; s4u::Link::on_destruction(this->piface_); delete this; } diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index f8b0e65a0d..8267e775b0 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -47,8 +47,8 @@ public: * @param latency The initial latency of the Link in seconds * @param policy The sharing policy of the Link */ - virtual LinkImpl* createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) = 0; + virtual LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) = 0; /** * @brief Create a communication between two hosts. @@ -74,7 +74,7 @@ public: * @param size The size of the message. * @return The latency factor. */ - virtual double latencyFactor(double size); + virtual double get_latency_factor(double size); /** * @brief Get the right multiplicative factor for the bandwidth. @@ -86,7 +86,7 @@ public: * @param size The size of the message. * @return The bandwidth factor. */ - virtual double bandwidthFactor(double size); + virtual double get_bandwidth_factor(double size); /** * @brief Get definitive bandwidth. @@ -97,7 +97,7 @@ public: * @param size The size of the message. * @return The new bandwidth. */ - virtual double bandwidthConstraint(double rate, double bound, double size); + virtual double get_bandwidth_constraint(double rate, double bound, double size); double next_occuring_event_full(double now) override; LinkImpl* loopback_ = nullptr; @@ -118,7 +118,7 @@ protected: public: void destroy(); // Must be called instead of the destructor private: - bool currentlyDestroying_ = false; + bool currently_destroying_ = false; public: /** @brief Public interface */ diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index a35400cc9f..bc8a59a3ce 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -173,8 +173,8 @@ NetworkNS3Model::~NetworkNS3Model() { IPV4addr.clear(); } -LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) +LinkImpl* NetworkNS3Model::create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) { return new LinkNS3(this, name, bandwidth, latency); } diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 4fa6096a3f..fed25486f1 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -18,8 +18,8 @@ class NetworkNS3Model : public NetworkModel { public: NetworkNS3Model(); ~NetworkNS3Model(); - LinkImpl* createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) override; + LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) override; kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; double next_occuring_event(double now) override; bool next_occuring_event_is_idempotent() override { return false; } diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 4988883191..dedb8cdbe6 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -49,7 +49,7 @@ NetworkSmpiModel::NetworkSmpiModel() : NetworkCm02Model() NetworkSmpiModel::~NetworkSmpiModel() = default; -double NetworkSmpiModel::bandwidthFactor(double size) +double NetworkSmpiModel::get_bandwidth_factor(double size) { if (smpi_bw_factor.empty()) smpi_bw_factor = parse_factor(simgrid::config::get_value("smpi/bw-factor")); @@ -67,7 +67,7 @@ double NetworkSmpiModel::bandwidthFactor(double size) return current; } -double NetworkSmpiModel::latencyFactor(double size) +double NetworkSmpiModel::get_latency_factor(double size) { if (smpi_lat_factor.empty()) smpi_lat_factor = parse_factor(simgrid::config::get_value("smpi/lat-factor")); @@ -85,9 +85,9 @@ double NetworkSmpiModel::latencyFactor(double size) return current; } -double NetworkSmpiModel::bandwidthConstraint(double rate, double bound, double size) +double NetworkSmpiModel::get_bandwidth_constraint(double rate, double bound, double size) { - return rate < 0 ? bound : std::min(bound, rate * bandwidthFactor(size)); + return rate < 0 ? bound : std::min(bound, rate * get_bandwidth_factor(size)); } /************ diff --git a/src/surf/network_smpi.hpp b/src/surf/network_smpi.hpp index a012635e5a..cecc750d38 100644 --- a/src/surf/network_smpi.hpp +++ b/src/surf/network_smpi.hpp @@ -17,9 +17,9 @@ public: NetworkSmpiModel(); ~NetworkSmpiModel(); - double latencyFactor(double size); - double bandwidthFactor(double size); - double bandwidthConstraint(double rate, double bound, double size); + double get_latency_factor(double size); + double get_bandwidth_factor(double size); + double get_bandwidth_constraint(double rate, double bound, double size); }; } // namespace resource } // namespace kernel diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index bea3d7c1f0..36a7e0f16d 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -57,7 +57,7 @@ NetworkL07Model::NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys) : NetworkModel(Model::UpdateAlgo::FULL), hostModel_(hmodel) { set_maxmin_system(sys); - loopback_ = NetworkL07Model::createLink("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); + loopback_ = NetworkL07Model::create_link("__loopback__", 498000000, 0.000015, s4u::Link::SharingPolicy::FATPIPE); } NetworkL07Model::~NetworkL07Model() @@ -228,8 +228,8 @@ Cpu* CpuL07Model::create_cpu(simgrid::s4u::Host* host, std::vector* spee return new CpuL07(this, host, speed_per_pstate, core); } -kernel::resource::LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) +kernel::resource::LinkImpl* NetworkL07Model::create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) { return new LinkL07(this, name, bandwidth, latency, policy); } diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 09e4043e01..98d6940dca 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -57,8 +57,8 @@ class NetworkL07Model : public kernel::resource::NetworkModel { public: NetworkL07Model(HostL07Model* hmodel, kernel::lmm::System* sys); ~NetworkL07Model(); - kernel::resource::LinkImpl* createLink(const std::string& name, double bandwidth, double latency, - s4u::Link::SharingPolicy policy) override; + kernel::resource::LinkImpl* create_link(const std::string& name, double bandwidth, double latency, + s4u::Link::SharingPolicy policy) override; kernel::resource::Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override; diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 5f87f2eb91..accf45b3ec 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -123,7 +123,7 @@ void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link) } for (auto const& link_name : names) { simgrid::kernel::resource::LinkImpl* l = - surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy); + surf_network_model->create_link(link_name, link->bandwidth, link->latency, link->policy); if (link->properties) { for (auto const& elm : *link->properties)