Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix tracing options ignored when set in xml config file [#14853]
authorPaul Bédaride <paul.bedaride@gmail.com>
Wed, 23 Apr 2014 08:50:58 +0000 (10:50 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Wed, 23 Apr 2014 08:51:27 +0000 (10:51 +0200)
examples/msg/tracing/ms.tesh
src/instr/instr_config.c
src/msg/msg_global.c
src/simdag/sd_global.c
src/smpi/smpi_global.c
src/surf/surf_private.h
src/surf/surfxml_parse.c
src/surf/surfxml_parseplatf.c

index dfa83e1..ca23c9f 100644 (file)
@@ -17,6 +17,23 @@ $ $SG_TEST_EXENV ${bindir:=.}/tracing/ms$EXEEXT --cfg=tracing:yes --cfg=tracing/
 > [4.214759] [msg_test/INFO] Declared marks:
 > [4.214759] [msg_test/INFO] msmark
 
+p Tracing master/slave application with xml config
+$ $SG_TEST_EXENV ${bindir:=.}/tracing/ms$EXEEXT ${srcdir:=.}/tracing/platform-config.xml ${srcdir:=.}/tracing/deployment.xml
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/uncategorized' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/buffer' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing' to 'yes'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'viva/categorized' to 'tracing/msx.cat.plist'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/filename' to 'tracing/msx.trace'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'viva/uncategorized' to 'tracing/msx.uncat.plist'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to 'yes'
+> [4.214759] [msg_test/INFO] Declared tracing categories:
+> [4.214759] [msg_test/INFO] request
+> [4.214759] [msg_test/INFO] finalize
+> [4.214759] [msg_test/INFO] report
+> [4.214759] [msg_test/INFO] compute
+> [4.214759] [msg_test/INFO] Declared marks:
+> [4.214759] [msg_test/INFO] msmark
+
 p Not tracing master/slave application
 $ $SG_TEST_EXENV ${bindir:=.}/tracing/ms$EXEEXT ${srcdir:=.}/tracing/platform.xml ${srcdir:=.}/tracing/deployment.xml
 
@@ -41,7 +58,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/tracing/ms$EXEEXT --cfg=tracing:yes --cfg=tracing/
 $ $SG_TEST_EXENV cat tracing/ms.uncat.plist
 >   node = ("HOST","LINK");
 >   edge = ("0-LINK13-LINK13","0-LINK13-HOST1","0-HOST1-LINK13");
-> 
+>
 >   host = {
 >     type = "square";
 >     size = "power";
@@ -56,7 +73,7 @@ $ $SG_TEST_EXENV cat tracing/ms.uncat.plist
 $ $SG_TEST_EXENV cat tracing/ms.cat.plist
 >   node = ("HOST","LINK");
 >   edge = ("0-LINK13-LINK13","0-LINK13-HOST1","0-HOST1-LINK13");
-> 
+>
 >   host = {
 >     type = "square";
 >     size = "power";
index 4093e78..e017625 100644 (file)
@@ -39,7 +39,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_config, instr, "Configuration");
 #define OPT_TRACING_DISABLE_LINK        "tracing/disable_link"
 #define OPT_TRACING_DISABLE_POWER       "tracing/disable_power"
 
-static int trace_enabled;
+static int trace_enabled = 0;
 static int trace_platform;
 static int trace_platform_topology;
 static int trace_smpi_enabled;
@@ -95,12 +95,14 @@ void TRACE_add_start_function(void (*func) ())
 
 int TRACE_start()
 {
-  TRACE_getopts();
+  if (TRACE_is_configured())
+    TRACE_getopts();
 
   // tracing system must be:
   //    - enabled (with --cfg=tracing:yes)
   //    - already configured (TRACE_global_init already called)
-  if (TRACE_is_enabled() && TRACE_is_configured()) {
+  if (TRACE_is_enabled()) {
+
     XBT_DEBUG("Tracing starts");
 
     /* init the tracing module to generate the right output */
index 018afcb..9429b10 100644 (file)
@@ -74,10 +74,6 @@ void MSG_init_nocheck(int *argc, char **argv) {
     MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg));
   }
 
-#ifdef HAVE_TRACING
-  TRACE_start();
-#endif
-
   XBT_DEBUG("ADD MSG LEVELS");
   MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_priv_free);
   MSG_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, (void_f_pvoid_t) __MSG_storage_destroy);
index e3f62b1..0d87b7d 100644 (file)
@@ -84,10 +84,6 @@ void SD_init(int *argc, char **argv)
   xbt_cfg_setdefault_string(_sg_cfg_set, "workstation/model",
                             "ptask_L07");
 
-#ifdef HAVE_TRACING
-  TRACE_start ();
-#endif
-
 #ifdef HAVE_JEDULE
   jedule_sd_init();
 #endif
index 3315d44..ef34dfb 100644 (file)
@@ -367,7 +367,7 @@ static void smpi_comm_copy_buffer_callback(smx_action_t comm,
     //It seems that the request is used after the call there this should
     //be free somewhereelse  but where???
     //xbt_free(comm->comm.src_data);// inside SMPI the request is keep
-    //inside the user data and should be free 
+    //inside the user data and should be free
     comm->comm.src_buff = NULL;
   }
 
@@ -518,10 +518,6 @@ int smpi_main(int (*realmain) (int argc, char *argv[]), int argc, char *argv[])
 
   SIMIX_global_init(&argc, argv);
 
-#ifdef HAVE_TRACING
-  TRACE_start();
-#endif
-
   // parse the platform file: get the host list
   SIMIX_create_environment(argv[1]);
 
index a983231..72291ae 100644 (file)
@@ -86,6 +86,7 @@ XBT_PUBLIC(void) generic_get_graph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict
  */
 XBT_PUBLIC(void) surfxml_bufferstack_push(int _new);
 XBT_PUBLIC(void) surfxml_bufferstack_pop(int _new);
+XBT_PUBLIC(void) parse_after_config(void);
 
 XBT_PUBLIC_DATA(int) surfxml_bufferstack_size;
 
index ff091ec..c0c0476 100644 (file)
@@ -298,6 +298,7 @@ static xbt_dynar_t surf_parsed_filename_stack = NULL;
 
 void STag_surfxml_include(void)
 {
+  parse_after_config();
   XBT_DEBUG("STag_surfxml_include '%s'",A_surfxml_include_file);
   xbt_dynar_push(surf_parsed_filename_stack,&surf_parsed_filename); // save old file name
   surf_parsed_filename = xbt_strdup(A_surfxml_include_file);
@@ -568,15 +569,17 @@ void ETag_surfxml_cluster(void){
   cluster.availability_trace = A_surfxml_cluster_availability___file;
   cluster.state_trace = A_surfxml_cluster_state___file;
   sg_platf_new_cluster(&cluster);
-  
+
   current_property_set = NULL;
 }
 
-void STag_surfxml_cluster(void){ 
+void STag_surfxml_cluster(void){
+  parse_after_config();
   xbt_assert(current_property_set == NULL, "Someone forgot to reset the property set to NULL in its closing tag (or XML malformed)");
 }
 
 void STag_surfxml_cabinet(void){
+  parse_after_config();
   s_sg_platf_cabinet_cbarg_t cabinet;
   memset(&cabinet,0,sizeof(cabinet));
   cabinet.id = A_surfxml_cabinet_id;
@@ -591,6 +594,7 @@ void STag_surfxml_cabinet(void){
 }
 
 void STag_surfxml_peer(void){
+  parse_after_config();
   s_sg_platf_peer_cbarg_t peer;
   memset(&peer,0,sizeof(peer));
   peer.id = A_surfxml_peer_id;
@@ -832,6 +836,7 @@ void ETag_surfxml_trace(void){
 }
 
 void STag_surfxml_trace___connect(void){
+  parse_after_config();
   s_sg_platf_trace_connect_cbarg_t trace_connect;
   memset(&trace_connect,0,sizeof(trace_connect));
 
@@ -860,6 +865,7 @@ void STag_surfxml_trace___connect(void){
 }
 
 void STag_surfxml_AS(void){
+  parse_after_config();
   AS_TAG = 1;
   s_sg_platf_AS_cbarg_t AS = SG_PLATF_AS_INITIALIZER;
   AS.id = A_surfxml_AS_id;
@@ -906,6 +912,7 @@ void ETag_surfxml_config(void){
     free(cfg);
   }
   XBT_DEBUG("End configuration name = %s",A_surfxml_config_id);
+
   xbt_dict_free(&current_property_set);
   current_property_set = NULL;
 }
@@ -982,7 +989,7 @@ void ETag_surfxml_prop(void){}
 void STag_surfxml_random(void){}
 void ETag_surfxml_random(void){}
 void ETag_surfxml_trace___connect(void){}
-void STag_surfxml_trace(void){}
+void STag_surfxml_trace(void){parse_after_config();}
 void ETag_surfxml_router(void){}
 void ETag_surfxml_host___link(void){}
 void ETag_surfxml_cabinet(void){}
index 2c93389..f8130cb 100644 (file)
@@ -69,6 +69,25 @@ XBT_PUBLIC(void) gpu_register_callbacks(void){
 }
 /* ***************************************** */
 
+static int after_config_done;
+void parse_after_config() {
+  if (!after_config_done) {
+    //
+    #ifdef HAVE_TRACING
+      TRACE_start();
+    #endif
+
+    /* Register classical callbacks */
+    storage_register_callbacks();
+    routing_register_callbacks();
+
+    /* ***************************************** */
+    /* TUTORIAL: New TAG                         */
+    gpu_register_callbacks();
+    /* ***************************************** */
+    after_config_done = 1;
+  }
+}
 
 /* This function acts as a main in the parsing area. */
 void parse_platform_file(const char *file)
@@ -77,19 +96,10 @@ void parse_platform_file(const char *file)
 
   surf_parse_init_callbacks();
 
-  /* Register classical callbacks */
-  storage_register_callbacks();
-  routing_register_callbacks();
-
-  /* ***************************************** */
-  /* TUTORIAL: New TAG                         */
-  gpu_register_callbacks();
-  /* ***************************************** */
-
   /* init the flex parser */
   surfxml_buffer_stack_stack_ptr = 1;
   surfxml_buffer_stack_stack[0] = 0;
-
+  after_config_done = 0;
   surf_parse_open(file);
 
   /* Init my data */