From 6865db1b80d2d06c80ff82e7246821958b56e2d2 Mon Sep 17 00:00:00 2001 From: Takishipp Date: Thu, 8 Jun 2017 16:41:29 +0200 Subject: [PATCH] getting sg_instr_AS_end through a signal structure --- include/simgrid/s4u/NetZone.hpp | 1 + src/s4u/s4u_netzone.cpp | 1 + src/surf/instr_routing.cpp | 3 ++- src/surf/sg_platf.cpp | 6 ++---- src/surf/xml/platf_private.hpp | 1 - 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/simgrid/s4u/NetZone.hpp b/include/simgrid/s4u/NetZone.hpp index 4dc88c3884..fe9d878cbb 100644 --- a/include/simgrid/s4u/NetZone.hpp +++ b/include/simgrid/s4u/NetZone.hpp @@ -68,6 +68,7 @@ public: std::vector* link_list)> onRouteCreation; static simgrid::xbt::signal onCreation; + static simgrid::xbt::signal onSeal; protected: std::vector diff --git a/src/s4u/s4u_netzone.cpp b/src/s4u/s4u_netzone.cpp index 38863221b2..1eec476116 100644 --- a/src/s4u/s4u_netzone.cpp +++ b/src/s4u/s4u_netzone.cpp @@ -21,6 +21,7 @@ simgrid::xbt::signal* link_list)> NetZone::onRouteCreation; simgrid::xbt::signal NetZone::onCreation; +simgrid::xbt::signal NetZone::onSeal; NetZone::NetZone(NetZone* father, const char* name) : father_(father), name_(xbt_strdup(name)) { diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 4f4902a0a9..ed350fe675 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -195,7 +195,7 @@ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone) } } -void sg_instr_AS_end() +static void sg_instr_AS_end(simgrid::s4u::NetZone& /*netzone*/) { if (TRACE_needs_platform()){ currentContainer.pop_back(); @@ -326,6 +326,7 @@ void instr_routing_define_callbacks () simgrid::s4u::Host::onCreation.connect(sg_instr_new_host); } simgrid::s4u::NetZone::onCreation.connect(sg_instr_AS_begin); + simgrid::s4u::NetZone::onSeal.connect(sg_instr_AS_end); } /* diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 7eb25fc686..d75966f784 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -677,10 +677,8 @@ void sg_platf_new_AS_seal() { xbt_assert(current_routing, "Cannot seal the current AS: none under construction"); current_routing->seal(); - current_routing = static_cast(current_routing->father()); - - if (TRACE_is_enabled()) - sg_instr_AS_end(); + simgrid::s4u::NetZone::onSeal(*current_routing); + current_routing = static_cast(current_routing->father()); } /** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index 9b353f6871..6939107fce 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -246,7 +246,6 @@ XBT_PUBLIC_DATA(int) surfxml_bufferstack_size; XBT_PUBLIC(void) routing_route_free(sg_platf_route_cbarg_t route); /********** Instr. **********/ XBT_PRIVATE void sg_instr_new_router(const char* name); -XBT_PRIVATE void sg_instr_AS_end(); SG_END_DECL() -- 2.20.1