X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/666a812d1b3ee4568f2beb317dfcd08d99055697..41f97f763bc1771fe15e96ffcd4ff3e7c76a9a63:/src/surf/sg_platf.cpp
diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp
index 9814e4aa02..2f0997cf29 100644
--- a/src/surf/sg_platf.cpp
+++ b/src/surf/sg_platf.cpp
@@ -16,7 +16,6 @@
#include "simgrid/kernel/routing/VivaldiZone.hpp"
#include "simgrid/s4u/Engine.hpp"
#include "src/include/simgrid/sg_config.hpp"
-#include "src/instr/instr_private.hpp"
#include "src/kernel/EngineImpl.hpp"
#include "src/simix/smx_host_private.hpp"
#include "src/simix/smx_private.hpp"
@@ -50,7 +49,6 @@ static simgrid::kernel::routing::NetZoneImpl* routing_get_current()
/** Module management function: creates all internal data structures */
void sg_platf_init()
{
- simgrid::s4u::on_platform_creation.connect(TRACE_start);
simgrid::s4u::on_platform_created.connect(check_disk_attachment);
}
@@ -82,11 +80,11 @@ void sg_platf_new_host(simgrid::kernel::routing::HostCreationArgs* args)
/* Change from the defaults */
if (args->state_trace)
- host->pimpl_cpu->setStateTrace(args->state_trace);
+ host->pimpl_cpu->set_state_trace(args->state_trace);
if (args->speed_trace)
host->pimpl_cpu->set_speed_trace(args->speed_trace);
if (args->pstate != 0)
- host->pimpl_cpu->setPState(args->pstate);
+ host->pimpl_cpu->set_pstate(args->pstate);
if (args->coord && strcmp(args->coord, ""))
new simgrid::kernel::routing::vivaldi::Coords(host->pimpl_netpoint, args->coord);
}
@@ -98,7 +96,7 @@ simgrid::kernel::routing::NetPoint* sg_platf_new_router(std::string name, const
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::base;
- xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->getNetpointByNameOrNull(name),
+ xbt_assert(nullptr == simgrid::s4u::Engine::get_instance()->netpoint_by_name_or_null(name),
"Refusing to create a router named '%s': this name already describes a node.", name.c_str());
simgrid::kernel::routing::NetPoint* netpoint =
@@ -128,15 +126,15 @@ void sg_platf_new_link(simgrid::kernel::routing::LinkCreationArgs* link)
if (link->properties) {
for (auto const& elm : *link->properties)
- l->setProperty(elm.first, elm.second);
+ l->set_property(elm.first, elm.second);
}
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;
}
@@ -212,8 +210,8 @@ void sg_platf_new_cluster(simgrid::kernel::routing::ClusterCreationArgs* cluster
// other columns are to store one or more link for the node
//add a loopback link
- simgrid::kernel::resource::LinkImpl* linkUp = nullptr;
- simgrid::kernel::resource::LinkImpl* linkDown = nullptr;
+ simgrid::s4u::Link* linkUp = nullptr;
+ simgrid::s4u::Link* linkDown = nullptr;
if(cluster->loopback_bw > 0 || cluster->loopback_lat > 0){
std::string tmp_link = link_id + "_loopback";
XBT_DEBUG("", tmp_link.c_str(), cluster->loopback_bw);
@@ -224,11 +222,11 @@ 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::s4u::Link::by_name_or_null(tmp_link);
+ linkDown = simgrid::s4u::Link::by_name_or_null(tmp_link);
auto* as_cluster = static_cast(current_as);
- as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp, linkDown}});
+ as_cluster->private_links_.insert({as_cluster->node_pos(rankId), {linkUp->get_impl(), linkDown->get_impl()}});
}
//add a limiter link (shared link to account for maximal bandwidth of the node)
@@ -244,9 +242,10 @@ 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::s4u::Link::by_name_or_null(tmp_link);
linkUp = linkDown;
- current_as->private_links_.insert({current_as->node_pos_with_loopback(rankId), {linkUp, linkDown}});
+ current_as->private_links_.insert(
+ {current_as->node_pos_with_loopback(rankId), {linkUp->get_impl(), linkDown->get_impl()}});
}
//call the cluster function that adds the others links
@@ -281,7 +280,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::s4u::Link::by_name(link.id)->get_impl());
}
XBT_DEBUG("");
@@ -365,7 +364,7 @@ void sg_platf_new_storage(simgrid::kernel::routing::StorageCreationArgs* storage
if (storage->properties) {
for (auto const& elm : *storage->properties)
- s->setProperty(elm.first, elm.second);
+ s->set_property(elm.first, elm.second);
delete storage->properties;
}
}
@@ -489,7 +488,7 @@ void sg_platf_new_peer(simgrid::kernel::routing::PeerCreationArgs* peer)
/* Change from the defaults */
if (peer->state_trace)
- host->pimpl_cpu->setStateTrace(peer->state_trace);
+ host->pimpl_cpu->set_state_trace(peer->state_trace);
if (peer->speed_trace)
host->pimpl_cpu->set_speed_trace(peer->speed_trace);
}
@@ -546,6 +545,8 @@ static void surf_config_models_setup()
simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCreationArgs* zone)
{
if (not surf_parse_models_setup_already_called) {
+ simgrid::s4u::on_platform_creation();
+
/* Initialize the surf models. That must be done after we got all config, and before we need the models.
* That is, after the last tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
*
@@ -599,10 +600,7 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre
}
if (current_routing == nullptr) { /* it is the first one */
- xbt_assert(simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ == nullptr,
- "All defined components must belong to a networking zone.");
- simgrid::s4u::Engine::get_instance()->pimpl->netzone_root_ = new_zone;
-
+ simgrid::s4u::Engine::get_instance()->set_netzone_root(new_zone);
} else {
/* set the father behavior */
if (current_routing->hierarchy_ == simgrid::kernel::routing::NetZoneImpl::RoutingMode::unset)
@@ -613,7 +611,7 @@ simgrid::s4u::NetZone* sg_platf_new_Zone_begin(simgrid::kernel::routing::ZoneCre
/* set the new current component of the tree */
current_routing = new_zone;
- simgrid::s4u::NetZone::onCreation(*new_zone); // notify the signal
+ simgrid::s4u::NetZone::on_creation(*new_zone); // notify the signal
return new_zone;
}
@@ -628,8 +626,8 @@ void sg_platf_new_Zone_seal()
{
xbt_assert(current_routing, "Cannot seal the current AS: none under construction");
current_routing->seal();
- simgrid::s4u::NetZone::onSeal(*current_routing);
- current_routing = static_cast(current_routing->getFather());
+ simgrid::s4u::NetZone::on_seal(*current_routing);
+ current_routing = static_cast(current_routing->get_father());
}
/** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */
@@ -640,8 +638,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::s4u::Link* linkUp = simgrid::s4u::Link::by_name_or_null(hostlink->link_up);
+ simgrid::s4u::Link* linkDown = simgrid::s4u::Link::by_name_or_null(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());
@@ -652,7 +650,7 @@ void sg_platf_new_hostlink(simgrid::kernel::routing::HostLinkCreationArgs* hostl
surf_parse_error(std::string("Host_link for '") + hostlink->id.c_str() + "' is already defined!");
XBT_DEBUG("Push Host_link for host '%s' to position %u", netpoint->get_cname(), netpoint->id());
- as_cluster->private_links_.insert({netpoint->id(), {linkUp, linkDown}});
+ as_cluster->private_links_.insert({netpoint->id(), {linkUp->get_impl(), linkDown->get_impl()}});
}
void sg_platf_new_trace(simgrid::kernel::routing::TraceCreationArgs* trace)