Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prevent warning message 'config elem ... registered twice'
authorChristian Heinrich <christian.heinrich@livando.com>
Mon, 9 Feb 2015 13:45:10 +0000 (14:45 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 15 Oct 2015 17:17:16 +0000 (19:17 +0200)
Currently, Lua platform files require the MSG module to be
initialised. Hence, when SMPI and Lua platform files are
used at the same time, MSG and SMPI will be
completely initialised, resulting in multiple calls
to TRACE_global_init which sets up the config params.

This commit simply adds a flag to that function so that
the config elems are registered only once.

src/instr/instr_config.c

index 395a915..2c0ff84 100644 (file)
@@ -360,6 +360,10 @@ char *TRACE_get_viva_cat_conf (void)
 
 void TRACE_global_init(int *argc, char **argv)
 {
+  static int is_initialised = 0;
+  if (is_initialised) return;
+
+  is_initialised = 1;
   /* name of the tracefile */
   xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FILENAME,
                    "Trace file created by the instrumented SimGrid.",
@@ -484,7 +488,7 @@ void TRACE_global_init(int *argc, char **argv)
 
   /* format -- Switch the ouput format of Tracing */
   xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT,
-                   "(smpi only for now) Switch the ouput format of Tracing",
+                   "(smpi only for now) Switch the output format of Tracing",
                    xbt_cfgelm_string, 1, 1, NULL, NULL);
   xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_FORMAT, "Paje");