Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplication and uniformization
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 24 Apr 2018 16:43:17 +0000 (18:43 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 24 Apr 2018 18:04:28 +0000 (20:04 +0200)
src/bindings/lua/lua_platf.cpp
src/include/surf/surf.hpp
src/instr/instr_config.cpp
src/instr/instr_private.hpp
src/surf/instr_routing.cpp
src/surf/sg_platf.cpp
src/surf/storage_n11.cpp
src/surf/surf_private.hpp
src/surf/xml/surfxml_parseplatf.cpp

index 26c9276..a52a707 100644 (file)
@@ -63,8 +63,6 @@ int console_open(lua_State *L) {
   sg_platf_init();
   sg_platf_begin();
 
-  storage_register_callbacks();
-
   return 0;
 }
 
index 03768f9..db629cc 100644 (file)
@@ -332,7 +332,6 @@ XBT_PUBLIC void parse_platform_file(const char* file);
 /********** Tracing **********/
 
 /* instr_routing.c */
-void instr_routing_define_callbacks();
 xbt_graph_t instr_routing_platform_graph();
 void instr_routing_platform_graph_export_graphviz(xbt_graph_t g, const char* filename);
 
index f5e687a..1f76e6a 100644 (file)
@@ -81,6 +81,7 @@ int TRACE_start()
   //    - enabled (with --cfg=tracing:yes)
   //    - already configured (TRACE_global_init already called)
   if (TRACE_is_enabled()) {
+    instr_routing_define_callbacks();
 
     XBT_DEBUG("Tracing starts");
     /* init the tracing module to generate the right output */
@@ -201,42 +202,42 @@ bool TRACE_uncategorized ()
 
 bool TRACE_actor_is_enabled()
 {
-  return trace_actor_enabled && TRACE_is_enabled();
+  return trace_actor_enabled && trace_enabled;
 }
 
 bool TRACE_vm_is_enabled()
 {
-  return trace_vm_enabled && TRACE_is_enabled();
+  return trace_vm_enabled && trace_enabled;
 }
 
 bool TRACE_disable_link()
 {
-  return trace_disable_link && TRACE_is_enabled();
+  return trace_disable_link && trace_enabled;
 }
 
 bool TRACE_disable_speed()
 {
-  return trace_disable_power && TRACE_is_enabled();
+  return trace_disable_power && trace_enabled;
 }
 
 bool TRACE_buffer ()
 {
-  return trace_buffer && TRACE_is_enabled();
+  return trace_buffer && trace_enabled;
 }
 
 bool TRACE_disable_destroy ()
 {
-  return trace_disable_destroy && TRACE_is_enabled();
+  return trace_disable_destroy && trace_enabled;
 }
 
 bool TRACE_basic ()
 {
-  return trace_basic && TRACE_is_enabled();
+  return trace_basic && trace_enabled;
 }
 
 bool TRACE_display_sizes ()
 {
-   return trace_display_sizes && trace_smpi_enabled && TRACE_is_enabled();
+  return trace_display_sizes && trace_smpi_enabled && trace_enabled;
 }
 
 std::string TRACE_get_comment()
index 2e71e31..579758c 100644 (file)
@@ -249,6 +249,7 @@ XBT_PRIVATE void TRACE_surf_link_set_utilization(const char* resource, const cha
 extern XBT_PRIVATE std::set<std::string> trivaNodeTypes;
 extern XBT_PRIVATE std::set<std::string> trivaEdgeTypes;
 XBT_PRIVATE long long int instr_new_paje_id();
+XBT_PRIVATE void instr_routing_define_callbacks();
 void instr_new_variable_type(std::string new_typename, std::string color);
 void instr_new_user_variable_type(std::string father_type, std::string new_typename, std::string color);
 void instr_new_user_state_type(std::string father_type, std::string new_typename);
index 835aee2..b70294a 100644 (file)
@@ -150,7 +150,7 @@ static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t
 /*
  * Callbacks
  */
-static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone)
+static void instr_netzone_on_creation(simgrid::s4u::NetZone& netzone)
 {
   std::string id = netzone.get_name();
 
@@ -180,14 +180,14 @@ static void sg_instr_AS_begin(simgrid::s4u::NetZone& netzone)
   }
 }
 
-static void sg_instr_AS_end(simgrid::s4u::NetZone& /*netzone*/)
+static void instr_netzone_on_seal(simgrid::s4u::NetZone& /*netzone*/)
 {
   if (TRACE_needs_platform()){
     currentContainer.pop_back();
   }
 }
 
-static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
+static void instr_link_on_creation(simgrid::s4u::Link& link)
 {
   if (currentContainer.empty()) // No ongoing parsing. Are you creating the loopback?
     return;
@@ -208,7 +208,7 @@ static void instr_routing_parse_start_link(simgrid::s4u::Link& link)
   }
 }
 
-static void sg_instr_new_host(simgrid::s4u::Host& host)
+static void instr_host_on_creation(simgrid::s4u::Host& host)
 {
   container_t container = new simgrid::instr::HostContainer(host, currentContainer.back());
   container_t root      = simgrid::instr::Container::getRoot();
@@ -255,13 +255,13 @@ static void sg_instr_new_host(simgrid::s4u::Host& host)
   }
 }
 
-static void sg_instr_new_router(simgrid::kernel::routing::NetPoint * netpoint)
+static void instr_netpoint_on_creation(simgrid::kernel::routing::NetPoint* netpoint)
 {
   if (netpoint->is_router() && TRACE_is_enabled() && TRACE_needs_platform())
     new simgrid::instr::RouterContainer(netpoint->get_cname(), currentContainer.back());
 }
 
-static void instr_routing_parse_end_platform ()
+static void instr_on_platform_created()
 {
   currentContainer.clear();
   std::set<std::string>* filter = new std::set<std::string>;
@@ -273,19 +273,18 @@ static void instr_routing_parse_end_platform ()
   TRACE_paje_dump_buffer(true);
 }
 
-void instr_routing_define_callbacks ()
+void instr_routing_define_callbacks()
 {
-  // always need the callbacks to ASes (we need only the root AS), to create the rootContainer and the rootType properly
-  if (not TRACE_is_enabled())
-    return;
+  // always need the callbacks to zones (we need only the root zone), to create the rootContainer and the rootType
+  // properly
   if (TRACE_needs_platform()) {
-    simgrid::s4u::Link::onCreation.connect(instr_routing_parse_start_link);
-    simgrid::s4u::onPlatformCreated.connect(instr_routing_parse_end_platform);
-    simgrid::s4u::Host::onCreation.connect(sg_instr_new_host);
+    simgrid::s4u::Host::onCreation.connect(instr_host_on_creation);
+    simgrid::s4u::Link::onCreation.connect(instr_link_on_creation);
+    simgrid::s4u::onPlatformCreated.connect(instr_on_platform_created);
   }
-  simgrid::s4u::NetZone::onCreation.connect(sg_instr_AS_begin);
-  simgrid::s4u::NetZone::onSeal.connect(sg_instr_AS_end);
-  simgrid::kernel::routing::NetPoint::onCreation.connect(sg_instr_new_router);
+  simgrid::s4u::NetZone::onCreation.connect(instr_netzone_on_creation);
+  simgrid::s4u::NetZone::onSeal.connect(instr_netzone_on_seal);
+  simgrid::kernel::routing::NetPoint::onCreation.connect(instr_netpoint_on_creation);
 }
 /*
  * user categories support
index fae502c..9f71bc5 100644 (file)
@@ -48,7 +48,8 @@ static simgrid::kernel::routing::NetZoneImpl* routing_get_current()
 
 /** Module management function: creates all internal data structures */
 void sg_platf_init()
-{ /* Do nothing: just for symmetry of user code */
+{
+  simgrid::s4u::onPlatformCreated.connect(check_disk_attachment);
 }
 
 /** Module management function: frees all internal data structures */
index f9e5c7a..53b7503 100644 (file)
@@ -17,7 +17,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage);
  *************/
 extern std::map<std::string, simgrid::surf::StorageType*> storage_types;
 
-static void check_disk_attachment()
+void check_disk_attachment()
 {
   for (auto const& s : simgrid::s4u::Engine::getInstance()->getAllStorages()) {
     simgrid::kernel::routing::NetPoint* host_elm = sg_netpoint_by_name_or_null(s->getImpl()->getHost().c_str());
@@ -29,12 +29,6 @@ static void check_disk_attachment()
   }
 }
 
-void storage_register_callbacks()
-{
-  simgrid::s4u::onPlatformCreated.connect(check_disk_attachment);
-  instr_routing_define_callbacks();
-}
-
 /*********
  * Model *
  *********/
index 375960c..fc2e885 100644 (file)
@@ -20,8 +20,7 @@ XBT_PRIVATE std::ifstream* surf_ifsopen(std::string name);
  */
 XBT_PRIVATE int __surf_is_absolute_file_path(const char* file_path);
 
-XBT_PUBLIC void storage_register_callbacks();
-
+XBT_PRIVATE void check_disk_attachment();
 XBT_PRIVATE void parse_after_config();
 
 #endif
index 3edce86..14767ed 100644 (file)
@@ -65,9 +65,6 @@ void parse_after_config() {
   if (not after_config_done) {
     TRACE_start();
 
-    /* Register classical callbacks */
-    storage_register_callbacks();
-
     after_config_done = 1;
   }
 }