Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add new signal trigerred when some config has been done in the XML
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 30 Apr 2018 14:41:09 +0000 (16:41 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 30 Apr 2018 14:41:09 +0000 (16:41 +0200)
this allow us to start tracing if tracing:yes is in the XML and not on
command line

include/simgrid/s4u/Engine.hpp
src/instr/instr_config.cpp
src/instr/instr_private.hpp
src/s4u/s4u_Engine.cpp
src/surf/xml/surfxml_sax_cb.cpp

index bd28d99..5d18f7b 100644 (file)
@@ -226,6 +226,9 @@ extern XBT_PUBLIC xbt::signal<void()> on_platform_created;
 /** Callback fired when the platform is about to be created (ie, just before the xml file is parsed) */
 extern XBT_PUBLIC xbt::signal<void()> on_platform_creation;
 
+/** Callback fired when some configuration has be done directly in the XML file */
+extern XBT_PUBLIC xbt::signal<void()> on_config_in_platform_done;
+
 /** Callback fired when the main simulation loop ends, just before the end of Engine::run() */
 extern XBT_PUBLIC xbt::signal<void()> on_simulation_end;
 
index 4a7fd8a..989437a 100644 (file)
@@ -76,7 +76,7 @@ static bool trace_active     = false;
 
 simgrid::instr::TraceFormat simgrid::instr::trace_format = simgrid::instr::TraceFormat::Paje;
 
-void TRACE_start()
+static void TRACE_start()
 {
   if (trace_active)
     return;
@@ -281,6 +281,7 @@ void TRACE_global_init()
 
   /* Connect callbacks */
   simgrid::s4u::on_platform_creation.connect(TRACE_start);
+  simgrid::s4u::on_config_in_platform_done.connect(TRACE_start);
   simgrid::s4u::on_deadlock.connect(TRACE_end);
   simgrid::s4u::on_simulation_end.connect(TRACE_end);
 }
index 0574307..a403957 100644 (file)
@@ -255,7 +255,6 @@ void instr_new_user_state_type(std::string father_type, std::string new_typename
 void instr_new_value_for_user_state_type(std::string new_typename, const char* value, std::string color);
 
 /* instr_config.c */
-XBT_PRIVATE void TRACE_start();
 XBT_PRIVATE void TRACE_TI_start();
 XBT_PRIVATE void TRACE_TI_end();
 XBT_PRIVATE void TRACE_global_init();
index 1263f11..23e9576 100644 (file)
@@ -25,6 +25,7 @@ namespace simgrid {
 namespace s4u {
 xbt::signal<void()> on_platform_creation;
 xbt::signal<void()> on_platform_created;
+xbt::signal<void()> on_config_in_platform_done;
 xbt::signal<void()> on_simulation_end;
 xbt::signal<void(double)> on_time_advance;
 xbt::signal<void(void)> on_deadlock;
index 43c3b3b..c1e5a77 100644 (file)
@@ -869,9 +869,8 @@ void ETag_surfxml_config()
       XBT_INFO("The custom configuration '%s' is already defined by user!", elm.first.c_str());
   }
   XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
-  if (TRACE_is_enabled())
-    TRACE_start();
 
+  simgrid::s4u::on_config_in_platform_done();
   delete current_property_set;
   current_property_set = nullptr;
 }