Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 5 Apr 2016 04:33:32 +0000 (06:33 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 5 Apr 2016 04:33:32 +0000 (06:33 +0200)
21 files changed:
include/xbt/config.h
src/include/simgrid/sg_config.h
src/instr/instr_TI_trace.cpp
src/instr/instr_config.cpp
src/mc/mc_config.cpp
src/msg/msg_global.cpp
src/simdag/sd_global.cpp
src/simgrid/sg_config.cpp
src/surf/cpu_cas01.cpp
src/surf/host_clm03.cpp
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_ns3.cpp
src/surf/network_smpi.cpp
src/surf/sg_platf.cpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/config.c
src/xbt/xbt_main.c
teshsuite/lua/lua_platforms.tesh
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp

index 1373a8f..d311b66 100644 (file)
@@ -82,23 +82,23 @@ typedef void* xbt_cfg_t;
 
 XBT_PUBLIC(void) xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...);
 XBT_PUBLIC(void) xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa);
-XBT_PUBLIC(void) xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options);
+XBT_PUBLIC(void) xbt_cfg_set_parse(const char *options);
 
 /* Set the value of the cell \a name in \a cfg with the provided value.*/
-XBT_PUBLIC(void) xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_set_boolean(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void*) xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_set_int       (const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_set_double    (const char *name, double val);
+XBT_PUBLIC(void) xbt_cfg_set_string    (const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_set_boolean   (const char *name, const char *val);
+XBT_PUBLIC(void*) xbt_cfg_set_as_string(const char *name, const char *val);
 
 /*
   Set the default value of the cell \a name in \a cfg with the provided value.
   If it was already set to something (possibly from the command line), do nothing.
  */
-XBT_PUBLIC(void) xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_boolean(xbt_cfg_t cfg, const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_int    (const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_double (const char *name, double val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_string (const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_boolean(const char *name, const char *val);
 
 /** @brief Remove the provided value from the cell #name in #cfg. */
 XBT_PUBLIC(void) xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val);
@@ -113,7 +113,7 @@ XBT_PUBLIC(void) xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos);
 XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
 
 /** @brief Return if configuration is set by default*/
-XBT_PUBLIC(int) xbt_cfg_is_default_value(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(int) xbt_cfg_is_default_value(const char *name);
 
 /* @} */
 
@@ -161,17 +161,17 @@ XBT_PUBLIC(void) xbt_cfg_dump(const char *name, const char *indent, xbt_cfg_t cf
  */
 XBT_PUBLIC(void) xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *description,
     e_xbt_cfgelm_type_t type, int min, int max, xbt_cfg_cb_t cb_set);
-XBT_PUBLIC(void) xbt_cfg_register_double (xbt_cfg_t * cfg, const char *name, const char *desc, double default_val,    xbt_cfg_cb_t cb_set);
-XBT_PUBLIC(void) xbt_cfg_register_int    (xbt_cfg_t * cfg, const char *name, const char *desc, int default_val,       xbt_cfg_cb_t cb_set);
-XBT_PUBLIC(void) xbt_cfg_register_string (xbt_cfg_t * cfg, const char *name, const char *desc, const char*default_val,xbt_cfg_cb_t cb_set);
-XBT_PUBLIC(void) xbt_cfg_register_boolean(xbt_cfg_t * cfg, const char *name, const char *desc, const char*default_val,xbt_cfg_cb_t cb_set);
-XBT_PUBLIC(void) xbt_cfg_register_alias(xbt_cfg_t * cfg, const char *newname, const char *oldname);
+XBT_PUBLIC(void) xbt_cfg_register_double (const char *name, const char *desc, double default_val,    xbt_cfg_cb_t cb_set);
+XBT_PUBLIC(void) xbt_cfg_register_int    (const char *name, const char *desc, int default_val,       xbt_cfg_cb_t cb_set);
+XBT_PUBLIC(void) xbt_cfg_register_string (const char *name, const char *desc, const char*default_val,xbt_cfg_cb_t cb_set);
+XBT_PUBLIC(void) xbt_cfg_register_boolean(const char *name, const char *desc, const char*default_val,xbt_cfg_cb_t cb_set);
+XBT_PUBLIC(void) xbt_cfg_register_alias(const char *newname, const char *oldname);
 XBT_PUBLIC(void) xbt_cfg_unregister(xbt_cfg_t cfg, const char *name);
 XBT_PUBLIC(void) xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry);
 
 XBT_PUBLIC(void) xbt_cfg_aliases(xbt_cfg_t cfg);
 XBT_PUBLIC(void) xbt_cfg_help(xbt_cfg_t cfg);
-XBT_PUBLIC(void) xbt_cfg_check(xbt_cfg_t cfg);
+XBT_PUBLIC(void) xbt_cfg_check(void);
 XBT_PUBLIC(e_xbt_cfgelm_type_t) xbt_cfg_get_type(xbt_cfg_t cfg, const char *name);
 /*  @} */
 /** @defgroup XBT_cfg_get Getting the stored values
@@ -187,11 +187,11 @@ XBT_PUBLIC(e_xbt_cfgelm_type_t) xbt_cfg_get_type(xbt_cfg_t cfg, const char *name
  *  @{
  */
 
-XBT_PUBLIC(int) xbt_cfg_get_int(xbt_cfg_t cfg, const char *name);
-XBT_PUBLIC(double) xbt_cfg_get_double(xbt_cfg_t cfg, const char *name);
-XBT_PUBLIC(char *) xbt_cfg_get_string(xbt_cfg_t cfg, const char *name);
-XBT_PUBLIC(int) xbt_cfg_get_boolean(xbt_cfg_t cfg, const char *name);
-XBT_PUBLIC(xbt_dynar_t) xbt_cfg_get_dynar(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(int)    xbt_cfg_get_int(const char *name);
+XBT_PUBLIC(double) xbt_cfg_get_double(const char *name);
+XBT_PUBLIC(char *) xbt_cfg_get_string(const char *name);
+XBT_PUBLIC(int)    xbt_cfg_get_boolean(const char *name);
+XBT_PUBLIC(xbt_dynar_t) xbt_cfg_get_dynar(const char *name);
 
 XBT_PUBLIC(int) xbt_cfg_get_int_at(xbt_cfg_t cfg, const char *name, int pos);
 XBT_PUBLIC(double) xbt_cfg_get_double_at(xbt_cfg_t cfg, const char *name, int pos);
index 4f305ce..6f61086 100644 (file)
@@ -9,7 +9,7 @@
 /** Config Globals */
 SG_BEGIN_DECL()
 
-XBT_PUBLIC_DATA(xbt_cfg_t) _sg_cfg_set;
+XBT_PUBLIC_DATA(xbt_cfg_t) simgrid_config;
 XBT_PUBLIC_DATA(int) _sg_cfg_init_status;
 XBT_PUBLIC_DATA(int) _sg_cfg_exit_asap;
 XBT_PUBLIC(int) sg_cfg_is_default_value(const char* name);
index 84e1e73..3d567cf 100644 (file)
@@ -69,7 +69,7 @@ void print_TICreateContainer(paje_event_t event)
     prefix = xbt_os_time();
   }
 
-  if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file") || temp == NULL) {
+  if (!xbt_cfg_get_boolean("tracing/smpi/format/ti_one_file") || temp == NULL) {
     char *folder_name = bprintf("%s_files", TRACE_get_filename());
     char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name);
 #ifdef WIN32
@@ -78,8 +78,7 @@ void print_TICreateContainer(paje_event_t event)
     mkdir(folder_name, S_IRWXU | S_IRWXG | S_IRWXO);
 #endif
     temp = fopen(filename, "w");
-    if (temp == NULL)
-      xbt_die("Tracefile %s could not be opened for writing: %s", filename, strerror(errno));
+    xbt_assert(temp, "Tracefile %s could not be opened for writing: %s", filename, strerror(errno));
     fprintf(tracing_file, "%s\n", filename);
 
     xbt_free(folder_name);
@@ -91,7 +90,7 @@ void print_TICreateContainer(paje_event_t event)
 
 void print_TIDestroyContainer(paje_event_t event)
 {
-  if (!xbt_cfg_get_boolean(_sg_cfg_set, "tracing/smpi/format/ti_one_file")|| xbt_dict_length(tracing_files) == 1) {
+  if (!xbt_cfg_get_boolean("tracing/smpi/format/ti_one_file")|| xbt_dict_length(tracing_files) == 1) {
     FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, ((destroyContainer_t) event->data)->container->name);
     fclose(f);
   }
index 5237dfb..7fb9f53 100644 (file)
@@ -65,26 +65,26 @@ static int trace_active = 0;
 
 static void TRACE_getopts(void)
 {
-  trace_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING);
-  trace_platform = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_PLATFORM);
-  trace_platform_topology = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_TOPOLOGY);
-  trace_smpi_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI);
-  trace_smpi_grouped = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_GROUP);
-  trace_smpi_computing = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING);
-  trace_smpi_sleeping = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING);
-  trace_view_internals = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS);
-  trace_categorized = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_CATEGORIZED);
-  trace_uncategorized = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_UNCATEGORIZED);
-  trace_msg_process_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_MSG_PROCESS);
-  trace_msg_vm_enabled = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_MSG_VM);
-  trace_buffer = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_BUFFER);
-  trace_onelink_only = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_ONELINK_ONLY);
-  trace_disable_destroy = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY);
-  trace_basic = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_BASIC);
-  trace_display_sizes = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_DISPLAY_SIZES);
-  trace_disable_link = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_LINK);
-  trace_disable_power = xbt_cfg_get_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_POWER);
-  trace_precision = xbt_cfg_get_int(_sg_cfg_set, OPT_TRACING_PRECISION);
+  trace_enabled = xbt_cfg_get_boolean(OPT_TRACING);
+  trace_platform = xbt_cfg_get_boolean(OPT_TRACING_PLATFORM);
+  trace_platform_topology = xbt_cfg_get_boolean(OPT_TRACING_TOPOLOGY);
+  trace_smpi_enabled = xbt_cfg_get_boolean(OPT_TRACING_SMPI);
+  trace_smpi_grouped = xbt_cfg_get_boolean(OPT_TRACING_SMPI_GROUP);
+  trace_smpi_computing = xbt_cfg_get_boolean(OPT_TRACING_SMPI_COMPUTING);
+  trace_smpi_sleeping = xbt_cfg_get_boolean(OPT_TRACING_SMPI_SLEEPING);
+  trace_view_internals = xbt_cfg_get_boolean(OPT_TRACING_SMPI_INTERNALS);
+  trace_categorized = xbt_cfg_get_boolean(OPT_TRACING_CATEGORIZED);
+  trace_uncategorized = xbt_cfg_get_boolean(OPT_TRACING_UNCATEGORIZED);
+  trace_msg_process_enabled = xbt_cfg_get_boolean(OPT_TRACING_MSG_PROCESS);
+  trace_msg_vm_enabled = xbt_cfg_get_boolean(OPT_TRACING_MSG_VM);
+  trace_buffer = xbt_cfg_get_boolean(OPT_TRACING_BUFFER);
+  trace_onelink_only = xbt_cfg_get_boolean(OPT_TRACING_ONELINK_ONLY);
+  trace_disable_destroy = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_DESTROY);
+  trace_basic = xbt_cfg_get_boolean(OPT_TRACING_BASIC);
+  trace_display_sizes = xbt_cfg_get_boolean(OPT_TRACING_DISPLAY_SIZES);
+  trace_disable_link = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_LINK);
+  trace_disable_power = xbt_cfg_get_boolean(OPT_TRACING_DISABLE_POWER);
+  trace_precision = xbt_cfg_get_int(OPT_TRACING_PRECISION);
 }
 
 static xbt_dynar_t TRACE_start_functions = NULL;
@@ -322,32 +322,32 @@ int TRACE_display_sizes (void)
 
 char *TRACE_get_comment (void)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, OPT_TRACING_COMMENT);
+  return xbt_cfg_get_string(OPT_TRACING_COMMENT);
 }
 
 char *TRACE_get_comment_file (void)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, OPT_TRACING_COMMENT_FILE);
+  return xbt_cfg_get_string(OPT_TRACING_COMMENT_FILE);
 }
 
 int TRACE_precision (void)
 {
-  return xbt_cfg_get_int(_sg_cfg_set, OPT_TRACING_PRECISION);
+  return xbt_cfg_get_int(OPT_TRACING_PRECISION);
 }
 
 char *TRACE_get_filename(void)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, OPT_TRACING_FILENAME);
+  return xbt_cfg_get_string(OPT_TRACING_FILENAME);
 }
 
 char *TRACE_get_viva_uncat_conf (void)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, OPT_VIVA_UNCAT_CONF);
+  return xbt_cfg_get_string(OPT_VIVA_UNCAT_CONF);
 }
 
 char *TRACE_get_viva_cat_conf (void)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, OPT_VIVA_CAT_CONF);
+  return xbt_cfg_get_string(OPT_VIVA_CAT_CONF);
 }
 
 void TRACE_global_init(int *argc, char **argv)
@@ -357,117 +357,38 @@ void TRACE_global_init(int *argc, char **argv)
 
   is_initialised = 1;
   /* name of the tracefile */
-  xbt_cfg_register_string (&_sg_cfg_set, OPT_TRACING_FILENAME,   "Trace file created by the instrumented SimGrid.", "simgrid.trace", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING,            "Enable Tracing.",                                            "no", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING_PLATFORM,   "Register the platform in the trace as a hierarchy.",         "no", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING_TOPOLOGY,   "Register the platform topology in the trace as a graph.",   "yes", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING_SMPI,       "Tracing of the SMPI interface.",                             "no", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING_SMPI_GROUP, "Group MPI processes by host.",                               "no", NULL);
-  xbt_cfg_register_boolean(&_sg_cfg_set, OPT_TRACING_SMPI_COMPUTING,
-      "Generate states for timing out of SMPI parts of the application", "no", NULL);
-
-/* smpi sleeping */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING,
-                   "Generate states for timing out of SMPI parts of the application", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_SLEEPING, "no");
-
-  /* smpi internals */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS,
-                   "View internal messages sent by Collective communications in SMPI", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_SMPI_INTERNALS, "no");
-
-  /* tracing categorized resource utilization traces */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_CATEGORIZED,
-                   "Tracing categorized resource utilization of hosts and links.", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_CATEGORIZED, "no");
-
-  /* tracing uncategorized resource utilization */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_UNCATEGORIZED,
-                   "Tracing uncategorized resource utilization of hosts and links.", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_UNCATEGORIZED, "no");
-
-  /* msg process */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_PROCESS, "Tracing of MSG process behavior.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_MSG_PROCESS, "no");
-
-  /* msg process */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_MSG_VM, "Tracing of MSG process behavior.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_MSG_VM, "no");
-
-  /* disable tracing link */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_LINK, "Do not trace link bandwidth and latency.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_LINK, "no");
-
-  /* disable tracing link */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_POWER, "Do not trace host power.", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_POWER, "no");
-
-  /* tracing buffer */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BUFFER, "Buffer trace events to put them in temporal order.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_BUFFER, "yes");
-
-  /* tracing one link only */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_ONELINK_ONLY, "Use only routes with one link to trace platform.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_ONELINK_ONLY, "no");
-
-  /* disable destroy */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY, "Disable platform containers destruction.",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISABLE_DESTROY, "no");
-
-  /* basic -- Avoid extended events (impoverished trace file) */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_BASIC, "Avoid extended events (impoverished trace file).",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_BASIC, "no");
-
-  /* display_sizes -- Extended events with message size information */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_DISPLAY_SIZES,
-                   "(smpi only for now) Extended events with message size information", xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_DISPLAY_SIZES, "no");
-
-  /* format -- Switch the ouput format of Tracing */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT, "(smpi only for now) Switch the output format of Tracing",
-                   xbt_cfgelm_string, 1, 1, NULL);
-  xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_FORMAT, "Paje");
-
-  /* format -- Switch the ouput format of Tracing */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_FORMAT_TI_ONEFILE,
-                   "(smpi only for now) For replay format only : output to one file only",
-                   xbt_cfgelm_boolean, 1, 1, NULL);
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, OPT_TRACING_FORMAT_TI_ONEFILE, "no");
-
-  /* comment */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_COMMENT, "Comment to be added on the top of the trace file.",
-                   xbt_cfgelm_string, 1, 1, NULL);
-  xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_COMMENT, "");
-
-  /* comment_file */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_COMMENT_FILE,
-                   "The contents of the file are added to the top of the trace file as comment.",
-                   xbt_cfgelm_string, 1, 1, NULL);
-  xbt_cfg_setdefault_string(_sg_cfg_set, OPT_TRACING_COMMENT_FILE, "");
-
-  /* trace timestamp precision */
-  xbt_cfg_register(&_sg_cfg_set, OPT_TRACING_PRECISION, "Numerical precision used when timestamping events (hence "
-                   "this value is expressed in number of digits after decimal point)", xbt_cfgelm_int, 1, 1, NULL);
-  xbt_cfg_setdefault_int(_sg_cfg_set, OPT_TRACING_PRECISION, 6);
-
-  /* Viva graph configuration for uncategorized tracing */
-  xbt_cfg_register(&_sg_cfg_set, OPT_VIVA_UNCAT_CONF,
-                   "Viva Graph configuration file for uncategorized resource utilization traces.",
-                   xbt_cfgelm_string, 1, 1, NULL);
-  xbt_cfg_setdefault_string(_sg_cfg_set, OPT_VIVA_UNCAT_CONF, "");
-
+  xbt_cfg_register_string (OPT_TRACING_FILENAME,   "Trace file created by the instrumented SimGrid.", "simgrid.trace", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING,            "Enable Tracing.",                                            "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_PLATFORM,   "Register the platform in the trace as a hierarchy.",         "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_TOPOLOGY,   "Register the platform topology in the trace as a graph.",   "yes", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_SMPI,       "Tracing of the SMPI interface.",                             "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_SMPI_GROUP, "Group MPI processes by host.",                               "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_SMPI_COMPUTING, "Generate states for timing out of SMPI parts of the application", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_SMPI_SLEEPING,  "Generate states for timing out of SMPI parts of the application", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_SMPI_INTERNALS, "View internal messages sent by Collective communications in SMPI", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED,    "Tracing categorized resource utilization of hosts and links.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED,  "Tracing uncategorized resource utilization of hosts and links.", "no", NULL);
+
+  xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS,  "Tracing of MSG process behavior.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_MSG_VM,       "Tracing of MSG process behavior.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK,  "Do not trace link bandwidth and latency.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "Do not trace host power.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_BUFFER,        "Buffer trace events to put them in temporal order.", "yes", NULL);
+
+  xbt_cfg_register_boolean(OPT_TRACING_ONELINK_ONLY, "Use only routes with one link to trace platform.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_DISABLE_DESTROY, "Disable platform containers destruction.", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_BASIC, "Avoid extended events (impoverished trace file).", "no", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_DISPLAY_SIZES, "(smpi only) Extended events with message size information", "no", NULL);
+  xbt_cfg_register_string(OPT_TRACING_FORMAT, "(smpi only) Switch the output format of Tracing" ,"Paje", NULL);
+  xbt_cfg_register_boolean(OPT_TRACING_FORMAT_TI_ONEFILE, "(smpi only) For replay format only : output to one file only", "no", NULL);
+  xbt_cfg_register_string(OPT_TRACING_COMMENT, "Comment to be added on the top of the trace file.", "", NULL);
+  xbt_cfg_register_string(OPT_TRACING_COMMENT_FILE,
+      "The contents of the file are added to the top of the trace file as comment.", "", NULL);
+  xbt_cfg_register_int(OPT_TRACING_PRECISION, "Numerical precision used when timestamping events "
+      "(expressed in number of digits after decimal point)", 6, NULL);
   /* Viva graph configuration for uncategorized tracing */
-  xbt_cfg_register(&_sg_cfg_set, OPT_VIVA_CAT_CONF,
-                   "Viva Graph configuration file for categorized resource utilization traces.",
-                   xbt_cfgelm_string, 1, 1, NULL);
-  xbt_cfg_setdefault_string(_sg_cfg_set, OPT_VIVA_CAT_CONF, "");
+  xbt_cfg_register_string(OPT_VIVA_UNCAT_CONF, "Viva Graph configuration file for uncategorized resource utilization traces.", "", NULL);
+  xbt_cfg_register_string(OPT_VIVA_CAT_CONF, "Viva Graph configuration file for categorized resource utilization traces.", "", NULL);
 
   /* instrumentation can be considered configured now */
   trace_configured = 1;
index 09f8ec3..336f011 100644 (file)
@@ -41,10 +41,9 @@ int _sg_mc_timeout = 0;
 void _mc_cfg_cb_timeout(const char *name, int pos)
 {
   if (_sg_cfg_init_status && !(_sg_do_model_check || MC_record_path))
-    xbt_die
-        ("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
+    xbt_die("You are specifying a value to enable/disable timeout for wait requests after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_timeout = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_timeout = xbt_cfg_get_boolean(name);
 }
 
 #if HAVE_MC
@@ -70,7 +69,7 @@ void _mc_cfg_cb_reduce(const char *name, int pos)
     xbt_die
         ("You are specifying a reduction strategy after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  char *val = xbt_cfg_get_string(_sg_cfg_set, name);
+  char *val = xbt_cfg_get_string(name);
   if (!strcasecmp(val, "none"))
     simgrid::mc::reduction_mode = simgrid::mc::ReductionMode::none;
   else if (!strcasecmp(val, "dpor"))
@@ -86,14 +85,14 @@ void _mc_cfg_cb_checkpoint(const char *name, int pos)
     xbt_die
         ("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_checkpoint = xbt_cfg_get_int(_sg_cfg_set, name);
+  _sg_mc_checkpoint = xbt_cfg_get_int(name);
 }
 
 void _mc_cfg_cb_sparse_checkpoint(const char *name, int pos) {
   if (_sg_cfg_init_status && !_sg_do_model_check)
     xbt_die("You are specifying a checkpointing value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_sparse_checkpoint = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_sparse_checkpoint = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_soft_dirty(const char *name, int pos) {
@@ -103,7 +102,7 @@ void _mc_cfg_cb_soft_dirty(const char *name, int pos) {
             "at config time (through --cfg=model-check:1). "
             "This won't work, sorry.");
 
-  _sg_mc_soft_dirty = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_soft_dirty = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_ksm(const char *name, int pos)
@@ -111,7 +110,7 @@ void _mc_cfg_cb_ksm(const char *name, int pos)
   if (_sg_cfg_init_status && !_sg_do_model_check)
     xbt_die("You are specifying a KSM value after the initialization (through MSG_config?), but model-checking was not activated at config time (through --cfg=model-check:1). This won't work, sorry.");
 
-  _sg_mc_ksm = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_ksm = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_property(const char *name, int pos)
@@ -120,7 +119,7 @@ void _mc_cfg_cb_property(const char *name, int pos)
     xbt_die
         ("You are specifying a property after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_property_file = xbt_cfg_get_string(_sg_cfg_set, name);
+  _sg_mc_property_file = xbt_cfg_get_string(name);
 }
 
 void _mc_cfg_cb_hash(const char *name, int pos)
@@ -129,7 +128,7 @@ void _mc_cfg_cb_hash(const char *name, int pos)
     xbt_die
         ("You are specifying a value to enable/disable the use of global hash to speedup state comparaison, but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_hash = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_hash = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_snapshot_fds(const char *name, int pos)
@@ -138,7 +137,7 @@ void _mc_cfg_cb_snapshot_fds(const char *name, int pos)
     xbt_die
         ("You are specifying a value to enable/disable the use of FD snapshotting, but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_snapshot_fds = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_snapshot_fds = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_max_depth(const char *name, int pos)
@@ -147,7 +146,7 @@ void _mc_cfg_cb_max_depth(const char *name, int pos)
     xbt_die
         ("You are specifying a max depth value after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_max_depth = xbt_cfg_get_int(_sg_cfg_set, name);
+  _sg_mc_max_depth = xbt_cfg_get_int(name);
 }
 
 void _mc_cfg_cb_visited(const char *name, int pos)
@@ -156,7 +155,7 @@ void _mc_cfg_cb_visited(const char *name, int pos)
     xbt_die
         ("You are specifying a number of stored visited states after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_visited = xbt_cfg_get_int(_sg_cfg_set, name);
+  _sg_mc_visited = xbt_cfg_get_int(name);
 }
 
 void _mc_cfg_cb_dot_output(const char *name, int pos)
@@ -165,7 +164,7 @@ void _mc_cfg_cb_dot_output(const char *name, int pos)
     xbt_die
         ("You are specifying a file name for a dot output of graph state after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_dot_output_file = xbt_cfg_get_string(_sg_cfg_set, name);
+  _sg_mc_dot_output_file = xbt_cfg_get_string(name);
 }
 
 void _mc_cfg_cb_comms_determinism(const char *name, int pos)
@@ -174,7 +173,7 @@ void _mc_cfg_cb_comms_determinism(const char *name, int pos)
     xbt_die
         ("You are specifying a value to enable/disable the detection of determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_comms_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_comms_determinism = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_send_determinism(const char *name, int pos)
@@ -183,7 +182,7 @@ void _mc_cfg_cb_send_determinism(const char *name, int pos)
     xbt_die
         ("You are specifying a value to enable/disable the detection of send-determinism in the communications schemes after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_send_determinism = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_send_determinism = xbt_cfg_get_boolean(name);
 }
 
 void _mc_cfg_cb_termination(const char *name, int pos)
@@ -192,7 +191,7 @@ void _mc_cfg_cb_termination(const char *name, int pos)
     xbt_die
         ("You are specifying a value to enable/disable the detection of non progressive cycles after the initialization (through MSG_config?), but model-checking was not activated at config time (through bu the program was not runned under the model-checker (with simgrid-mc)). This won't work, sorry.");
 
-  _sg_mc_termination = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_mc_termination = xbt_cfg_get_boolean(name);
 }
 
 #endif
index bc81e86..adc4fd4 100644 (file)
@@ -23,7 +23,7 @@ static void MSG_exit(void);
 
 static void _sg_cfg_cb_msg_debug_multiple_use(const char *name, int pos)
 {
-  msg_global->debug_multiple_use = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  msg_global->debug_multiple_use = xbt_cfg_get_boolean(name);
 }
 
 static void MSG_host_create_(sg_host_t host)
@@ -45,10 +45,9 @@ void MSG_init_nocheck(int *argc, char **argv) {
 
     msg_global = xbt_new0(s_MSG_Global_t, 1);
 
-    xbt_cfg_register(&_sg_cfg_set, "msg/debug_multiple_use",
-                     "Print backtraces of both processes when there is a conflict of multiple use of a task",
-                     xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_msg_debug_multiple_use);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "msg/debug_multiple_use", "no");
+    xbt_cfg_register_boolean("msg/debug_multiple_use",
+        "Print backtraces of both processes when there is a conflict of multiple use of a task",
+        "no", _sg_cfg_cb_msg_debug_multiple_use);
 
     SIMIX_global_init(argc, argv);
 
@@ -107,7 +106,7 @@ msg_error_t MSG_main(void)
  */
 void MSG_config(const char *key, const char *value){
   xbt_assert(msg_global,"ERROR: Please call MSG_init() before using MSG_config()");
-  xbt_cfg_set_as_string(_sg_cfg_set, key, value);
+  xbt_cfg_set_as_string(key, value);
 }
 
 /** \ingroup msg_simulation
index fe5e779..20476dc 100644 (file)
@@ -47,7 +47,7 @@ void SD_init(int *argc, char **argv)
 
   surf_init(argc, argv);
 
-  xbt_cfg_setdefault_string(_sg_cfg_set, "host/model", "ptask_L07");
+  xbt_cfg_setdefault_string("host/model", "ptask_L07");
 
 #if HAVE_JEDULE
   jedule_sd_init();
@@ -69,7 +69,7 @@ void SD_init(int *argc, char **argv)
  */
 void SD_config(const char *key, const char *value){
   xbt_assert(sd_global,"ERROR: Please call SD_init() before using SD_config()");
-  xbt_cfg_set_as_string(_sg_cfg_set, key, value);
+  xbt_cfg_set_as_string(key, value);
 }
 
 /**
index 22bd446..c9bc0aa 100644 (file)
@@ -28,7 +28,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of SimGrid");
 
-xbt_cfg_t _sg_cfg_set = NULL;
 
 /* 0: beginning of time (config cannot be changed yet);
  * 1: initialized: cfg_set created (config can now be changed);
@@ -55,14 +54,14 @@ static void sg_config_cmd_line(int *argc, char **argv)
       opt = strchr(argv[i], '=');
       opt++;
 
-      xbt_cfg_set_parse(_sg_cfg_set, opt);
+      xbt_cfg_set_parse(opt);
       XBT_DEBUG("Did apply '%s' as config setting", opt);
     } else if (!strcmp(argv[i], "--version")) {
       printf("%s\n", SIMGRID_VERSION_STRING);
       shall_exit = 1;
     } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) {
       printf("Description of the configuration accepted by this simulator:\n");
-      xbt_cfg_help(_sg_cfg_set);
+      xbt_cfg_help(simgrid_config);
       printf(
           "\n"
           "Each of these configurations can be used by adding\n"
@@ -80,7 +79,7 @@ static void sg_config_cmd_line(int *argc, char **argv)
       shall_exit = 1;
     } else if (!strcmp(argv[i], "--help-aliases")) {
       printf("Here is a list of all deprecated option names, with their replacement.\n");
-      xbt_cfg_aliases(_sg_cfg_set);
+      xbt_cfg_aliases(simgrid_config);
       printf("Please consider using the recent names\n");
       shall_exit = 1;
     } else if (!strcmp(argv[i], "--help-models")) {
@@ -116,14 +115,9 @@ static void sg_config_cmd_line(int *argc, char **argv)
 /* callback of the plugin variable */
 static void _sg_cfg_cb__plugin(const char *name, int pos)
 {
-  char *val;
-
-  XBT_VERB("PLUGIN");
-  xbt_assert(_sg_cfg_init_status < 2,
-              "Cannot load a plugin after the initialization");
-
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  xbt_assert(_sg_cfg_init_status < 2, "Cannot load a plugin after the initialization");
 
+  char *val = xbt_cfg_get_string(name);
   if (!strcmp(val, "help")) {
     model_help("plugin", surf_plugin_description);
     sg_cfg_exit_early();
@@ -137,13 +131,9 @@ static void _sg_cfg_cb__plugin(const char *name, int pos)
 /* callback of the host/model variable */
 static void _sg_cfg_cb__host_model(const char *name, int pos)
 {
-  char *val;
-
-  xbt_assert(_sg_cfg_init_status < 2,
-              "Cannot change the model after the initialization");
-
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
+  char *val = xbt_cfg_get_string(name);
   if (!strcmp(val, "help")) {
     model_help("host", surf_host_model_description);
     sg_cfg_exit_early();
@@ -156,13 +146,9 @@ static void _sg_cfg_cb__host_model(const char *name, int pos)
 /* callback of the vm/model variable */
 static void _sg_cfg_cb__vm_model(const char *name, int pos)
 {
-  char *val;
-
-  xbt_assert(_sg_cfg_init_status < 2,
-              "Cannot change the model after the initialization");
-
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
+  char *val = xbt_cfg_get_string(name);
   if (!strcmp(val, "help")) {
     model_help("vm", surf_vm_model_description);
     sg_cfg_exit_early();
@@ -175,13 +161,9 @@ static void _sg_cfg_cb__vm_model(const char *name, int pos)
 /* callback of the cpu/model variable */
 static void _sg_cfg_cb__cpu_model(const char *name, int pos)
 {
-  char *val;
-
-  xbt_assert(_sg_cfg_init_status < 2,
-              "Cannot change the model after the initialization");
-
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
+  char *val = xbt_cfg_get_string(name);
   if (!strcmp(val, "help")) {
     model_help("CPU", surf_cpu_model_description);
     sg_cfg_exit_early();
@@ -199,7 +181,7 @@ static void _sg_cfg_cb__optimization_mode(const char *name, int pos)
   xbt_assert(_sg_cfg_init_status < 2,
               "Cannot change the model after the initialization");
 
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  val = xbt_cfg_get_string(name);
 
   if (!strcmp(val, "help")) {
     model_help("optimization", surf_optimization_mode_description);
@@ -218,7 +200,7 @@ static void _sg_cfg_cb__storage_mode(const char *name, int pos)
   xbt_assert(_sg_cfg_init_status < 2,
               "Cannot change the model after the initialization");
 
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  val = xbt_cfg_get_string(name);
 
   if (!strcmp(val, "help")) {
     model_help("storage", surf_storage_model_description);
@@ -237,7 +219,7 @@ static void _sg_cfg_cb__network_model(const char *name, int pos)
   xbt_assert(_sg_cfg_init_status < 2,
               "Cannot change the model after the initialization");
 
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  val = xbt_cfg_get_string(name);
 
   if (!strcmp(val, "help")) {
     model_help("network", surf_network_model_description);
@@ -251,37 +233,37 @@ static void _sg_cfg_cb__network_model(const char *name, int pos)
 /* callbacks of the network models values */
 static void _sg_cfg_cb__tcp_gamma(const char *name, int pos)
 {
-  sg_tcp_gamma = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_tcp_gamma = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__maxmin_precision(const char* name, int pos)
 {
-  sg_maxmin_precision = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_maxmin_precision = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__surf_precision(const char* name, int pos)
 {
-  sg_surf_precision = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_surf_precision = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__sender_gap(const char* name, int pos)
 {
-  sg_sender_gap = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_sender_gap = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__latency_factor(const char *name, int pos)
 {
-  sg_latency_factor = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_latency_factor = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__bandwidth_factor(const char *name, int pos)
 {
-  sg_bandwidth_factor = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_bandwidth_factor = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__weight_S(const char *name, int pos)
 {
-  sg_weight_S_parameter = xbt_cfg_get_double(_sg_cfg_set, name);
+  sg_weight_S_parameter = xbt_cfg_get_double(name);
 }
 
 #if HAVE_SMPI
@@ -295,7 +277,7 @@ static void _sg_cfg_cb__coll(const char *category,
   xbt_assert(_sg_cfg_init_status < 2,
               "Cannot change the model after the initialization");
 
-  val = xbt_cfg_get_string(_sg_cfg_set, name);
+  val = xbt_cfg_get_string(name);
 
   if (!strcmp(val, "help")) {
     coll_help(category, table);
@@ -345,15 +327,15 @@ static void _sg_cfg_cb__coll_barrier(const char *name, int pos){
 }
 
 static void _sg_cfg_cb__wtime_sleep(const char *name, int pos){
-  smpi_wtime_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
+  smpi_wtime_sleep = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__iprobe_sleep(const char *name, int pos){
-  smpi_iprobe_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
+  smpi_iprobe_sleep = xbt_cfg_get_double(name);
 }
 
 static void _sg_cfg_cb__test_sleep(const char *name, int pos){
-  smpi_test_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
+  smpi_test_sleep = xbt_cfg_get_double(name);
 }
 
 
@@ -363,7 +345,7 @@ static void _sg_cfg_cb__test_sleep(const char *name, int pos){
 /* callback of the inclusion path */
 static void _sg_cfg_cb__surf_path(const char *name, int pos)
 {
-  char *path = xbt_strdup(xbt_cfg_get_string_at(_sg_cfg_set, name, pos));
+  char *path = xbt_strdup(xbt_cfg_get_string_at(simgrid_config, name, pos));
   xbt_dynar_push(surf_path, &path);
 }
 
@@ -376,12 +358,12 @@ extern int _sg_do_model_check_record;
 #endif
 
 static void _sg_cfg_cb_model_check_replay(const char *name, int pos) {
-  MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name);
+  MC_record_path = xbt_cfg_get_string(name);
 }
 
 #if HAVE_MC
 static void _sg_cfg_cb_model_check_record(const char *name, int pos) {
-  _sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_do_model_check_record = xbt_cfg_get_boolean(name);
 }
 #endif
 
@@ -389,46 +371,46 @@ extern int _sg_do_verbose_exit;
 
 static void _sg_cfg_cb_verbose_exit(const char *name, int pos)
 {
-  _sg_do_verbose_exit = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_do_verbose_exit = xbt_cfg_get_boolean(name);
 }
 
 extern int _sg_do_clean_atexit;
 
 static void _sg_cfg_cb_clean_atexit(const char *name, int pos)
 {
-  _sg_do_clean_atexit = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  _sg_do_clean_atexit = xbt_cfg_get_boolean(name);
 }
 
 static void _sg_cfg_cb_context_factory(const char *name, int pos)
 {
-  smx_context_factory_name = xbt_cfg_get_string(_sg_cfg_set, name);
+  smx_context_factory_name = xbt_cfg_get_string(name);
 }
 
 static void _sg_cfg_cb_context_stack_size(const char *name, int pos)
 {
   smx_context_stack_size_was_set = 1;
-  smx_context_stack_size = xbt_cfg_get_int(_sg_cfg_set, name) * 1024;
+  smx_context_stack_size = xbt_cfg_get_int(name) * 1024;
 }
 
 static void _sg_cfg_cb_context_guard_size(const char *name, int pos)
 {
   smx_context_guard_size_was_set = 1;
-  smx_context_guard_size = xbt_cfg_get_int(_sg_cfg_set, name) * xbt_pagesize;
+  smx_context_guard_size = xbt_cfg_get_int(name) * xbt_pagesize;
 }
 
 static void _sg_cfg_cb_contexts_nthreads(const char *name, int pos)
 {
-  SIMIX_context_set_nthreads(xbt_cfg_get_int(_sg_cfg_set, name));
+  SIMIX_context_set_nthreads(xbt_cfg_get_int(name));
 }
 
 static void _sg_cfg_cb_contexts_parallel_threshold(const char *name, int pos)
 {
-  SIMIX_context_set_parallel_threshold(xbt_cfg_get_int(_sg_cfg_set, name));
+  SIMIX_context_set_parallel_threshold(xbt_cfg_get_int(name));
 }
 
 static void _sg_cfg_cb_contexts_parallel_mode(const char *name, int pos)
 {
-  const char* mode_name = xbt_cfg_get_string(_sg_cfg_set, name);
+  const char* mode_name = xbt_cfg_get_string(name);
   if (!strcmp(mode_name, "posix")) {
     SIMIX_context_set_parallel_mode(XBT_PARMAP_POSIX);
   }
@@ -448,7 +430,7 @@ static void _sg_cfg_cb__surf_network_coordinates(const char *name,
                                                  int pos)
 {
   static int already_set = 0;
-  int val = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  int val = xbt_cfg_get_boolean(name);
   if (val) {
     if (!already_set) {
       COORD_HOST_LEVEL = sg_host_extension_create(xbt_dynar_free_voidp);
@@ -463,7 +445,7 @@ static void _sg_cfg_cb__surf_network_coordinates(const char *name,
 static void _sg_cfg_cb__surf_network_crosstraffic(const char *name,
                                                   int pos)
 {
-  sg_network_crosstraffic = xbt_cfg_get_boolean(_sg_cfg_set, name);
+  sg_network_crosstraffic = xbt_cfg_get_boolean(name);
 }
 
 /* build description line with possible values */
@@ -492,149 +474,103 @@ void sg_config_init(int *argc, char **argv)
   if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */
 
     /* Plugins configuration */
-    describe_model(description, surf_plugin_description,
-                   "plugin", "The plugins");
-    xbt_cfg_register(&_sg_cfg_set, "plugin", description,
-                     xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__plugin);
+    describe_model(description, surf_plugin_description, "plugin", "The plugins");
+    xbt_cfg_register(&simgrid_config, "plugin", description, xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__plugin);
 
     describe_model(description, surf_cpu_model_description, "model", "The model to use for the CPU");
-    xbt_cfg_register_string(&_sg_cfg_set, "cpu/model", description, "Cas01", &_sg_cfg_cb__cpu_model);
+    xbt_cfg_register_string("cpu/model", description, "Cas01", &_sg_cfg_cb__cpu_model);
 
     describe_model(description, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the CPU");
-    xbt_cfg_register_string(&_sg_cfg_set, "cpu/optim", description, "Lazy", &_sg_cfg_cb__optimization_mode);
+    xbt_cfg_register_string("cpu/optim", description, "Lazy", &_sg_cfg_cb__optimization_mode);
 
     describe_model(description, surf_storage_model_description, "model", "The model to use for the storage");
-    xbt_cfg_register_string(&_sg_cfg_set, "storage/model", description, "default", &_sg_cfg_cb__storage_mode);
+    xbt_cfg_register_string("storage/model", description, "default", &_sg_cfg_cb__storage_mode);
 
     describe_model(description, surf_network_model_description, "model", "The model to use for the network");
-    xbt_cfg_register_string(&_sg_cfg_set, "network/model", description, "LV08", &_sg_cfg_cb__network_model);
+    xbt_cfg_register_string("network/model", description, "LV08", &_sg_cfg_cb__network_model);
 
     describe_model(description, surf_optimization_mode_description, "optimization mode", "The optimization modes to use for the network");
-    xbt_cfg_register_string(&_sg_cfg_set, "network/optim", description, "Lazy", &_sg_cfg_cb__optimization_mode);
+    xbt_cfg_register_string("network/optim", description, "Lazy", &_sg_cfg_cb__optimization_mode);
 
     describe_model(description, surf_host_model_description, "model", "The model to use for the host");
-    xbt_cfg_register_string(&_sg_cfg_set, "host/model", description, "default", &_sg_cfg_cb__host_model);
+    xbt_cfg_register_string("host/model", description, "default", &_sg_cfg_cb__host_model);
 
     describe_model(description, surf_vm_model_description, "model", "The model to use for the vm");
-    xbt_cfg_register_string(&_sg_cfg_set, "vm/model", description, "default", &_sg_cfg_cb__vm_model);
+    xbt_cfg_register_string("vm/model", description, "default", &_sg_cfg_cb__vm_model);
 
-    xbt_cfg_register_double(&_sg_cfg_set, "network/TCP_gamma",
+    xbt_cfg_register_double("network/TCP_gamma",
         "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; Use the last given value, which is the max window size)",
         4194304.0, _sg_cfg_cb__tcp_gamma);
 
-    xbt_cfg_register_double(&_sg_cfg_set, "surf/precision", "Numerical precision used when updating simulation times (in seconds)",
+    xbt_cfg_register_double("surf/precision", "Numerical precision used when updating simulation times (in seconds)",
         0.00001, _sg_cfg_cb__surf_precision);
 
-    xbt_cfg_register_double(&_sg_cfg_set, "maxmin/precision",
+    xbt_cfg_register_double("maxmin/precision",
         "Numerical precision used when computing resource sharing (in ops/sec or bytes/sec)",
         0.00001, _sg_cfg_cb__maxmin_precision);
 
     /* The parameters of network models */
 
-    xbt_cfg_register_double(&_sg_cfg_set, "network/sender_gap", "Minimum gap between two overlapping sends",
-        NAN, _sg_cfg_cb__sender_gap); /* real default for "network/sender_gap" is set in network_smpi.cpp */
-    xbt_cfg_register_double(&_sg_cfg_set, "network/latency_factor",
-        "Correction factor to apply to the provided latency (default value set by network model)",
+    xbt_cfg_register_double("network/sender_gap", "Minimum gap between two overlapping sends", NAN, _sg_cfg_cb__sender_gap); /* real default for "network/sender_gap" is set in network_smpi.cpp */
+    xbt_cfg_register_double("network/latency_factor", "Correction factor to apply to the provided latency (default value set by network model)",
         1.0, _sg_cfg_cb__latency_factor);
-    xbt_cfg_register_double(&_sg_cfg_set, "network/bandwidth_factor",
-        "Correction factor to apply to the provided bandwidth (default value set by network model)",
+    xbt_cfg_register_double("network/bandwidth_factor", "Correction factor to apply to the provided bandwidth (default value set by network model)",
         1.0, _sg_cfg_cb__bandwidth_factor);
-    xbt_cfg_register_double(&_sg_cfg_set, "network/weight_S",
+    xbt_cfg_register_double("network/weight_S",
         "Correction factor to apply to the weight of competing streams (default value set by network model)",
         NAN, _sg_cfg_cb__weight_S); /* real default for "network/weight_S" is set in network_*.cpp */
 
     /* Inclusion path */
-    xbt_cfg_register(&_sg_cfg_set, "path",
-                     "Lookup path for inclusions in platform and deployment XML files",
+    xbt_cfg_register(&simgrid_config, "path", "Lookup path for inclusions in platform and deployment XML files",
                      xbt_cfgelm_string, 1, 0, _sg_cfg_cb__surf_path);
 
-    xbt_cfg_register_boolean(&_sg_cfg_set, "cpu/maxmin_selective_update",
+    xbt_cfg_register_boolean("cpu/maxmin_selective_update",
         "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
         "no", NULL);
-    xbt_cfg_register_boolean(&_sg_cfg_set, "network/maxmin_selective_update",
+    xbt_cfg_register_boolean("network/maxmin_selective_update",
         "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
         "no", NULL);
     /* Replay (this part is enabled even if MC it disabled) */
-    xbt_cfg_register(&_sg_cfg_set, "model-check/replay",
-      "Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay);
+    xbt_cfg_register(&simgrid_config, "model-check/replay", "Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay);
 
 #if HAVE_MC
     /* do model-checking-record */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/record", "Record the model-checking paths",
-        "no", _sg_cfg_cb_model_check_record);
+    xbt_cfg_register_boolean("model-check/record", "Record the model-checking paths", "no", _sg_cfg_cb_model_check_record);
 
-    /* do stateful model-checking */
-    xbt_cfg_register_int(&_sg_cfg_set, "model-check/checkpoint",
+    xbt_cfg_register_int("model-check/checkpoint",
                      "Specify the amount of steps between checkpoints during stateful model-checking (default: 0 => stateless verification). "
                      "If value=1, one checkpoint is saved for each step => faster verification, but huge memory consumption; higher values are good compromises between speed and memory consumption.",
                      0, _mc_cfg_cb_checkpoint);
 
-    /* do stateful model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/sparse_checkpoint", "Use sparse per-page snapshots.",
-        "no", _mc_cfg_cb_sparse_checkpoint);
-
-    /* do stateful model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/soft-dirty", "Use sparse per-page snapshots.",
-        "no", _mc_cfg_cb_soft_dirty);
-
-    xbt_cfg_register(&_sg_cfg_set, "model-check/ksm",
-                     "Kernel same-page merging",
-                     xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_ksm);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/ksm", "no");
+    xbt_cfg_register_boolean("model-check/sparse_checkpoint", "Use sparse per-page snapshots.", "no", _mc_cfg_cb_sparse_checkpoint);
+    xbt_cfg_register_boolean("model-check/soft-dirty", "Use sparse per-page snapshots.", "no", _mc_cfg_cb_soft_dirty);
+    xbt_cfg_register_boolean("model-check/ksm", "Kernel same-page merging", "no", _mc_cfg_cb_ksm);
 
-    /* do liveness model-checking */
-    xbt_cfg_register(&_sg_cfg_set, "model-check/property",
-                     "Specify the name of the file containing the property. It must be the result of the ltl2ba program.",
-                     xbt_cfgelm_string, 1, 1, _mc_cfg_cb_property);
-    xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/property", "");
+    xbt_cfg_register_string("model-check/property", "Name of the file containing the property, as formated by the ltl2ba program.",
+        "", _mc_cfg_cb_property);
 
-    /* do communications determinism model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/communications_determinism",
-        "Enable/disable the detection of determinism in the communications schemes", "no", _mc_cfg_cb_comms_determinism);
+    xbt_cfg_register_boolean("model-check/communications_determinism",
+        "Whether to enable the detection of communication determinism", "no", _mc_cfg_cb_comms_determinism);
 
-    /* do send determinism model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/send_determinism",
+    xbt_cfg_register_boolean("model-check/send_determinism",
         "Enable/disable the detection of send-determinism in the communications schemes", "no", _mc_cfg_cb_send_determinism);
 
     /* Specify the kind of model-checking reduction */
-    xbt_cfg_register_string(&_sg_cfg_set, "model-check/reduction", "Specify the kind of exploration reduction (either none or DPOR)",
-                     "dpor", _mc_cfg_cb_reduce);
-
-    /* Enable/disable timeout for wait requests with model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/timeout", "Enable/Disable timeout for wait requests", "no",
-        _mc_cfg_cb_timeout);
-
-    /* Enable/disable global hash computation with model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/hash", "Enable/Disable state hash for state comparison (experimental)", "no",
-        _mc_cfg_cb_hash);
-
-    /* Set max depth exploration */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/snapshot_fds", "Whether file descriptors must be snapshoted (currently unusable)", "no",
-        _mc_cfg_cb_snapshot_fds);
-
-    /* Set max depth exploration */
-    xbt_cfg_register_int(&_sg_cfg_set, "model-check/max_depth", "Specify the max depth of exploration (default: 1000)", 1000,
-                     _mc_cfg_cb_max_depth);
-
-    /* Set number of visited state stored for state comparison reduction*/
-    xbt_cfg_register_int(&_sg_cfg_set, "model-check/visited",
-                     "Specify the number of visited state stored for state comparison reduction. If value=5, the last 5 visited states are stored",
-                     0, _mc_cfg_cb_visited);
-
-    /* Set file name for dot output of graph state */
-    xbt_cfg_register_string(&_sg_cfg_set, "model-check/dot_output",
-                     "Specify the name of dot file corresponding to graph state",
-                     "", _mc_cfg_cb_dot_output);
-
-     /* Enable/disable non progressive cycles detection with model-checking */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "model-check/termination",
-                     "Enable/Disable non progressive cycle detection",
-                     "no", _mc_cfg_cb_termination);
+    xbt_cfg_register_string("model-check/reduction", "Specify the kind of exploration reduction (either none or DPOR)", "dpor", _mc_cfg_cb_reduce);
+    xbt_cfg_register_boolean("model-check/timeout", "Whether to enable timeouts for wait requests", "no",  _mc_cfg_cb_timeout);
+
+    xbt_cfg_register_boolean("model-check/hash", "Whether to enable state hash for state comparison (experimental)", "no", _mc_cfg_cb_hash);
+    xbt_cfg_register_boolean("model-check/snapshot_fds", "Whether file descriptors must be snapshoted (currently unusable)", "no",  _mc_cfg_cb_snapshot_fds);
+    xbt_cfg_register_int("model-check/max_depth", "Maximal exploration depth (default: 1000)", 1000, _mc_cfg_cb_max_depth);
+    xbt_cfg_register_int("model-check/visited",
+        "Specify the number of visited state stored for state comparison reduction. If value=5, the last 5 visited states are stored. If value=0 (the default), all states are stored.",
+        0, _mc_cfg_cb_visited);
+
+    xbt_cfg_register_string("model-check/dot_output", "Name of dot output file corresponding to graph state", "", _mc_cfg_cb_dot_output);
+    xbt_cfg_register_boolean("model-check/termination", "Whether to enable non progressive cycle detection", "no", _mc_cfg_cb_termination);
 #endif
 
-    /* do verbose-exit */
-    xbt_cfg_register_boolean(&_sg_cfg_set, "verbose-exit", "Activate the \"do nothing\" mode in Ctrl-C",
-                     "yes", _sg_cfg_cb_verbose_exit);
+    xbt_cfg_register_boolean("verbose-exit", "Activate the \"do nothing\" mode in Ctrl-C", "yes", _sg_cfg_cb_verbose_exit);
 
     /* context factory */
     const char *dflt_ctx_fact = "thread";
@@ -653,55 +589,43 @@ void sg_config_init(int *argc, char **argv)
 #endif
       sprintf(p, ".");
     }
-    xbt_cfg_register_string(&_sg_cfg_set, "contexts/factory", description, dflt_ctx_fact, _sg_cfg_cb_context_factory);
+    xbt_cfg_register_string("contexts/factory", description, dflt_ctx_fact, _sg_cfg_cb_context_factory);
 
-    /* stack size of contexts in KiB */
-    xbt_cfg_register_int(&_sg_cfg_set, "contexts/stack_size", "Stack size of contexts in KiB",
-                     8*1024, _sg_cfg_cb_context_stack_size);
+    xbt_cfg_register_int("contexts/stack_size", "Stack size of contexts in KiB", 8*1024, _sg_cfg_cb_context_stack_size);
     /* (FIXME: this is unpleasant) Reset this static variable that was altered when setting the default value. */
     smx_context_stack_size_was_set = 0;
 
     /* guard size for contexts stacks in memory pages */
-    xbt_cfg_register(&_sg_cfg_set, "contexts/guard_size",
-                     "Guard size for contexts stacks in memory pages",
-                     xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_guard_size);
+    xbt_cfg_register_int("contexts/guard_size", "Guard size for contexts stacks in memory pages",
 #if defined(_WIN32) || (PTH_STACKGROWTH != -1)
-    xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 0);
+        0, _sg_cfg_cb_context_guard_size);
 #else
-    xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 1);
+        1, _sg_cfg_cb_context_guard_size);
 #endif
     /* No, it was not set yet (the above setdefault() changed this to 1). */
     smx_context_guard_size_was_set = 0;
 
-    /* number of parallel threads for user processes */
-    xbt_cfg_register_int(&_sg_cfg_set, "contexts/nthreads",
-                     "Number of parallel threads used to execute user contexts",
-                     1, _sg_cfg_cb_contexts_nthreads);
+    xbt_cfg_register_int("contexts/nthreads", "Number of parallel threads used to execute user contexts", 1, _sg_cfg_cb_contexts_nthreads);
 
-    /* minimal number of user contexts to be run in parallel */
-    xbt_cfg_register_int(&_sg_cfg_set, "contexts/parallel_threshold",
-                     "Minimal number of user contexts to be run in parallel (raw contexts only)",
-                     2, _sg_cfg_cb_contexts_parallel_threshold);
+    xbt_cfg_register_int("contexts/parallel_threshold", "Minimal number of user contexts to be run in parallel (raw contexts only)",
+        2, _sg_cfg_cb_contexts_parallel_threshold);
 
     /* synchronization mode for parallel user contexts */
-    xbt_cfg_register_string(&_sg_cfg_set, "contexts/synchro",
-                     "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
+    xbt_cfg_register_string("contexts/synchro", "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
 #if HAVE_FUTEX_H
     "futex",     _sg_cfg_cb_contexts_parallel_mode);
 #else //No futex on mac and posix is unimplememted yet
     "busy_wait", _sg_cfg_cb_contexts_parallel_mode);
 #endif
 
-    xbt_cfg_register_boolean(&_sg_cfg_set, "network/coordinates",
-                     "\"yes\" or \"no\", specifying whether we use a coordinate-based routing (as Vivaldi)",
-                     "no", _sg_cfg_cb__surf_network_coordinates);
+    xbt_cfg_register_boolean("network/coordinates", "Whether we use a coordinate-based routing (as Vivaldi)",
+        "no", _sg_cfg_cb__surf_network_coordinates);
 
-    xbt_cfg_register_boolean(&_sg_cfg_set, "network/crosstraffic",
-                     "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)",
-                     "yes", _sg_cfg_cb__surf_network_crosstraffic);
+    xbt_cfg_register_boolean("network/crosstraffic", "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)",
+        "yes", _sg_cfg_cb__surf_network_crosstraffic);
 
 #if HAVE_NS3
-    xbt_cfg_register_string(&_sg_cfg_set, "ns3/TcpModel", "The ns3 tcp model can be : NewReno or Reno or Tahoe", "default", NULL);
+    xbt_cfg_register_string("ns3/TcpModel", "The ns3 tcp model can be : NewReno or Reno or Tahoe", "default", NULL);
 #endif
 
     //For smpi/bw_factor and smpi/lat_factor
@@ -710,140 +634,86 @@ void sg_config_init(int *argc, char **argv)
     //Values can be modified with command line --cfg=smpi/bw_factor:"threshold0:value0;threshold1:value1;...;thresholdN:valueN"
     //  or with tag config put line <prop id="smpi/bw_factor" value="threshold0:value0;threshold1:value1;...;thresholdN:valueN"></prop>
     // SMPI model can be used without enable_smpi, so keep this out of the ifdef.
-    xbt_cfg_register_string(&_sg_cfg_set, "smpi/bw_factor", "Bandwidth factors for smpi.",
+    xbt_cfg_register_string("smpi/bw_factor", "Bandwidth factors for smpi.",
         "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084", NULL);
 
-    xbt_cfg_register_string(&_sg_cfg_set, "smpi/lat_factor", "Latency factors for smpi.",
+    xbt_cfg_register_string("smpi/lat_factor", "Latency factors for smpi.",
         "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467", NULL);
     
-    xbt_cfg_register_string(&_sg_cfg_set, "smpi/IB_penalty_factors",
+    xbt_cfg_register_string("smpi/IB_penalty_factors",
         "Correction factor to communications using Infiniband model with contention (default value based on Stampede cluster profiling)",
         "0.965;0.925;1.35", NULL);
     
 #if HAVE_SMPI
-    xbt_cfg_register_double(&_sg_cfg_set, "smpi/running_power",
-        "Power of the host running the simulation (in flop/s). Used to bench the operations.", 20000.0, NULL);
-
-    xbt_cfg_register_boolean(&_sg_cfg_set, "smpi/display_timing",
-        "Boolean indicating whether we should display the timing after simulation.", "no", NULL);
-
-    xbt_cfg_register_boolean(&_sg_cfg_set, "smpi/simulate_computation",
-        "Boolean indicating whether the computational part of the simulated application should be simulated.", "yes", NULL);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/use_shared_malloc",
-                     "Boolean indicating whether we should use shared memory when using SMPI_SHARED_MALLOC. Allows user to disable it for debug purposes.",
-                     xbt_cfgelm_boolean, 1, 1, NULL);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/use_shared_malloc", "yes");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/cpu_threshold",
-                     "Minimal computation time (in seconds) not discarded, or -1 for infinity.",
-                     xbt_cfgelm_double, 1, 1, NULL);
-    xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/cpu_threshold", 1e-6);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/async_small_thresh",
-                     "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver",
-                     xbt_cfgelm_int, 1, 1, NULL);
-    xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thresh", 0);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thresh",
-                     "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend",
-                     xbt_cfgelm_int, 1, 1, NULL);
-    xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thresh", 65536);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/privatize_global_variables",
-                     "Boolean indicating whether we should privatize global variable at runtime.",
-                     xbt_cfgelm_boolean, 1, 1, NULL);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/privatize_global_variables", "no");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/os",
-                     "Small messages timings (MPI_Send minimum time for small messages)",
-                     xbt_cfgelm_string, 1, 1, NULL);
-    xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/os", "1:0:0:0:0");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/ois",
-                     "Small messages timings (MPI_Isend minimum time for small messages)",
-                     xbt_cfgelm_string, 1, 1, NULL);
-    xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/ois", "1:0:0:0:0");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/or",
-                     "Small messages timings (MPI_Recv minimum time for small messages)",
-                     xbt_cfgelm_string, 1, 1, NULL);
-    xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/or", "1:0:0:0:0");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/iprobe",
-                     "Minimum time to inject inside a call to MPI_Iprobe",
-                     xbt_cfgelm_double, 1, 1, _sg_cfg_cb__iprobe_sleep);
-    xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/iprobe", 1e-4);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/test",
-                     "Minimum time to inject inside a call to MPI_Test",
-                     xbt_cfgelm_double, 1, 1, _sg_cfg_cb__test_sleep);
-    xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/test", 1e-4);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/wtime",
-                     "Minimum time to inject inside a call to MPI_Wtime",
-                     xbt_cfgelm_double, 1, 1, _sg_cfg_cb__wtime_sleep);
-    xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/wtime", 0.0);
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/coll_selector",
-                     "Which collective selector to use",
-                     xbt_cfgelm_string, 1, 1, NULL);
-    xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/coll_selector", "default");
-
-    xbt_cfg_register(&_sg_cfg_set, "smpi/gather",
+    xbt_cfg_register_double("smpi/running_power", "Power of the host running the simulation (in flop/s). Used to bench the operations.", 20000.0, NULL);
+    xbt_cfg_register_boolean("smpi/display_timing", "Whether we should display the timing after simulation.", "no", NULL);
+    xbt_cfg_register_boolean("smpi/simulate_computation", "Whether the computational part of the simulated application should be simulated.", "yes", NULL);
+    xbt_cfg_register_boolean("smpi/use_shared_malloc", "Whether SMPI_SHARED_MALLOC is enabled. Disable it for debugging purposes.", "yes", NULL);
+    xbt_cfg_register_double("smpi/cpu_threshold", "Minimal computation time (in seconds) not discarded, or -1 for infinity.", 1e-6, NULL);
+    xbt_cfg_register_int("smpi/async_small_thresh", "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver",
+        0, NULL);
+    xbt_cfg_register_int("smpi/send_is_detached_thresh", "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend",
+        65536, NULL);
+
+    xbt_cfg_register_boolean("smpi/privatize_global_variables", "Whether we should privatize global variable at runtime.", "no", NULL);
+    xbt_cfg_register_string("smpi/os",  "Small messages timings (MPI_Send minimum time for small messages)", "1:0:0:0:0", NULL);
+    xbt_cfg_register_string("smpi/ois", "Small messages timings (MPI_Isend minimum time for small messages)", "1:0:0:0:0", NULL);
+    xbt_cfg_register_string("smpi/or",  "Small messages timings (MPI_Recv minimum time for small messages)", "1:0:0:0:0", NULL);
+    xbt_cfg_register_double("smpi/iprobe", "Minimum time to inject inside a call to MPI_Iprobe", 1e-4, _sg_cfg_cb__iprobe_sleep);
+    xbt_cfg_register_double("smpi/test", "Minimum time to inject inside a call to MPI_Test", 1e-4, _sg_cfg_cb__test_sleep);
+    xbt_cfg_register_double("smpi/wtime", "Minimum time to inject inside a call to MPI_Wtime", 0.0, _sg_cfg_cb__wtime_sleep);
+
+    xbt_cfg_register_string("smpi/coll_selector", "Which collective selector to use", "default", NULL);
+
+    xbt_cfg_register(&simgrid_config, "smpi/gather",
                      "Which collective to use for gather",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_gather);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/allgather",
+    xbt_cfg_register(&simgrid_config, "smpi/allgather",
                      "Which collective to use for allgather",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgather);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/barrier",
+    xbt_cfg_register(&simgrid_config, "smpi/barrier",
                      "Which collective to use for barrier",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_barrier);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/reduce_scatter",
+    xbt_cfg_register(&simgrid_config, "smpi/reduce_scatter",
                      "Which collective to use for reduce_scatter",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce_scatter);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/scatter",
+    xbt_cfg_register(&simgrid_config, "smpi/scatter",
                      "Which collective to use for scatter",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_scatter);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv",
+    xbt_cfg_register(&simgrid_config, "smpi/allgatherv",
                      "Which collective to use for allgatherv",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgatherv);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/allreduce",
+    xbt_cfg_register(&simgrid_config, "smpi/allreduce",
                      "Which collective to use for allreduce",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allreduce);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/alltoall",
+    xbt_cfg_register(&simgrid_config, "smpi/alltoall",
                      "Which collective to use for alltoall",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoall);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/alltoallv",
+    xbt_cfg_register(&simgrid_config, "smpi/alltoallv",
                      "Which collective to use for alltoallv",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoallv);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/bcast",
+    xbt_cfg_register(&simgrid_config, "smpi/bcast",
                      "Which collective to use for bcast",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_bcast);
 
-    xbt_cfg_register(&_sg_cfg_set, "smpi/reduce",
+    xbt_cfg_register(&simgrid_config, "smpi/reduce",
                      "Which collective to use for reduce",
                      xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce);
 #endif // HAVE_SMPI
 
-    xbt_cfg_register(&_sg_cfg_set, "exception/cutpath",
-                     "\"yes\" or \"no\". \"yes\" will cut all path information from call traces, used e.g. in exceptions.",
-                     xbt_cfgelm_boolean, 1, 1, NULL);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "exception/cutpath", "no");
+    xbt_cfg_register_boolean("exception/cutpath", "Whether to cut all path information from call traces, used e.g. in exceptions.", "no", NULL);
 
-    xbt_cfg_register(&_sg_cfg_set, "clean_atexit",
-                     "\"yes\" or \"no\". \"yes\" enables all the cleanups of SimGrid (XBT,SIMIX,MSG) to be registered with atexit. \"no\" may be useful if your code segfaults when calling the exit function.",
-                     xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_clean_atexit);
-    xbt_cfg_setdefault_boolean(_sg_cfg_set, "clean_atexit", "yes");
+    xbt_cfg_register_boolean("clean_atexit", "Whether to cleanup SimGrid (XBT,SIMIX,MSG) at exit. Disable it if your code segfaults at ending.",
+                     "yes", _sg_cfg_cb_clean_atexit);
 
     if (!surf_path) {
       /* retrieves the current directory of the current process */
@@ -851,10 +721,10 @@ void sg_config_init(int *argc, char **argv)
       xbt_assert((initial_path), "__surf_get_initial_path() failed! Can't resolve current Windows directory");
 
       surf_path = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
-      xbt_cfg_setdefault_string(_sg_cfg_set, "path", initial_path);
+      xbt_cfg_setdefault_string("path", initial_path);
     }
 
-    xbt_cfg_check(_sg_cfg_set);
+    xbt_cfg_check();
     _sg_cfg_init_status = 1;
 
     sg_config_cmd_line(argc, argv);
@@ -870,36 +740,36 @@ void sg_config_finalize(void)
   if (!_sg_cfg_init_status)
     return;                     /* Not initialized yet. Nothing to do */
 
-  xbt_cfg_free(&_sg_cfg_set);
+  xbt_cfg_free(&simgrid_config);
   _sg_cfg_init_status = 0;
 }
 
 int sg_cfg_is_default_value(const char *name)
 {
-  return xbt_cfg_is_default_value(_sg_cfg_set, name);
+  return xbt_cfg_is_default_value(name);
 }
 
 int sg_cfg_get_int(const char* name)
 {
-  return xbt_cfg_get_int(_sg_cfg_set, name);
+  return xbt_cfg_get_int(name);
 }
 
 double sg_cfg_get_double(const char* name)
 {
-  return xbt_cfg_get_double(_sg_cfg_set, name);
+  return xbt_cfg_get_double(name);
 }
 
 char* sg_cfg_get_string(const char* name)
 {
-  return xbt_cfg_get_string(_sg_cfg_set, name);
+  return xbt_cfg_get_string(name);
 }
 
 int sg_cfg_get_boolean(const char* name)
 {
-  return xbt_cfg_get_boolean(_sg_cfg_set, name);
+  return xbt_cfg_get_boolean(name);
 }
 
 xbt_dynar_t sg_cfg_get_dynar(const char* name)
 {
-  return xbt_cfg_get_dynar(_sg_cfg_set, name);
+  return xbt_cfg_get_dynar(name);
 }
index 0469a17..9c1caf4 100644 (file)
@@ -19,7 +19,7 @@ void surf_cpu_model_init_Cas01()
   xbt_assert(!surf_cpu_model_pm);
   xbt_assert(!surf_cpu_model_vm);
 
-  char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
+  char *optim = xbt_cfg_get_string("cpu/optim");
   if (!strcmp(optim, "TI")) {
     surf_cpu_model_init_ti();
     return;
@@ -37,8 +37,8 @@ namespace surf {
 
 CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
 {
-  char *optim = xbt_cfg_get_string(_sg_cfg_set, "cpu/optim");
-  int select = xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update");
+  char *optim = xbt_cfg_get_string("cpu/optim");
+  int select = xbt_cfg_get_boolean("cpu/maxmin_selective_update");
 
   if (!strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
@@ -47,9 +47,7 @@ CpuCas01Model::CpuCas01Model() : simgrid::surf::CpuModel()
     updateMechanism_ = UM_LAZY;
     selectiveUpdate_ = 1;
     xbt_assert((select == 1)
-               ||
-               (xbt_cfg_is_default_value
-                (_sg_cfg_set, "cpu/maxmin_selective_update")),
+               || (xbt_cfg_is_default_value("cpu/maxmin_selective_update")),
                "Disabling selective update while using the lazy update mechanism is dumb!");
   } else {
     xbt_die("Unsupported optimization (%s) for this model", optim);
index c240e0e..42e6792 100644 (file)
@@ -27,7 +27,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
 void surf_host_model_init_current_default(void)
 {
   surf_host_model = new simgrid::surf::HostCLM03Model();
-  xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
+  xbt_cfg_setdefault_boolean("network/crosstraffic", "yes");
   surf_cpu_model_init_Cas01();
   surf_network_model_init_LegrandVelho();
 
index 839cea3..cbdf472 100644 (file)
@@ -43,9 +43,9 @@ void surf_network_model_init_LegrandVelho(void)
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",      13.01);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",     0.97);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         20537);
+  xbt_cfg_setdefault_double("network/latency_factor",      13.01);
+  xbt_cfg_setdefault_double("network/bandwidth_factor",     0.97);
+  xbt_cfg_setdefault_double("network/weight_S",         20537);
 }
 
 /***************************************************************************/
@@ -68,9 +68,9 @@ void surf_network_model_init_CM02(void)
   surf_network_model = new simgrid::surf::NetworkCm02Model();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",   1.0);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 1.0);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         0.0);
+  xbt_cfg_setdefault_double("network/latency_factor",   1.0);
+  xbt_cfg_setdefault_double("network/bandwidth_factor", 1.0);
+  xbt_cfg_setdefault_double("network/weight_S",         0.0);
 }
 
 /***************************************************************************/
@@ -94,9 +94,9 @@ void surf_network_model_init_Reno(void)
   lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",     10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",    0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",         8775);
+  xbt_cfg_setdefault_double("network/latency_factor",     10.4);
+  xbt_cfg_setdefault_double("network/bandwidth_factor",    0.92);
+  xbt_cfg_setdefault_double("network/weight_S",         8775);
 }
 
 
@@ -111,9 +111,9 @@ void surf_network_model_init_Reno2(void)
   lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",    10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",   0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",        8775);
+  xbt_cfg_setdefault_double("network/latency_factor",    10.4);
+  xbt_cfg_setdefault_double("network/bandwidth_factor",   0.92);
+  xbt_cfg_setdefault_double("network/weight_S",        8775);
 }
 
 void surf_network_model_init_Vegas(void)
@@ -127,9 +127,9 @@ void surf_network_model_init_Vegas(void)
   lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi);
   surf_network_model->f_networkSolve = lagrange_solve;
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",    10.4);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor",   0.92);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S",        8775);
+  xbt_cfg_setdefault_double("network/latency_factor",    10.4);
+  xbt_cfg_setdefault_double("network/bandwidth_factor",   0.92);
+  xbt_cfg_setdefault_double("network/weight_S",        8775);
 }
 
 namespace simgrid {
@@ -138,8 +138,8 @@ namespace surf {
 NetworkCm02Model::NetworkCm02Model()
   :NetworkModel()
 {
-  char *optim = xbt_cfg_get_string(_sg_cfg_set, "network/optim");
-  int select = xbt_cfg_get_boolean(_sg_cfg_set, "network/maxmin_selective_update");
+  char *optim = xbt_cfg_get_string("network/optim");
+  int select = xbt_cfg_get_boolean("network/maxmin_selective_update");
 
   if (!strcmp(optim, "Full")) {
     updateMechanism_ = UM_FULL;
@@ -147,7 +147,7 @@ NetworkCm02Model::NetworkCm02Model()
   } else if (!strcmp(optim, "Lazy")) {
     updateMechanism_ = UM_LAZY;
     selectiveUpdate_ = 1;
-    xbt_assert((select == 1) || (xbt_cfg_is_default_value(_sg_cfg_set, "network/maxmin_selective_update")),
+    xbt_assert((select == 1) || (xbt_cfg_is_default_value("network/maxmin_selective_update")),
                "Disabling selective update while using the lazy update mechanism is dumb!");
   } else {
     xbt_die("Unsupported optimization (%s) for this model", optim);
index 2fe2e3e..b39302c 100644 (file)
@@ -90,7 +90,7 @@ void surf_network_model_init_IB(void)
   networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback);
   Link::onCommunicate.connect(IB_action_init_callback);
   simgrid::s4u::Host::onCreation.connect(IB_create_host_callback);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
+  xbt_cfg_setdefault_double("network/weight_S", 8775);
 
 }
 
index cde72ac..903bdff 100644 (file)
@@ -219,7 +219,7 @@ namespace simgrid {
 namespace surf {
 
 NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
-  ns3_initialize(xbt_cfg_get_string(_sg_cfg_set, "ns3/TcpModel"));
+  ns3_initialize(xbt_cfg_get_string("ns3/TcpModel"));
 
   routing_model_create(NULL);
   simgrid::s4u::Host::onCreation.connect(ns3_add_host);
index 228390b..7899183 100644 (file)
@@ -91,8 +91,8 @@ void surf_network_model_init_SMPI(void)
   surf_network_model = new simgrid::surf::NetworkSmpiModel();
   xbt_dynar_push(all_existing_models, &surf_network_model);
 
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", 10e-6);
-  xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
+  xbt_cfg_setdefault_double("network/sender_gap", 10e-6);
+  xbt_cfg_setdefault_double("network/weight_S", 8775);
 }
 
 namespace simgrid {
index 9fa57c7..112e185 100644 (file)
@@ -725,22 +725,22 @@ static void surf_config_models_setup()
   int storage_id = -1;
   char *storage_model_name = NULL;
 
-  host_model_name = xbt_cfg_get_string(_sg_cfg_set, "host/model");
-  vm_model_name = xbt_cfg_get_string(_sg_cfg_set, "vm/model");
-  network_model_name = xbt_cfg_get_string(_sg_cfg_set, "network/model");
-  cpu_model_name = xbt_cfg_get_string(_sg_cfg_set, "cpu/model");
-  storage_model_name = xbt_cfg_get_string(_sg_cfg_set, "storage/model");
+  host_model_name    = xbt_cfg_get_string("host/model");
+  vm_model_name      = xbt_cfg_get_string("vm/model");
+  network_model_name = xbt_cfg_get_string("network/model");
+  cpu_model_name     = xbt_cfg_get_string("cpu/model");
+  storage_model_name = xbt_cfg_get_string("storage/model");
 
   /* Check whether we use a net/cpu model differing from the default ones, in which case
    * we should switch to the "compound" host model to correctly dispatch stuff to
    * the right net/cpu models.
    */
 
-  if ((!xbt_cfg_is_default_value(_sg_cfg_set, "network/model") ||
-       !xbt_cfg_is_default_value(_sg_cfg_set, "cpu/model")) &&
-      xbt_cfg_is_default_value(_sg_cfg_set, "host/model")) {
+  if ((!xbt_cfg_is_default_value("network/model") ||
+       !xbt_cfg_is_default_value("cpu/model")) &&
+      xbt_cfg_is_default_value("host/model")) {
     host_model_name = "compound";
-    xbt_cfg_set_string(_sg_cfg_set, "host/model", host_model_name);
+    xbt_cfg_set_string("host/model", host_model_name);
   }
 
   XBT_DEBUG("host model: %s", host_model_name);
index 056620d..9899cfa 100644 (file)
@@ -903,8 +903,8 @@ void ETag_surfxml_config(void){
   char *cfg;
   xbt_dict_foreach(current_property_set, cursor, key, elem) {
     cfg = bprintf("%s:%s",key,elem);
-    if(xbt_cfg_is_default_value(_sg_cfg_set, key))
-      xbt_cfg_set_parse(_sg_cfg_set, cfg);
+    if(xbt_cfg_is_default_value(key))
+      xbt_cfg_set_parse(cfg);
     else
       XBT_INFO("The custom configuration '%s' is already defined by user!",key);
     free(cfg);
index 32c07f6..9e06f58 100644 (file)
@@ -21,6 +21,8 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_cfg, xbt, "configuration support");
 
+xbt_cfg_t simgrid_config = NULL;
+
 /* xbt_cfgelm_t: the typedef corresponding to a config variable.
 
    Both data and DTD are mixed, but fixing it now would prevent me to ever defend my thesis. */
@@ -195,14 +197,13 @@ void xbt_cfgelm_free(void *data)
 void xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type, int min,
                       int max, xbt_cfg_cb_t cb_set)
 {
-  xbt_cfgelm_t res;
-
   if (*cfg == NULL)
     *cfg = xbt_cfg_new();
   xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_boolean,
               "type of %s not valid (%d should be between %d and %d)",
              name, (int)type, xbt_cfgelm_int, xbt_cfgelm_boolean);
-  res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
+
+  xbt_cfgelm_t res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name);
   xbt_assert(NULL == res, "Refusing to register the config element '%s' twice.", name);
 
   res = xbt_new(s_xbt_cfgelm_t, 1);
@@ -236,36 +237,36 @@ void xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt
   xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL);
 }
 
-void xbt_cfg_register_double(xbt_cfg_t * cfg, const char *name, const char *desc, double default_value,xbt_cfg_cb_t cb_set){
-  xbt_cfg_register(cfg,name,desc,xbt_cfgelm_double,1,1,cb_set);
-  xbt_cfg_setdefault_double(*cfg, name, default_value);
+void xbt_cfg_register_double(const char *name, const char *desc, double default_value,xbt_cfg_cb_t cb_set){
+  xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_double,1,1,cb_set);
+  xbt_cfg_setdefault_double(name, default_value);
 }
-void xbt_cfg_register_int(xbt_cfg_t * cfg, const char *name, const char *desc, int default_value,xbt_cfg_cb_t cb_set){
-  xbt_cfg_register(cfg,name,desc,xbt_cfgelm_int,1,1,cb_set);
-  xbt_cfg_setdefault_int(*cfg, name, default_value);
+void xbt_cfg_register_int(const char *name, const char *desc, int default_value,xbt_cfg_cb_t cb_set){
+  xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_int,1,1,cb_set);
+  xbt_cfg_setdefault_int(name, default_value);
 }
-void xbt_cfg_register_string(xbt_cfg_t * cfg, const char *name, const char *desc, const char *default_value, xbt_cfg_cb_t cb_set){
-  xbt_cfg_register(cfg,name,desc,xbt_cfgelm_string,1,1,cb_set);
-  xbt_cfg_setdefault_string(*cfg, name, default_value);
+void xbt_cfg_register_string(const char *name, const char *desc, const char *default_value, xbt_cfg_cb_t cb_set){
+  xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_string,1,1,cb_set);
+  xbt_cfg_setdefault_string(name, default_value);
 }
-void xbt_cfg_register_boolean(xbt_cfg_t * cfg, const char *name, const char *desc, const char*default_value,xbt_cfg_cb_t cb_set){
-  xbt_cfg_register(cfg,name,desc,xbt_cfgelm_boolean,1,1,cb_set);
-  xbt_cfg_setdefault_boolean(*cfg, name, default_value);
+void xbt_cfg_register_boolean(const char *name, const char *desc, const char*default_value,xbt_cfg_cb_t cb_set){
+  xbt_cfg_register(&simgrid_config,name,desc,xbt_cfgelm_boolean,1,1,cb_set);
+  xbt_cfg_setdefault_boolean(name, default_value);
 }
 
-void xbt_cfg_register_alias(xbt_cfg_t * cfg, const char *newname, const char *oldname)
+void xbt_cfg_register_alias(const char *newname, const char *oldname)
 {
-  if (*cfg == NULL)
-    *cfg = xbt_cfg_new();
+  if (simgrid_config == NULL)
+    simgrid_config = xbt_cfg_new();
 
-  xbt_cfgelm_t res = xbt_dict_get_or_null((xbt_dict_t) * cfg, oldname);
+  xbt_cfgelm_t res = xbt_dict_get_or_null(simgrid_config, oldname);
   xbt_assert(NULL == res, "Refusing to register the option '%s' twice.", oldname);
 
-  res = xbt_dict_get_or_null((xbt_dict_t) * cfg, newname);
+  res = xbt_dict_get_or_null(simgrid_config, newname);
   xbt_assert(res, "Cannot define an alias to the non-existing option '%s'.", newname);
 
   res = xbt_new0(s_xbt_cfgelm_t, 1);
-  XBT_DEBUG("Register cfg alias %s -> %s in set %p)",oldname,newname, *cfg);
+  XBT_DEBUG("Register cfg alias %s -> %s)",oldname,newname);
 
   res->desc = bprintf("Deprecated alias for %s",newname);
   res->type = xbt_cfgelm_alias;
@@ -274,7 +275,7 @@ void xbt_cfg_register_alias(xbt_cfg_t * cfg, const char *newname, const char *ol
   res->isdefault = 1;
   res->content = (xbt_dynar_t)newname;
 
-  xbt_dict_set((xbt_dict_t) * cfg, oldname, res, NULL);
+  xbt_dict_set(simgrid_config, oldname, res, NULL);
 }
 
 /** @brief Unregister an element from a config set.
@@ -425,21 +426,17 @@ void xbt_cfg_help(xbt_cfg_t cfg)
 }
 
 /** @brief Check that each variable have the right amount of values */
-void xbt_cfg_check(xbt_cfg_t cfg)
+void xbt_cfg_check(void)
 {
   xbt_dict_cursor_t cursor;
   xbt_cfgelm_t variable;
   char *name;
-  int size;
 
-  xbt_assert(cfg, "NULL config set.");
-  XBT_DEBUG("Check cfg set %p", cfg);
-
-  xbt_dict_foreach((xbt_dict_t) cfg, cursor, name, variable) {
+  xbt_dict_foreach((xbt_dict_t) simgrid_config, cursor, name, variable) {
     if (variable->type == xbt_cfgelm_alias)
       continue;
 
-    size = xbt_dynar_length(variable->content);
+    int size = xbt_dynar_length(variable->content);
     if (variable->min > size) {
       xbt_dict_cursor_free(&cursor);
       THROWF(mismatch_error, 0, "Config elem %s needs at least %d %s, but there is only %d values.",
@@ -535,19 +532,19 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa)
   switch (type) {
   case xbt_cfgelm_string:
     str = va_arg(pa, char *);
-    xbt_cfg_set_string(cfg, name, str);
+    xbt_cfg_set_string(name, str);
     break;
   case xbt_cfgelm_int:
     i = va_arg(pa, int);
-    xbt_cfg_set_int(cfg, name, i);
+    xbt_cfg_set_int(name, i);
     break;
   case xbt_cfgelm_double:
     d = va_arg(pa, double);
-    xbt_cfg_set_double(cfg, name, d);
+    xbt_cfg_set_double(name, d);
     break;
   case xbt_cfgelm_boolean:
     str = va_arg(pa, char *);
-    xbt_cfg_set_boolean(cfg, name, str);
+    xbt_cfg_set_boolean(name, str);
     break;
   default:
     xbt_die("Config element variable %s not valid (type=%d)", name, (int)type);
@@ -571,31 +568,26 @@ void xbt_cfg_set(xbt_cfg_t cfg, const char *name, ...)
 
 /** @brief Add values parsed from a string into a config set
  *
- * @param cfg config set to fill
  * @param options a string containing the content to add to the config set. This is a '\\t',' ' or '\\n' or ','
  * separated list of variables. Each individual variable is like "[name]:[value]" where [name] is the name of an
  * already registered variable, and [value] conforms to the data type under which this variable was registered.
  *
  * @todo This is a crude manual parser, it should be a proper lexer.
  */
-void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
-  char *optionlist_cpy;
-  char *option, *name, *val;
-  int len;
-
-  XBT_IN();
+void xbt_cfg_set_parse(const char *options)
+{
   if (!options || !strlen(options)) {   /* nothing to do */
     return;
   }
-  optionlist_cpy = xbt_strdup(options);
+  char *optionlist_cpy = xbt_strdup(options);
 
   XBT_DEBUG("List to parse and set:'%s'", options);
-  option = optionlist_cpy;
+  char *option = optionlist_cpy;
   while (1) {                   /* breaks in the code */
     if (!option)
       break;
-    name = option;
-    len = strlen(name);
+    char *name = option;
+    int len = strlen(name);
     XBT_DEBUG("Still to parse and set: '%s'. len=%d; option-name=%ld", name, len, (long) (option - name));
 
     /* Pass the value */
@@ -624,18 +616,16 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
     if (!strlen(name))
       break;
 
-    val = strchr(name, ':');
-    if (!val) {
-      /* don't free(optionlist_cpy) here, 'name' points inside it */
-      xbt_die("Option '%s' badly formatted. Should be of the form 'name:value'", name);
-    }
+    char *val = strchr(name, ':');
+    xbt_assert(val, "Option '%s' badly formatted. Should be of the form 'name:value'", name);
+    /* don't free(optionlist_cpy) if the assert fails, 'name' points inside it */
     *(val++) = '\0';
 
     if (strncmp(name, "contexts/", strlen("contexts/")) && strncmp(name, "path", strlen("path")))
       XBT_INFO("Configuration change: Set '%s' to '%s'", name, val);
 
     TRY {
-      xbt_cfg_set_as_string(cfg,name,val);
+      xbt_cfg_set_as_string(name,val);
     } CATCH_ANONYMOUS {
       free(optionlist_cpy);
       RETHROW;
@@ -646,14 +636,13 @@ void xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options) {
 
 /** @brief Set the value of a variable, using the string representation of that value
  *
- * @param cfg config set to modify
  * @param key name of the variable to modify
  * @param value string representation of the value to set
  *
  * @return the first char after the parsed value in val
  */
 
-void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
+void *xbt_cfg_set_as_string(const char *key, const char *value) {
   xbt_ex_t e;
 
   char *ret;
@@ -663,7 +652,7 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
 
   TRY {
     while (variable == NULL) {
-      variable = xbt_dict_get((xbt_dict_t) cfg, key);
+      variable = xbt_dict_get((xbt_dict_t) simgrid_config, key);
       if (variable->type == xbt_cfgelm_alias) {
         const char *newname = (const char*)variable->content;
         XBT_INFO("Note: configuration '%s' is deprecated. Please use '%s' instead.", key, newname);
@@ -681,24 +670,24 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
 
   switch (variable->type) {
   case xbt_cfgelm_string:
-    xbt_cfg_set_string(cfg, key, value);     /* throws */
+    xbt_cfg_set_string(key, value);     /* throws */
     break;
   case xbt_cfgelm_int:
     i = strtol(value, &ret, 0);
     if (ret == value) {
       xbt_die("Value of option %s not valid. Should be an integer", key);
     }
-    xbt_cfg_set_int(cfg, key, i);  /* throws */
+    xbt_cfg_set_int(key, i);  /* throws */
     break;
   case xbt_cfgelm_double:
     d = strtod(value, &ret);
     if (ret == value) {
       xbt_die("Value of option %s not valid. Should be a double", key);
     }
-    xbt_cfg_set_double(cfg, key, d);       /* throws */
+    xbt_cfg_set_double(key, d);       /* throws */
     break;
   case xbt_cfgelm_boolean:
-    xbt_cfg_set_boolean(cfg, key, value);  /* throws */
+    xbt_cfg_set_boolean(key, value);  /* throws */
     ret = (char *)value + strlen(value);
     break;
   default:
@@ -713,12 +702,12 @@ void *xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *key, const char *value) {
  * This is useful to change the default value of a variable while allowing
  * users to override it with command line arguments
  */
-void xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val)
+void xbt_cfg_setdefault_int(const char *name, int val)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_int);
 
   if (variable->isdefault){
-    xbt_cfg_set_int(cfg, name, val);
+    xbt_cfg_set_int(name, val);
     variable->isdefault = 1;
   } else
     XBT_DEBUG("Do not override configuration variable '%s' with value '%d' because it was already set.", name, val);
@@ -729,12 +718,12 @@ void xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val)
  * This is useful to change the default value of a variable while allowing
  * users to override it with command line arguments
  */
-void xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val)
+void xbt_cfg_setdefault_double(const char *name, double val)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_double);
 
   if (variable->isdefault) {
-    xbt_cfg_set_double(cfg, name, val);
+    xbt_cfg_set_double(name, val);
     variable->isdefault = 1;
   } else
     XBT_DEBUG("Do not override configuration variable '%s' with value '%f' because it was already set.", name, val);
@@ -745,12 +734,12 @@ void xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val)
  * This is useful to change the default value of a variable while allowing
  * users to override it with command line arguments
  */
-void xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name, const char *val)
+void xbt_cfg_setdefault_string(const char *name, const char *val)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_string);
 
   if (variable->isdefault){
-    xbt_cfg_set_string(cfg, name, val);
+    xbt_cfg_set_string(name, val);
     variable->isdefault = 1;
   } else
     XBT_DEBUG("Do not override configuration variable '%s' with value '%s' because it was already set.", name, val);
@@ -761,12 +750,12 @@ void xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name, const char *val)
  * This is useful to change the default value of a variable while allowing
  * users to override it with command line arguments
  */
-void xbt_cfg_setdefault_boolean(xbt_cfg_t cfg, const char *name, const char *val)
+void xbt_cfg_setdefault_boolean(const char *name, const char *val)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_boolean);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_boolean);
 
   if (variable->isdefault){
-    xbt_cfg_set_boolean(cfg, name, val);
+    xbt_cfg_set_boolean(name, val);
     variable->isdefault = 1;
   }
    else
@@ -779,10 +768,9 @@ void xbt_cfg_setdefault_boolean(xbt_cfg_t cfg, const char *name, const char *val
  * @param name the name of the variable
  * @param val the value of the variable
  */
-void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val)
+void xbt_cfg_set_int(const char *name, int val)
 {
-  XBT_VERB("Configuration setting: %s=%d", name, val);
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_int);
 
   if (variable->max == 1) {
     xbt_dynar_set(variable->content, 0, &val);
@@ -805,10 +793,9 @@ void xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val)
  * @param name the name of the variable
  * @param val the doule to set
  */
-void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val)
+void xbt_cfg_set_double(const char *name, double val)
 {
-  XBT_VERB("Configuration setting: %s=%f", name, val);
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_double);
 
   if (variable->max == 1) {
     xbt_dynar_set(variable->content, 0, &val);
@@ -832,15 +819,10 @@ void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val)
  * @param val the value to be added
  *
  */
-void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val)
+void xbt_cfg_set_string(const char *name, const char *val)
 {
   char *newval = xbt_strdup(val);
-
-  XBT_VERB("Configuration setting: %s=%s", name, val);
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
-
-  XBT_DEBUG("Variable: %d to %d %s (=%d) @%p",
-         variable->min, variable->max, xbt_cfgelm_type_name[variable->type], (int)variable->type, variable);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_string);
 
   if (variable->max == 1) {
     if (!xbt_dynar_is_empty(variable->content)) {
@@ -865,16 +847,13 @@ void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val)
 
 /** @brief Set or add a boolean value to \a name within \a cfg
  *
- * @param cfg the config set
  * @param name the name of the variable
  * @param val the value of the variable
  */
-void xbt_cfg_set_boolean(xbt_cfg_t cfg, const char *name, const char *val)
+void xbt_cfg_set_boolean(const char *name, const char *val)
 {
   int i, bval;
-
-  XBT_VERB("Configuration setting: %s=%s", name, val);
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_boolean);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_boolean);
 
   for (i = 0; xbt_cfgelm_boolean_values[i].true_val != NULL; i++) {
     if (strcmp(val, xbt_cfgelm_boolean_values[i].true_val) == 0){
@@ -1053,24 +1032,23 @@ void xbt_cfg_empty(xbt_cfg_t cfg, const char *name)
 }
 
 /* Say if the value is the default value */
-int xbt_cfg_is_default_value(xbt_cfg_t cfg, const char *name)
+int xbt_cfg_is_default_value(const char *name)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_any);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_any);
   return variable->isdefault;
 }
 
 /*----[ Getting ]---------------------------------------------------------*/
 /** @brief Retrieve an integer value of a variable (get a warning if not uniq)
  *
- * @param cfg the config set
  * @param name the name of the variable
  *
  * Returns the first value from the config set under the given name.
  * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() instead.
  */
-int xbt_cfg_get_int(xbt_cfg_t cfg, const char *name)
+int xbt_cfg_get_int(const char *name)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_int);
 
   if (xbt_dynar_length(variable->content) > 1) {
     XBT_WARN("You asked for the first value of the config element '%s', but there is %lu values",
@@ -1088,9 +1066,9 @@ int xbt_cfg_get_int(xbt_cfg_t cfg, const char *name)
  * Returns the first value from the config set under the given name.
  * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() instead.
  */
-double xbt_cfg_get_double(xbt_cfg_t cfg, const char *name)
+double xbt_cfg_get_double(const char *name)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_double);
 
   if (xbt_dynar_length(variable->content) > 1) {
     XBT_WARN ("You asked for the first value of the config element '%s', but there is %lu values\n",
@@ -1111,9 +1089,9 @@ double xbt_cfg_get_double(xbt_cfg_t cfg, const char *name)
  *
  * \warning the returned value is the actual content of the config set
  */
-char *xbt_cfg_get_string(xbt_cfg_t cfg, const char *name)
+char *xbt_cfg_get_string(const char *name)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_string);
 
   if (xbt_dynar_length(variable->content) > 1) {
     XBT_WARN("You asked for the first value of the config element '%s', but there is %lu values\n",
@@ -1133,9 +1111,9 @@ char *xbt_cfg_get_string(xbt_cfg_t cfg, const char *name)
  * Returns the first value from the config set under the given name.
  * If there is more than one value, it will issue a warning. Consider using xbt_cfg_get_dynar() instead.
  */
-int xbt_cfg_get_boolean(xbt_cfg_t cfg, const char *name)
+int xbt_cfg_get_boolean(const char *name)
 {
-  xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_boolean);
+  xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_boolean);
 
   if (xbt_dynar_length(variable->content) > 1) {
     XBT_WARN("You asked for the first value of the config element '%s', but there is %lu values",
@@ -1154,13 +1132,13 @@ int xbt_cfg_get_boolean(xbt_cfg_t cfg, const char *name)
  *
  * \warning the returned value is the actual content of the config set
  */
-xbt_dynar_t xbt_cfg_get_dynar(xbt_cfg_t cfg, const char *name)
+xbt_dynar_t xbt_cfg_get_dynar(const char *name)
 {
   xbt_cfgelm_t variable = NULL;
   xbt_ex_t e;
 
   TRY {
-    variable = xbt_dict_get((xbt_dict_t) cfg, name);
+    variable = xbt_dict_get((xbt_dict_t) simgrid_config, name);
   } CATCH(e) {
     if (e.category == not_found_error) {
       xbt_ex_free(e);
@@ -1220,73 +1198,68 @@ static xbt_cfg_t make_set()
   return set;
 }                               /* end_of_make_set */
 
+extern xbt_cfg_t simgrid_config;
+
 XBT_TEST_UNIT("memuse", test_config_memuse, "Alloc and free a config set")
 {
-  xbt_cfg_t set = make_set();
+  simgrid_config = make_set();
   xbt_test_add("Alloc and free a config set");
-  xbt_cfg_set_parse(set, "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
-  xbt_cfg_free(&set);
-  xbt_cfg_free(&set);
+  xbt_cfg_set_parse("peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
+  xbt_cfg_free(&simgrid_config);
 }
 
 XBT_TEST_UNIT("validation", test_config_validation, "Validation tests")
 {
-  xbt_cfg_t set = set = make_set();
   xbt_ex_t e;
 
+  simgrid_config = make_set();
   xbt_test_add("Having too few elements for speed");
-  xbt_cfg_set_parse(set, "peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
+  xbt_cfg_set_parse("peername:veloce user:mquinson\nuser:oaumage\tuser:alegrand");
   TRY {
-    xbt_cfg_check(set);
+    xbt_cfg_check();
   } CATCH(e) {
     if (e.category != mismatch_error || strncmp(e.msg, "Config elem speed needs", strlen("Config elem speed needs")))
       xbt_test_fail("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
-  xbt_cfg_free(&set);
-  xbt_cfg_free(&set);
 
   xbt_test_add("Having too much values of 'speed'");
-  set = make_set();
-  xbt_cfg_set_parse(set, "peername:toto:42 user:alegrand");
+  xbt_cfg_set_parse("peername:toto:42 user:alegrand");
   TRY {
-    xbt_cfg_set_parse(set, "speed:42 speed:24 speed:34");
+    xbt_cfg_set_parse("speed:42 speed:24 speed:34");
   } CATCH(e) {
     if (e.category != mismatch_error ||
         strncmp(e.msg, "Cannot add value 34 to the config elem speed", strlen("Config elem speed needs")))
       xbt_test_fail("Got an exception. msg=%s", e.msg);
     xbt_ex_free(e);
   }
-  xbt_cfg_check(set);
-  xbt_cfg_free(&set);
-  xbt_cfg_free(&set);
+  xbt_cfg_check();
+  xbt_cfg_free(&simgrid_config);
 }
 
 XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
 {
+  simgrid_config = make_set();
   xbt_test_add("Get a single value");
   {
     /* get_single_value */
     int ival;
-    xbt_cfg_t myset = make_set();
 
-    xbt_cfg_set_parse(myset, "peername:toto:42 speed:42");
-    ival = xbt_cfg_get_int(myset, "speed");
+    xbt_cfg_set_parse("peername:toto:42 speed:42");
+    ival = xbt_cfg_get_int("speed");
     if (ival != 42)
       xbt_test_fail("Speed value = %d, I expected 42", ival);
-    xbt_cfg_free(&myset);
   }
 
   xbt_test_add("Get multiple values");
   {
     /* get_multiple_value */
     xbt_dynar_t dyn;
-    xbt_cfg_t myset = make_set();
 
-    xbt_cfg_set_parse(myset, "peername:veloce user:foo\nuser:bar\tuser:toto");
-    xbt_cfg_set_parse(myset, "speed:42");
-    xbt_cfg_check(myset);
-    dyn = xbt_cfg_get_dynar(myset, "user");
+    xbt_cfg_set_parse("peername:veloce user:foo\nuser:bar\tuser:toto");
+    xbt_cfg_set_parse("speed:42");
+    xbt_cfg_check();
+    dyn = xbt_cfg_get_dynar("user");
 
     if (xbt_dynar_length(dyn) != 3)
       xbt_test_fail("Dynar length = %lu, I expected 3", xbt_dynar_length(dyn));
@@ -1299,23 +1272,20 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests")
 
     if (strcmp(xbt_dynar_get_as(dyn, 2, char *), "toto"))
        xbt_test_fail("Dynar[2] = %s, I expected toto", xbt_dynar_get_as(dyn, 2, char *));
-    xbt_cfg_free(&myset);
   }
 
   xbt_test_add("Access to a non-existant entry");
   {
-    /* non-existant_entry */
-    xbt_cfg_t myset = make_set();
     xbt_ex_t e;
 
     TRY {
-      xbt_cfg_set_parse(myset, "color:blue");
+      xbt_cfg_set_parse("color:blue");
     } CATCH(e) {
       if (e.category != not_found_error)
         xbt_test_exception(e);
       xbt_ex_free(e);
     }
-    xbt_cfg_free(&myset);
   }
+  xbt_cfg_free(&simgrid_config);
 }
 #endif                          /* SIMGRID_TEST */
index 43e903f..8b9b415 100644 (file)
@@ -144,10 +144,8 @@ void xbt_init(int *argc, char **argv)
 
   xbt_binary_name = xbt_strdup(argv[0]);
   xbt_cmdline = xbt_dynar_new(sizeof(char*),NULL);
-  int i;
-  for (i=0;i<*argc;i++) {
+  for (int i=0;i<*argc;i++)
     xbt_dynar_push(xbt_cmdline,&(argv[i]));
-  }
   
   xbt_log_init(argc, argv);
 }
index 3a22407..68eb822 100644 (file)
@@ -1,4 +1,4 @@
-$ ${bindir:=.}/../../examples/msg/masterslave/masterslave_mailbox ${srcdir:=.}/../../examples/platforms/small_platform.lua ${srcdir:=.}/../../examples/msg/masterslave/deployment_masterslave_mailbox.xml
+$ ${bindir:=.}/../../examples/msg/masterworker-mailbox/masterworker-mailbox ${srcdir:=.}/../../examples/platforms/small_platform.lua ${srcdir:=.}/../../examples/msg/masterslave/deployment_masterslave_mailbox.xml
 > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Got 5 slaves and 20 tasks to process
 > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Sending "Task_0" (of 20) to mailbox "slave-0"
 > [Tremblay:master:(1) 0.002265] [msg_test/INFO] Sending "Task_1" (of 20) to mailbox "slave-1"
index 17c8002..133e392 100644 (file)
@@ -38,8 +38,8 @@ int main(int argc, char **argv)
 {
   double now = -1.0;
   surf_init(&argc, argv);       /* Initialize some common structures */
-  xbt_cfg_set_parse(_sg_cfg_set, "cpu/model:Cas01");
-  xbt_cfg_set_parse(_sg_cfg_set, "network/model:CM02");
+  xbt_cfg_set_parse("cpu/model:Cas01");
+  xbt_cfg_set_parse("network/model:CM02");
 
   xbt_assert(argc >1, "Usage : %s platform.txt\n", argv[0]);
   parse_platform_file(argv[1]);
index 0fc3a43..2308198 100644 (file)
@@ -24,8 +24,8 @@ int main(int argc, char **argv)
 
   surf_init(&argc, argv);       /* Initialize some common structures */
 
-  xbt_cfg_set_parse(_sg_cfg_set, "network/model:CM02");
-  xbt_cfg_set_parse(_sg_cfg_set, "cpu/model:Cas01");
+  xbt_cfg_set_parse("network/model:CM02");
+  xbt_cfg_set_parse("cpu/model:Cas01");
 
   xbt_assert(argc >1, "Usage : %s platform.txt\n", argv[0]);
   parse_platform_file(argv[1]);