From d7137248837c462e9a20c5640f2c74541faa7ef5 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Wed, 6 Jun 2018 09:55:03 +0200 Subject: [PATCH 1/1] snake_case LinkImpl (but the part that should to the engine) --- src/bindings/lua/lua_platf.cpp | 10 +++++----- src/kernel/routing/ClusterZone.cpp | 14 +++++++------- src/kernel/routing/DijkstraZone.cpp | 6 +++--- src/kernel/routing/DragonflyZone.cpp | 22 +++++++++++----------- src/kernel/routing/FatTreeZone.cpp | 16 ++++++++-------- src/kernel/routing/FloydZone.cpp | 2 +- src/kernel/routing/FullZone.cpp | 2 +- src/kernel/routing/NetZoneImpl.cpp | 4 ++-- src/kernel/routing/TorusZone.cpp | 12 ++++++------ src/kernel/routing/VivaldiZone.cpp | 4 ++-- src/s4u/s4u_Link.cpp | 18 +++++++++--------- src/surf/network_cm02.cpp | 14 +++++++------- src/surf/network_cm02.hpp | 4 ++-- src/surf/network_interface.cpp | 16 ++++++++-------- src/surf/network_interface.hpp | 24 ++++++++++++------------ src/surf/network_ns3.cpp | 10 ++++++---- src/surf/network_ns3.hpp | 8 ++++---- src/surf/ptask_L07.cpp | 8 ++++---- src/surf/ptask_L07.hpp | 4 ++-- src/surf/sg_platf.cpp | 18 +++++++++--------- src/surf/xml/surfxml_sax_cb.cpp | 8 ++++---- 21 files changed, 113 insertions(+), 111 deletions(-) diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index 087381adcc..47d46438f0 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -107,7 +107,7 @@ int console_add_backbone(lua_State *L) { link.policy = link_policy_get_by_name(policy); sg_platf_new_link(&link); - routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(link.id)); + routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::by_name(link.id)); return 0; } @@ -331,12 +331,12 @@ int console_add_route(lua_State *L) { boost::split(names, str, boost::is_any_of(", \t\r\n")); if (names.empty()) { /* unique name */ - route.link_list.push_back(simgrid::kernel::resource::LinkImpl::byName(lua_tostring(L, -1))); + route.link_list.push_back(simgrid::kernel::resource::LinkImpl::by_name(lua_tostring(L, -1))); } else { // Several names separated by , \t\r\n for (auto const& name : names) { if (name.length() > 0) { - simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::byName(name); + simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::by_name(name); route.link_list.push_back(link); } } @@ -409,12 +409,12 @@ int console_add_ASroute(lua_State *L) { boost::split(names, str, boost::is_any_of(", \t\r\n")); if (names.empty()) { /* unique name with no comma */ - ASroute.link_list.push_back(simgrid::kernel::resource::LinkImpl::byName(lua_tostring(L, -1))); + ASroute.link_list.push_back(simgrid::kernel::resource::LinkImpl::by_name(lua_tostring(L, -1))); } else { // Several names separated by , \t\r\n for (auto const& name : names) { if (name.length() > 0) { - simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::byName(name); + simgrid::kernel::resource::LinkImpl* link = simgrid::kernel::resource::LinkImpl::by_name(name); ASroute.link_list.push_back(link); } } diff --git a/src/kernel/routing/ClusterZone.cpp b/src/kernel/routing/ClusterZone.cpp index 3bed217682..5abe1c7846 100644 --- a/src/kernel/routing/ClusterZone.cpp +++ b/src/kernel/routing/ClusterZone.cpp @@ -33,7 +33,7 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg std::pair info = private_links_.at(node_pos(src->id())); route->link_list.push_back(info.first); if (lat) - *lat += info.first->latency(); + *lat += info.first->get_latency(); return; } @@ -48,14 +48,14 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (info.first) { // link up route->link_list.push_back(info.first); if (lat) - *lat += info.first->latency(); + *lat += info.first->get_latency(); } } if (backbone_) { route->link_list.push_back(backbone_); if (lat) - *lat += backbone_->latency(); + *lat += backbone_->get_latency(); } if (not dst->is_router()) { // No specific link for router @@ -65,7 +65,7 @@ void ClusterZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (info.second) { // link down route->link_list.push_back(info.second); if (lat) - *lat += info.second->latency(); + *lat += info.second->get_latency(); } if (has_limiter_) { // limiter for receiver info = private_links_.at(node_pos_with_loopback(dst->id())); @@ -134,10 +134,10 @@ void ClusterZone::create_links_for_node(ClusterCreationArgs* cluster, int id, in resource::LinkImpl* linkUp; resource::LinkImpl* linkDown; if (link.policy == simgrid::s4u::Link::SharingPolicy::SPLITDUPLEX) { - linkUp = resource::LinkImpl::byName(link_id + "_UP"); - linkDown = resource::LinkImpl::byName(link_id + "_DOWN"); + linkUp = resource::LinkImpl::by_name(link_id + "_UP"); + linkDown = resource::LinkImpl::by_name(link_id + "_DOWN"); } else { - linkUp = resource::LinkImpl::byName(link_id); + linkUp = resource::LinkImpl::by_name(link_id); linkDown = linkUp; } private_links_.insert({position, {linkUp, linkDown}}); diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 4aa05bb001..14a37d59e0 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -154,7 +154,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr for (auto const& link : e_route->link_list) { route->link_list.insert(route->link_list.begin(), link); if (lat) - *lat += static_cast(link)->latency(); + *lat += static_cast(link)->get_latency(); } } @@ -238,7 +238,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr for (auto const& link : e_route_as_to_as) { route->link_list.insert(pos, link); if (lat) - *lat += link->latency(); + *lat += link->get_latency(); pos++; } } @@ -246,7 +246,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr for (auto const& link : e_route->link_list) { route->link_list.insert(route->link_list.begin(), link); if (lat) - *lat += static_cast(link)->latency(); + *lat += static_cast(link)->get_latency(); } } diff --git a/src/kernel/routing/DragonflyZone.cpp b/src/kernel/routing/DragonflyZone.cpp index 9e23f6951a..502dbc7c2a 100644 --- a/src/kernel/routing/DragonflyZone.cpp +++ b/src/kernel/routing/DragonflyZone.cpp @@ -173,10 +173,10 @@ void DragonflyZone::createLink(const std::string& id, int numlinks, resource::Li XBT_DEBUG("Generating link %s", id.c_str()); resource::LinkImpl* link; if (this->sharing_policy_ == s4u::Link::SharingPolicy::SPLITDUPLEX) { - *linkup = resource::LinkImpl::byName(linkTemplate.id + "_UP"); // check link? - *linkdown = resource::LinkImpl::byName(linkTemplate.id + "_DOWN"); // check link ? + *linkup = resource::LinkImpl::by_name(linkTemplate.id + "_UP"); // check link? + *linkdown = resource::LinkImpl::by_name(linkTemplate.id + "_DOWN"); // check link ? } else { - link = resource::LinkImpl::byName(linkTemplate.id); + link = resource::LinkImpl::by_name(linkTemplate.id); *linkup = link; *linkdown = link; } @@ -280,7 +280,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA route->link_list.push_back(info.first); if (latency) - *latency += info.first->latency(); + *latency += info.first->get_latency(); return; } @@ -301,7 +301,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA // node->router local link route->link_list.push_back(myRouter->my_nodes_[myCoords[3] * num_links_per_link_]); if (latency) - *latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->latency(); + *latency += myRouter->my_nodes_[myCoords[3] * num_links_per_link_]->get_latency(); if (has_limiter_) { // limiter for sender std::pair info = private_links_.at(node_pos_with_loopback(src->id())); @@ -317,7 +317,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA // go to the nth router in our chassis route->link_list.push_back(currentRouter->green_links_[targetCoords[0]]); if (latency) - *latency += currentRouter->green_links_[targetCoords[0]]->latency(); + *latency += currentRouter->green_links_[targetCoords[0]]->get_latency(); currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[1] * num_blades_per_chassis_ + targetCoords[0]]; } @@ -326,14 +326,14 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA // go to the first chassis of our group route->link_list.push_back(currentRouter->black_links_[0]); if (latency) - *latency += currentRouter->black_links_[0]->latency(); + *latency += currentRouter->black_links_[0]->get_latency(); currentRouter = routers_[myCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[0]]; } // go to destination group - the only optical hop route->link_list.push_back(currentRouter->blue_links_[0]); if (latency) - *latency += currentRouter->blue_links_[0]->latency(); + *latency += currentRouter->blue_links_[0]->get_latency(); currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + myCoords[0]]; } @@ -341,7 +341,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA if (targetRouter->blade_ != currentRouter->blade_) { route->link_list.push_back(currentRouter->green_links_[targetCoords[2]]); if (latency) - *latency += currentRouter->green_links_[targetCoords[2]]->latency(); + *latency += currentRouter->green_links_[targetCoords[2]]->get_latency(); currentRouter = routers_[targetCoords[0] * (num_chassis_per_group_ * num_blades_per_chassis_) + targetCoords[2]]; } @@ -349,7 +349,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA if (targetRouter->chassis_ != currentRouter->chassis_) { route->link_list.push_back(currentRouter->black_links_[targetCoords[1]]); if (latency) - *latency += currentRouter->black_links_[targetCoords[1]]->latency(); + *latency += currentRouter->black_links_[targetCoords[1]]->get_latency(); } } @@ -361,7 +361,7 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA // router->node local link route->link_list.push_back(targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]); if (latency) - *latency += targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]->latency(); + *latency += targetRouter->my_nodes_[targetCoords[3] * num_links_per_link_ + num_links_per_link_ - 1]->get_latency(); } } } diff --git a/src/kernel/routing/FatTreeZone.cpp b/src/kernel/routing/FatTreeZone.cpp index e777ccf153..6101508561 100644 --- a/src/kernel/routing/FatTreeZone.cpp +++ b/src/kernel/routing/FatTreeZone.cpp @@ -82,7 +82,7 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (source->id == destination->id && this->has_loopback_) { into->link_list.push_back(source->loopback); if (latency) - *latency += source->loopback->latency(); + *latency += source->loopback->get_latency(); return; } @@ -100,7 +100,7 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg into->link_list.push_back(currentNode->parents[d]->up_link_); if (latency) - *latency += currentNode->parents[d]->up_link_->latency(); + *latency += currentNode->parents[d]->up_link_->get_latency(); if (this->has_limiter_) into->link_list.push_back(currentNode->limiter_link_); @@ -116,7 +116,7 @@ void FatTreeZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (i % this->num_children_per_node_[currentNode->level - 1] == destination->label[currentNode->level - 1]) { into->link_list.push_back(currentNode->children[i]->down_link_); if (latency) - *latency += currentNode->children[i]->down_link_->latency(); + *latency += currentNode->children[i]->down_link_->get_latency(); currentNode = currentNode->children[i]->down_node_; if (this->has_limiter_) into->link_list.push_back(currentNode->limiter_link_); @@ -450,7 +450,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po linkTemplate.policy = s4u::Link::SharingPolicy::SHARED; linkTemplate.id = "limiter_"+std::to_string(id); sg_platf_new_link(&linkTemplate); - this->limiter_link_ = resource::LinkImpl::byName(linkTemplate.id); + this->limiter_link_ = resource::LinkImpl::by_name(linkTemplate.id); } if (cluster->loopback_bw || cluster->loopback_lat) { linkTemplate.bandwidth = cluster->loopback_bw; @@ -458,7 +458,7 @@ FatTreeNode::FatTreeNode(ClusterCreationArgs* cluster, int id, int level, int po linkTemplate.policy = s4u::Link::SharingPolicy::FATPIPE; linkTemplate.id = "loopback_"+ std::to_string(id); sg_platf_new_link(&linkTemplate); - this->loopback = resource::LinkImpl::byName(linkTemplate.id); + this->loopback = resource::LinkImpl::by_name(linkTemplate.id); } } @@ -476,11 +476,11 @@ FatTreeLink::FatTreeLink(ClusterCreationArgs* cluster, FatTreeNode* downNode, Fa if (cluster->sharing_policy == s4u::Link::SharingPolicy::SPLITDUPLEX) { std::string tmpID = std::string(linkTemplate.id) + "_UP"; - this->up_link_ = resource::LinkImpl::byName(tmpID); // check link? + this->up_link_ = resource::LinkImpl::by_name(tmpID); // check link? tmpID = std::string(linkTemplate.id) + "_DOWN"; - this->down_link_ = resource::LinkImpl::byName(tmpID); // check link ? + this->down_link_ = resource::LinkImpl::by_name(tmpID); // check link ? } else { - this->up_link_ = resource::LinkImpl::byName(linkTemplate.id); + this->up_link_ = resource::LinkImpl::by_name(linkTemplate.id); this->down_link_ = this->up_link_; } uniqueId++; diff --git a/src/kernel/routing/FloydZone.cpp b/src/kernel/routing/FloydZone.cpp index 40e85f3f68..8b4b9b55a4 100644 --- a/src/kernel/routing/FloydZone.cpp +++ b/src/kernel/routing/FloydZone.cpp @@ -78,7 +78,7 @@ void FloydZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* for (auto const& link : e_route->link_list) { route->link_list.push_back(link); if (lat) - *lat += link->latency(); + *lat += link->get_latency(); } prev_dst_gw = e_route->gw_dst; diff --git a/src/kernel/routing/FullZone.cpp b/src/kernel/routing/FullZone.cpp index b0c87c0e86..4549c63f38 100644 --- a/src/kernel/routing/FullZone.cpp +++ b/src/kernel/routing/FullZone.cpp @@ -66,7 +66,7 @@ void FullZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* for (auto const& link : e_route->link_list) { res->link_list.push_back(link); if (lat) - *lat += link->latency(); + *lat += link->get_latency(); } } } diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 5528e9f02d..e19d3ce705 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -217,7 +217,7 @@ bool NetZoneImpl::get_bypass_route(routing::NetPoint* src, routing::NetPoint* ds for (resource::LinkImpl* const& link : bypassedRoute->links) { links.push_back(link); if (latency) - *latency += link->latency(); + *latency += link->get_latency(); } XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->get_cname(), dst->get_cname(), bypassedRoute->links.size()); @@ -301,7 +301,7 @@ bool NetZoneImpl::get_bypass_route(routing::NetPoint* src, routing::NetPoint* ds for (resource::LinkImpl* const& link : bypassedRoute->links) { links.push_back(link); if (latency) - *latency += link->latency(); + *latency += link->get_latency(); } if (dst != key.second) get_global_route(bypassedRoute->gw_dst, dst, links, latency); diff --git a/src/kernel/routing/TorusZone.cpp b/src/kernel/routing/TorusZone.cpp index 72d0298bd9..4026a9cd7f 100644 --- a/src/kernel/routing/TorusZone.cpp +++ b/src/kernel/routing/TorusZone.cpp @@ -58,11 +58,11 @@ void TorusZone::create_links_for_node(ClusterCreationArgs* cluster, int id, int resource::LinkImpl* linkDown; if (link.policy == s4u::Link::SharingPolicy::SPLITDUPLEX) { std::string tmp_link = link_id + "_UP"; - linkUp = resource::LinkImpl::byName(tmp_link); + linkUp = resource::LinkImpl::by_name(tmp_link); tmp_link = link_id + "_DOWN"; - linkDown = resource::LinkImpl::byName(tmp_link); + linkDown = resource::LinkImpl::by_name(tmp_link); } else { - linkUp = resource::LinkImpl::byName(link_id); + linkUp = resource::LinkImpl::by_name(link_id); linkDown = linkUp; } /* @@ -106,7 +106,7 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* route->link_list.push_back(info.first); if (lat) - *lat += info.first->latency(); + *lat += info.first->get_latency(); return; } @@ -189,11 +189,11 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* if (use_lnk_up == false) { route->link_list.push_back(info.second); if (lat) - *lat += info.second->latency(); + *lat += info.second->get_latency(); } else { route->link_list.push_back(info.first); if (lat) - *lat += info.first->latency(); + *lat += info.first->get_latency(); } current_node = next_node; next_node = 0; diff --git a/src/kernel/routing/VivaldiZone.cpp b/src/kernel/routing/VivaldiZone.cpp index 8b32044991..4c700725da 100644 --- a/src/kernel/routing/VivaldiZone.cpp +++ b/src/kernel/routing/VivaldiZone.cpp @@ -95,7 +95,7 @@ void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (info.first) { route->link_list.push_back(info.first); if (lat) - *lat += info.first->latency(); + *lat += info.first->get_latency(); } } else { XBT_DEBUG("Source of private link (%u) doesn't exist", src->id()); @@ -107,7 +107,7 @@ void VivaldiZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArg if (info.second) { route->link_list.push_back(info.second); if (lat) - *lat += info.second->latency(); + *lat += info.second->get_latency(); } } else { XBT_DEBUG("Destination of private link (%u) doesn't exist", dst->id()); diff --git a/src/s4u/s4u_Link.cpp b/src/s4u/s4u_Link.cpp index 8d37930930..5dcfe129ad 100644 --- a/src/s4u/s4u_Link.cpp +++ b/src/s4u/s4u_Link.cpp @@ -26,7 +26,7 @@ simgrid::xbt::signal Link::on_communicat Link* Link::by_name(const char* name) { - kernel::resource::LinkImpl* res = kernel::resource::LinkImpl::byName(name); + kernel::resource::LinkImpl* res = kernel::resource::LinkImpl::by_name(name); if (res == nullptr) return nullptr; return &res->piface_; @@ -50,17 +50,17 @@ bool Link::is_used() double Link::get_latency() { - return this->pimpl_->latency(); + return this->pimpl_->get_latency(); } double Link::get_bandwidth() { - return this->pimpl_->bandwidth(); + return this->pimpl_->get_bandwidth(); } Link::SharingPolicy Link::get_sharing_policy() { - return this->pimpl_->sharingPolicy(); + return this->pimpl_->get_sharing_policy(); } double Link::get_usage() @@ -79,24 +79,24 @@ void Link::turn_off() void* Link::get_data() { - return this->pimpl_->getData(); + return this->pimpl_->get_data(); } void Link::set_data(void* d) { - simgrid::simix::simcall([this, d]() { this->pimpl_->setData(d); }); + simgrid::simix::simcall([this, d]() { this->pimpl_->set_data(d); }); } void Link::set_state_trace(tmgr_trace_t trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->setStateTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->set_state_trace(trace); }); } void Link::set_bandwidth_trace(tmgr_trace_t trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->setBandwidthTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->set_bandwidth_trace(trace); }); } void Link::set_latency_trace(tmgr_trace_t trace) { - simgrid::simix::simcall([this, trace]() { this->pimpl_->setLatencyTrace(trace); }); + simgrid::simix::simcall([this, trace]() { this->pimpl_->set_latency_trace(trace); }); } const char* Link::get_property(const char* key) diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index dccd34a8b5..cc2847e848 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -249,14 +249,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz if (sg_weight_S_parameter > 0) { action->weight_ = std::accumulate(route.begin(), route.end(), action->weight_, [](double total, LinkImpl* const& link) { - return total + sg_weight_S_parameter / link->bandwidth(); + return total + sg_weight_S_parameter / link->get_bandwidth(); }); } - double bandwidth_bound = route.empty() ? -1.0 : bandwidthFactor(size) * route.front()->bandwidth(); + double bandwidth_bound = route.empty() ? -1.0 : bandwidthFactor(size) * route.front()->get_bandwidth(); for (auto const& link : route) - bandwidth_bound = std::min(bandwidth_bound, bandwidthFactor(size) * link->bandwidth()); + bandwidth_bound = std::min(bandwidth_bound, bandwidthFactor(size) * link->get_bandwidth()); action->lat_current_ = action->latency_; action->latency_ *= latencyFactor(size); @@ -330,11 +330,11 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value) { /* Find out which of my iterators was triggered, and react accordingly */ if (triggered == bandwidth_.event) { - setBandwidth(value); + set_bandwidth(value); tmgr_trace_event_unref(&bandwidth_.event); } else if (triggered == latency_.event) { - setLatency(value); + set_latency(value); tmgr_trace_event_unref(&latency_.event); } else if (triggered == stateEvent_) { @@ -364,7 +364,7 @@ void NetworkCm02Link::apply_event(tmgr_trace_event_t triggered, double value) get_constraint()); } -void NetworkCm02Link::setBandwidth(double value) +void NetworkCm02Link::set_bandwidth(double value) { bandwidth_.peak = value; @@ -389,7 +389,7 @@ void NetworkCm02Link::setBandwidth(double value) } } -void NetworkCm02Link::setLatency(double value) +void NetworkCm02Link::set_latency(double value) { double delta = value - latency_.peak; kernel::lmm::Variable* var = nullptr; diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index f20a8cafd8..dbfdb8dad0 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -49,8 +49,8 @@ public: s4u::Link::SharingPolicy policy, lmm::System* system); virtual ~NetworkCm02Link() = default; void apply_event(tmgr_trace_event_t event, double value) override; - void setBandwidth(double value) override; - void setLatency(double value) override; + void set_bandwidth(double value) override; + void set_latency(double value) override; }; /********** diff --git a/src/surf/network_interface.cpp b/src/surf/network_interface.cpp index d462377dc3..40939e4467 100644 --- a/src/surf/network_interface.cpp +++ b/src/surf/network_interface.cpp @@ -20,7 +20,7 @@ namespace resource { /* List of links */ std::unordered_map* LinkImpl::links = new std::unordered_map(); -LinkImpl* LinkImpl::byName(std::string name) +LinkImpl* LinkImpl::by_name(std::string name) { auto link = links->find(name); return link == links->end() ? nullptr : link->second; @@ -122,7 +122,7 @@ LinkImpl::LinkImpl(NetworkModel* model, const std::string& name, lmm::Constraint { if (name != "__loopback__") - xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name.c_str()); + xbt_assert(not LinkImpl::by_name(name), "Link '%s' declared several times in the platform.", name.c_str()); latency_.scale = 1; bandwidth_.scale = 1; @@ -154,17 +154,17 @@ bool LinkImpl::is_used() return get_model()->get_maxmin_system()->constraint_used(get_constraint()); } -double LinkImpl::latency() +double LinkImpl::get_latency() { return latency_.peak * latency_.scale; } -double LinkImpl::bandwidth() +double LinkImpl::get_bandwidth() { return bandwidth_.peak * bandwidth_.scale; } -s4u::Link::SharingPolicy LinkImpl::sharingPolicy() +s4u::Link::SharingPolicy LinkImpl::get_sharing_policy() { return get_constraint()->get_sharing_policy(); } @@ -190,17 +190,17 @@ void LinkImpl::on_bandwidth_change() s4u::Link::on_bandwidth_change(this->piface_); } -void LinkImpl::setStateTrace(tmgr_trace_t trace) +void LinkImpl::set_state_trace(tmgr_trace_t trace) { xbt_assert(stateEvent_ == nullptr, "Cannot set a second state trace to Link %s", get_cname()); stateEvent_ = future_evt_set->add_trace(trace, this); } -void LinkImpl::setBandwidthTrace(tmgr_trace_t trace) +void LinkImpl::set_bandwidth_trace(tmgr_trace_t trace) { xbt_assert(bandwidth_.event == nullptr, "Cannot set a second bandwidth trace to Link %s", get_cname()); bandwidth_.event = future_evt_set->add_trace(trace, this); } -void LinkImpl::setLatencyTrace(tmgr_trace_t trace) +void LinkImpl::set_latency_trace(tmgr_trace_t trace) { xbt_assert(latency_.event == nullptr, "Cannot set a second latency trace to Link %s", get_cname()); latency_.event = future_evt_set->add_trace(trace, this); diff --git a/src/surf/network_interface.hpp b/src/surf/network_interface.hpp index 7842043c06..02a6dffd22 100644 --- a/src/surf/network_interface.hpp +++ b/src/surf/network_interface.hpp @@ -125,19 +125,19 @@ public: s4u::Link piface_; /** @brief Get the bandwidth in bytes per second of current Link */ - virtual double bandwidth(); + virtual double get_bandwidth(); /** @brief Update the bandwidth in bytes per second of current Link */ - virtual void setBandwidth(double value) = 0; + virtual void set_bandwidth(double value) = 0; /** @brief Get the latency in seconds of current Link */ - virtual double latency(); + virtual double get_latency(); /** @brief Update the latency in seconds of current Link */ - virtual void setLatency(double value) = 0; + virtual void set_latency(double value) = 0; /** @brief The sharing policy */ - virtual s4u::Link::SharingPolicy sharingPolicy(); + virtual s4u::Link::SharingPolicy get_sharing_policy(); /** @brief Check if the Link is used */ bool is_used() override; @@ -147,12 +147,12 @@ public: void on_bandwidth_change(); - virtual void setStateTrace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). + virtual void set_state_trace(tmgr_trace_t trace); /*< setup the trace file with states events (ON or OFF). Trace must contain boolean values. */ - virtual void setBandwidthTrace( + virtual void set_bandwidth_trace( tmgr_trace_t trace); /*< setup the trace file with bandwidth events (peak speed changes due to external load). Trace must contain percentages (value between 0 and 1). */ - virtual void setLatencyTrace( + virtual void set_latency_trace( tmgr_trace_t trace); /*< setup the trace file with latency events (peak latency changes due to external load). Trace must contain absolute values */ @@ -161,16 +161,16 @@ public: Metric bandwidth_ = {1.0, 0, nullptr}; /* User data */ - void* getData() { return userData; } - void setData(void* d) { userData = d; } + void* get_data() { return userdata_; } + void set_data(void* d) { userdata_ = d; } private: - void* userData = nullptr; + void* userdata_ = nullptr; /* List of all links. FIXME: should move to the Engine */ static std::unordered_map* links; public: - static LinkImpl* byName(std::string name); + static LinkImpl* by_name(std::string name); static int linksCount(); static LinkImpl** linksList(); static void linksList(std::vector* linkList); diff --git a/src/surf/network_ns3.cpp b/src/surf/network_ns3.cpp index 99d34a8685..15a1618caa 100644 --- a/src/surf/network_ns3.cpp +++ b/src/surf/network_ns3.cpp @@ -98,7 +98,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin (symmetrical ? "(symmetrical)" : "(not symmetrical)")); // XBT_DEBUG("src (%s), dst (%s), src_id = %d, dst_id = %d",src,dst, src_id, dst_id); - XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->get_cname(), link->bandwidth(), link->latency()); + XBT_DEBUG("\tLink (%s) bw:%fbps lat:%fs", link->get_cname(), link->get_bandwidth(), link->get_latency()); // create link ns3 NetPointNs3* host_src = src->extension(); @@ -107,7 +107,7 @@ static void routeCreation_cb(bool symmetrical, simgrid::kernel::routing::NetPoin xbt_assert(host_src != nullptr, "Network element %s does not seem to be NS3-ready", src->get_cname()); xbt_assert(host_dst != nullptr, "Network element %s does not seem to be NS3-ready", dst->get_cname()); - ns3_add_link(host_src, host_dst, link->bandwidth(), link->latency()); + ns3_add_link(host_src, host_dst, link->get_bandwidth(), link->get_latency()); } else { static bool warned_about_long_routes = false; @@ -281,10 +281,12 @@ void LinkNS3::apply_event(tmgr_trace_event_t event, double value) { THROW_UNIMPLEMENTED; } -void LinkNS3::setBandwidthTrace(tmgr_trace_t trace) { +void LinkNS3::set_bandwidth_trace(tmgr_trace_t trace) +{ xbt_die("The NS3 network model doesn't support bandwidth traces"); } -void LinkNS3::setLatencyTrace(tmgr_trace_t trace) { +void LinkNS3::set_latency_trace(tmgr_trace_t trace) +{ xbt_die("The NS3 network model doesn't support latency traces"); } diff --git a/src/surf/network_ns3.hpp b/src/surf/network_ns3.hpp index 97eba7a8d9..4fa6096a3f 100644 --- a/src/surf/network_ns3.hpp +++ b/src/surf/network_ns3.hpp @@ -35,10 +35,10 @@ public: ~LinkNS3(); void apply_event(tmgr_trace_event_t event, double value) override; - void setBandwidth(double value) override { THROW_UNIMPLEMENTED; } - void setLatency(double value) override { THROW_UNIMPLEMENTED; } - void setBandwidthTrace(tmgr_trace_t trace) override; - void setLatencyTrace(tmgr_trace_t trace) override; + void set_bandwidth(double value) override { THROW_UNIMPLEMENTED; } + void set_latency(double value) override { THROW_UNIMPLEMENTED; } + void set_bandwidth_trace(tmgr_trace_t trace) override; + void set_latency_trace(tmgr_trace_t trace) override; }; /********** diff --git a/src/surf/ptask_L07.cpp b/src/surf/ptask_L07.cpp index 8c6ec46fc8..06c403ea2d 100644 --- a/src/surf/ptask_L07.cpp +++ b/src/surf/ptask_L07.cpp @@ -330,11 +330,11 @@ void LinkL07::apply_event(tmgr_trace_event_t triggered, double value) { XBT_DEBUG("Updating link %s (%p) with value=%f", get_cname(), this, value); if (triggered == bandwidth_.event) { - setBandwidth(value); + set_bandwidth(value); tmgr_trace_event_unref(&bandwidth_.event); } else if (triggered == latency_.event) { - setLatency(value); + set_latency(value); tmgr_trace_event_unref(&latency_.event); } else if (triggered == stateEvent_) { @@ -349,7 +349,7 @@ void LinkL07::apply_event(tmgr_trace_event_t triggered, double value) } } -void LinkL07::setBandwidth(double value) +void LinkL07::set_bandwidth(double value) { bandwidth_.peak = value; LinkImpl::on_bandwidth_change(); @@ -357,7 +357,7 @@ void LinkL07::setBandwidth(double value) get_model()->get_maxmin_system()->update_constraint_bound(get_constraint(), bandwidth_.peak * bandwidth_.scale); } -void LinkL07::setLatency(double value) +void LinkL07::set_latency(double value) { kernel::lmm::Variable* var = nullptr; L07Action *action; diff --git a/src/surf/ptask_L07.hpp b/src/surf/ptask_L07.hpp index 01f1c809ec..149b22e1a3 100644 --- a/src/surf/ptask_L07.hpp +++ b/src/surf/ptask_L07.hpp @@ -94,8 +94,8 @@ public: ~LinkL07() override; bool is_used() override; void apply_event(tmgr_trace_event_t event, double value) override; - void setBandwidth(double value) override; - void setLatency(double value) override; + void set_bandwidth(double value) override; + void set_latency(double value) override; }; /********** diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 2817796bc1..eb138ef48f 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -130,11 +130,11 @@ void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link) } if (link->latency_trace) - l->setLatencyTrace(link->latency_trace); + l->set_latency_trace(link->latency_trace); if (link->bandwidth_trace) - l->setBandwidthTrace(link->bandwidth_trace); + l->set_bandwidth_trace(link->bandwidth_trace); if (link->state_trace) - l->setStateTrace(link->state_trace); + l->set_state_trace(link->state_trace); } delete link->properties; } @@ -222,8 +222,8 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster link.latency = cluster->loopback_lat; link.policy = simgrid::s4u::Link::SharingPolicy::FATPIPE; sg_platf_new_link(&link); - linkUp = simgrid::kernel::resource::LinkImpl::byName(tmp_link); - linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link); + linkUp = simgrid::kernel::resource::LinkImpl::by_name(tmp_link); + linkDown = simgrid::kernel::resource::LinkImpl::by_name(tmp_link); auto* as_cluster = static_cast(current_as); as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp, linkDown}}); @@ -242,7 +242,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster link.latency = 0; link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; sg_platf_new_link(&link); - linkDown = simgrid::kernel::resource::LinkImpl::byName(tmp_link); + linkDown = simgrid::kernel::resource::LinkImpl::by_name(tmp_link); linkUp = linkDown; current_as->private_links_.insert({current_as->node_pos_with_loopback(rankId), {linkUp, linkDown}}); } @@ -279,7 +279,7 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster XBT_DEBUG("", link.id.c_str(), cluster->bb_bw, cluster->bb_lat); sg_platf_new_link(&link); - routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(link.id)); + routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::by_name(link.id)); } XBT_DEBUG(""); @@ -637,8 +637,8 @@ void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostl xbt_assert(dynamic_cast(current_routing), "Only hosts from Cluster and Vivaldi ASes can get an host_link."); - simgrid::kernel::resource::LinkImpl* linkUp = simgrid::kernel::resource::LinkImpl::byName(hostlink->link_up); - simgrid::kernel::resource::LinkImpl* linkDown = simgrid::kernel::resource::LinkImpl::byName(hostlink->link_down); + simgrid::kernel::resource::LinkImpl* linkUp = simgrid::kernel::resource::LinkImpl::by_name(hostlink->link_up); + simgrid::kernel::resource::LinkImpl* linkDown = simgrid::kernel::resource::LinkImpl::by_name(hostlink->link_down); xbt_assert(linkUp, "Link '%s' not found!", hostlink->link_up.c_str()); xbt_assert(linkDown, "Link '%s' not found!", hostlink->link_down.c_str()); diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 7719224400..c56fb7a1e5 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -609,13 +609,13 @@ void STag_surfxml_link___ctn() switch (A_surfxml_link___ctn_direction) { case AU_surfxml_link___ctn_direction: case A_surfxml_link___ctn_direction_NONE: - link = simgrid::kernel::resource::LinkImpl::byName(A_surfxml_link___ctn_id); + link = simgrid::kernel::resource::LinkImpl::by_name(A_surfxml_link___ctn_id); break; case A_surfxml_link___ctn_direction_UP: - link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_UP"); + link = simgrid::kernel::resource::LinkImpl::by_name(std::string(A_surfxml_link___ctn_id) + "_UP"); break; case A_surfxml_link___ctn_direction_DOWN: - link = simgrid::kernel::resource::LinkImpl::byName(std::string(A_surfxml_link___ctn_id) + "_DOWN"); + link = simgrid::kernel::resource::LinkImpl::by_name(std::string(A_surfxml_link___ctn_id) + "_DOWN"); break; default: surf_parse_error(std::string("Invalid direction for link ") + A_surfxml_link___ctn_id); @@ -647,7 +647,7 @@ void ETag_surfxml_backbone(){ link.policy = simgrid::s4u::Link::SharingPolicy::SHARED; sg_platf_new_link(&link); - routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::byName(A_surfxml_backbone_id)); + routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl::by_name(A_surfxml_backbone_id)); } void STag_surfxml_route(){ -- 2.20.1