#! ./tesh
-$ $SG_TEST_EXENV ${bindir:=.}/cloud-scale$EXEEXT ${srcdir:=.}/platform.xml
+$ $SG_TEST_EXENV ${bindir:=.}/cloud-scale$EXEEXT ${srcdir:=.}/platform.xml --cfg=contexts/stack_size:1000
> [Jacquelin:master_:(1) 0.000000] [msg_test/INFO] ## Test (start)
> [Jacquelin:master_:(1) 1.000000] [msg_test/INFO] Completed tasks: 0
> [Jacquelin:master_:(1) 2.000000] [msg_test/INFO] Completed tasks: 600
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);
-
-/** @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);
-XBT_PUBLIC(void) xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_rm_boolean(xbt_cfg_t cfg, const char *name, int val);
-
-/** @brief Remove the value at position \e pos from the config \e cfg */
-XBT_PUBLIC(void) xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos);
-
-/** @brief rm every values */
-XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
+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 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);
/* @} */
* @{
*/
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_unregister(xbt_cfg_t cfg, const char *name);
+ e_xbt_cfgelm_type_t type, int min, xbt_cfg_cb_t cb_set);
+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_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
* @{
*/
-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);
/** 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);
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
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);
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);
}
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;
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)
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;
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
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"))
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) {
"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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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
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)
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);
*/
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
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();
*/
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);
}
/**
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);
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"
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")) {
/* 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();
/* 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();
/* 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();
/* 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();
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);
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);
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);
/* 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
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);
}
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);
}
/* 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));
- xbt_dynar_push(surf_path, &path);
+ char *path = xbt_strdup(xbt_cfg_get_string_at(simgrid_config, name, pos));
+ if (path[0]) // ignore ""
+ xbt_dynar_push(surf_path, &path);
}
/* callback to decide if we want to use the model-checking */
#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
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);
}
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);
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 */
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, &_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_cfgelm_string, 1, 0, _sg_cfg_cb__surf_path);
+ xbt_cfg_register_string("path", "Lookup path for inclusions in platform and deployment XML files", "", _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, _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_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);
- 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_string("model-check/property", "Name of the file containing the property, as formated by the ltl2ba program.",
+ "", _mc_cfg_cb_property);
- /* 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_boolean("model-check/communications_determinism",
+ "Whether to enable the detection of communication determinism", "no", _mc_cfg_cb_comms_determinism);
- /* 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);
-
- /* 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";
#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
//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",
- "Which collective to use for gather",
- xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_gather);
-
- xbt_cfg_register(&_sg_cfg_set, "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",
- "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",
- "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",
- "Which collective to use for scatter",
- xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_scatter);
-
- xbt_cfg_register(&_sg_cfg_set, "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",
- "Which collective to use for allreduce",
- xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allreduce);
-
- xbt_cfg_register(&_sg_cfg_set, "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",
- "Which collective to use for alltoallv",
- xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoallv);
-
- xbt_cfg_register(&_sg_cfg_set, "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",
- "Which collective to use for reduce",
- xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce);
+ 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, &_sg_cfg_cb__coll_gather);
+
+ xbt_cfg_register(&simgrid_config, "smpi/allgather", "Which collective to use for allgather",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_allgather);
+
+ xbt_cfg_register(&simgrid_config, "smpi/barrier", "Which collective to use for barrier",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_barrier);
+
+ xbt_cfg_register(&simgrid_config, "smpi/reduce_scatter", "Which collective to use for reduce_scatter",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_reduce_scatter);
+
+ xbt_cfg_register(&simgrid_config, "smpi/scatter", "Which collective to use for scatter",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_scatter);
+
+ xbt_cfg_register(&simgrid_config, "smpi/allgatherv", "Which collective to use for allgatherv",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_allgatherv);
+
+ xbt_cfg_register(&simgrid_config, "smpi/allreduce", "Which collective to use for allreduce",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_allreduce);
+
+ xbt_cfg_register(&simgrid_config, "smpi/alltoall", "Which collective to use for alltoall",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_alltoall);
+
+ xbt_cfg_register(&simgrid_config, "smpi/alltoallv", "Which collective to use for alltoallv",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_alltoallv);
+
+ xbt_cfg_register(&simgrid_config, "smpi/bcast", "Which collective to use for bcast",
+ xbt_cfgelm_string, 0, &_sg_cfg_cb__coll_bcast);
+
+ xbt_cfg_register(&simgrid_config, "smpi/reduce", "Which collective to use for reduce",
+ xbt_cfgelm_string, 0, &_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 */
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);
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);
}
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;
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;
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);
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();
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);
}
/***************************************************************************/
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);
}
/***************************************************************************/
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);
}
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)
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 {
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;
} 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);
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);
}
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);
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 {
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);
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);
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. */
/* Allowed type of the variable */
e_xbt_cfgelm_type_t type;
- int min, max;
+ int min;
unsigned isdefault:1;
/* Callbacks */
xbt_assert(tocopy, "cannot copy NULL config");
xbt_dict_foreach((xbt_dict_t) tocopy, cursor, name, variable) {
- xbt_cfg_register(whereto, name, variable->desc, variable->type, variable->min, variable->max, variable->cb_set);
+ xbt_cfg_register(whereto, name, variable->desc, variable->type, variable->min, variable->cb_set);
}
}
printf("%s %s:", indent, key);
size = xbt_dynar_length(variable->content);
- printf ("%d_to_%d_%s. Actual size=%d. postset=%p, List of values:\n",
- variable->min, variable->max, xbt_cfgelm_type_name[variable->type], size, variable->cb_set);
+ printf ("%d_%s. Actual size=%d. postset=%p, List of values:\n",
+ variable->min, xbt_cfgelm_type_name[variable->type], size, variable->cb_set);
switch (variable->type) {
case xbt_cfgelm_int:
* @param name the name of the config element
* @param desc a description for this item (used by xbt_cfg_help())
* @param type the type of the config element
- * @param min the minimum number of values for this config element
- * @param max the maximum number of values for this config element
+ * @param min the minimum number of values for this config element (0 for optional elements)
* @param cb_set callback function called when a value is set
*/
-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)
+void xbt_cfg_register(xbt_cfg_t * cfg, const char *name, const char *desc, e_xbt_cfgelm_type_t type, int min, 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);
- XBT_DEBUG("Register cfg elm %s (%s) (%d to %d %s (=%d) @%p in set %p)",
- name, desc, min, max, xbt_cfgelm_type_name[type], (int)type, res, *cfg);
+ XBT_DEBUG("Register cfg elm %s (%s) (%d %s (=%d) @%p in set %p)",
+ name, desc, min, xbt_cfgelm_type_name[type], (int)type, res, *cfg);
res->desc = xbt_strdup(desc);
res->type = type;
res->min = min;
- res->max = max;
res->cb_set = cb_set;
res->isdefault = 1;
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,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,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,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,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;
res->min = 1;
- res->max = 1;
res->isdefault = 1;
res->content = (xbt_dynar_t)newname;
- xbt_dict_set((xbt_dict_t) * cfg, oldname, res, NULL);
-}
-
-/** @brief Unregister an element from a config set.
- *
- * @param cfg the config set
- * @param name the name of the element to be freed
- *
- * Note that it removes both the description and the actual content.
- * Throws not_found when no such element exists.
- */
-void xbt_cfg_unregister(xbt_cfg_t cfg, const char *name)
-{
- XBT_DEBUG("Unregister elm '%s' from set %p", name, cfg);
- xbt_dict_remove((xbt_dict_t) cfg, name);
+ xbt_dict_set(simgrid_config, oldname, res, NULL);
}
/**
char *entrycpy = xbt_strdup(entry);
char *tok;
- int min, max;
+ int min;
e_xbt_cfgelm_type_t type;
XBT_DEBUG("Register string '%s'", entry);
min = strtol(tok, &tok, 10);
xbt_assert(tok, "Invalid minimum in config element descriptor %s", entry);
- xbt_assert(strcmp(tok, "_to_"), "Invalid config element descriptor : %s%s",
- entry, "; Should be <name>:<min nb>_to_<max nb>_<type>");
- tok += strlen("_to_");
-
- max = strtol(tok, &tok, 10);
- xbt_assert(tok, "Invalid maximum in config element descriptor %s", entry);
-
xbt_assert(*tok == '_', "Invalid config element descriptor: %s%s", entry,
"; Should be <name>:<min nb>_to_<max nb>_<type>");
tok++;
xbt_assert(type < xbt_cfgelm_type_count, "Invalid type in config element descriptor: %s%s", entry,
"; Should be one of 'string', 'int' or 'double'.");
- xbt_cfg_register(cfg, entrycpy, NULL, type, min, max, NULL);
+ xbt_cfg_register(cfg, entrycpy, NULL, type, min, NULL);
free(entrycpy); /* strdup'ed by dict mechanism, but cannot be const */
}
printf(" %s: %s\n", name, variable->desc);
printf(" Type: %s; ", xbt_cfgelm_type_name[variable->type]);
- if (variable->min != 1 || variable->max != 1) {
- printf("Arity: min:%d to max:", variable->min);
- if (variable->max == 0)
- printf("(no bound); ");
- else
- printf("%d; ", variable->max);
- }
+ if (variable->min != 1)
+ printf("Arity: min:%d", variable->min);
size = xbt_dynar_length(variable->content);
printf("Current value%s: ", (size <= 1 ? "" : "s"));
}
default:
printf("Invalid type!!%s", sep);
+ break;
}
}
}
}
/** @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.",
THROWF(mismatch_error, 0, "Config elem %s theoretically accepts %d %s, but has a default of %d values.",
name, variable->min, xbt_cfgelm_type_name[variable->type], size);
}
-
- if (variable->max > 0 && variable->max < size) {
- xbt_dict_cursor_free(&cursor);
- THROWF(mismatch_error, 0, "Config elem %s accepts at most %d %s, but there is %d values.",
- name, variable->max, xbt_cfgelm_type_name[variable->type], size);
- }
}
xbt_dict_cursor_free(&cursor);
}
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);
/** @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 */
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;
/** @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;
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);
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:
* 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);
* 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);
* 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);
* 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
* @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);
-
- if (variable->max == 1) {
- xbt_dynar_set(variable->content, 0, &val);
- } else {
- if (variable->max && xbt_dynar_length(variable->content) == (unsigned long) variable->max)
- THROWF(mismatch_error, 0, "Cannot add value %d to the config element %s since it's already full (size=%d)",
- val, name, variable->max);
+ xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_int);
- xbt_dynar_push(variable->content, &val);
- }
+ xbt_dynar_set(variable->content, 0, &val);
if (variable->cb_set)
variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
* @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);
- } else {
- if (variable->max && xbt_dynar_length(variable->content) == variable->max)
- THROWF(mismatch_error, 0, "Cannot add value %f to the config element %s since it's already full (size=%d)",
- val, name, variable->max);
-
- xbt_dynar_push(variable->content, &val);
- }
+ xbt_dynar_set(variable->content, 0, &val);
if (variable->cb_set)
variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
* @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_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_string);
- 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);
-
- if (variable->max == 1) {
- if (!xbt_dynar_is_empty(variable->content)) {
- char *sval = xbt_dynar_get_as(variable->content, 0, char *);
- free(sval);
- }
-
- xbt_dynar_set(variable->content, 0, &newval);
- } else {
- if (variable->max
- && xbt_dynar_length(variable->content) == variable->max)
- THROWF(mismatch_error, 0, "Cannot add value %s to the config element %s since it's already full (size=%d)",
- name, val, variable->max);
-
- xbt_dynar_push(variable->content, &newval);
+ if (!xbt_dynar_is_empty(variable->content)) {
+ char *sval = xbt_dynar_get_as(variable->content, 0, char *);
+ free(sval);
}
+ xbt_dynar_set(variable->content, 0, &newval);
+
if (variable->cb_set)
variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
variable->isdefault = 0;
/** @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){
xbt_die("Value of option '%s' not valid. Should be a boolean (yes,no,on,off,true,false,0,1)", val);
}
- if (variable->max == 1) {
- xbt_dynar_set(variable->content, 0, &bval);
- } else {
- if (variable->max && xbt_dynar_length(variable->content) == (unsigned long) variable->max)
- THROWF(mismatch_error, 0, "Cannot add value %s to the config element %s since it's already full (size=%d)",
- val, name, variable->max);
-
- xbt_dynar_push(variable->content, &bval);
- }
+ xbt_dynar_set(variable->content, 0, &bval);
if (variable->cb_set)
variable->cb_set(name, xbt_dynar_length(variable->content) - 1);
variable->isdefault = 0;
}
-/* ---- [ Removing ] ---- */
-/** @brief Remove the provided \e val integer value from a variable
- *
- * @param cfg the config set
- * @param name the name of the variable
- * @param val the value to be removed
- */
-void xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val)
-{
- unsigned int cpt;
- int seen;
-
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
-
- if (xbt_dynar_length(variable->content) == variable->min)
- THROWF(mismatch_error, 0,
- "Cannot remove value %d from the config element %s since it's already at its minimal size (=%d)",
- val, name, variable->min);
-
- xbt_dynar_foreach(variable->content, cpt, seen) {
- if (seen == val) {
- xbt_dynar_cursor_rm(variable->content, &cpt);
- return;
- }
- }
- THROWF(not_found_error, 0, "Can't remove the value %d of config element %s: value not found.", val, name);
-}
-
-/** @brief Remove the provided \e val double value from a variable
- *
- * @param cfg the config set
- * @param name the name of the variable
- * @param val the value to be removed
- */
-void xbt_cfg_rm_double(xbt_cfg_t cfg, const char *name, double val)
-{
- unsigned int cpt;
- double seen;
-
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
-
- if (xbt_dynar_length(variable->content) == variable->min)
- THROWF(mismatch_error, 0,
- "Cannot remove value %f from the config element %s since it's already at its minimal size (=%d)",
- val, name, variable->min);
-
- xbt_dynar_foreach(variable->content, cpt, seen) {
- if (seen == val) {
- xbt_dynar_cursor_rm(variable->content, &cpt);
- return;
- }
- }
-
- THROWF(not_found_error, 0,"Can't remove the value %f of config element %s: value not found.", val, name);
-}
-
-/** @brief Remove the provided \e val string value from a variable
- *
- * @param cfg the config set
- * @param name the name of the variable
- * @param val the value of the string which will be removed
- */
-void xbt_cfg_rm_string(xbt_cfg_t cfg, const char *name, const char *val)
-{
- unsigned int cpt;
- char *seen;
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
-
- if (xbt_dynar_length(variable->content) == variable->min)
- THROWF(mismatch_error, 0,
- "Cannot remove value %s from the config element %s since it's already at its minimal size (=%d)",
- name, val, variable->min);
-
- xbt_dynar_foreach(variable->content, cpt, seen) {
- if (!strcpy(seen, val)) {
- xbt_dynar_cursor_rm(variable->content, &cpt);
- return;
- }
- }
-
- THROWF(not_found_error, 0, "Can't remove the value %s of config element %s: value not found.", val, name);
-}
-
-/** @brief Remove the provided \e val boolean value from a variable
- *
- * @param cfg the config set
- * @param name the name of the variable
- * @param val the value to be removed
- */
-void xbt_cfg_rm_boolean(xbt_cfg_t cfg, const char *name, int val)
-{
- unsigned int cpt;
- int seen;
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_boolean);
-
- if (xbt_dynar_length(variable->content) == variable->min)
- THROWF(mismatch_error, 0,
- "Cannot remove value %d from the config element %s since it's already at its minimal size (=%d)",
- val, name, variable->min);
-
- xbt_dynar_foreach(variable->content, cpt, seen) {
- if (seen == val) {
- xbt_dynar_cursor_rm(variable->content, &cpt);
- return;
- }
- }
-
- THROWF(not_found_error, 0, "Can't remove the value %d of config element %s: value not found.", val, name);
-}
-
-/** @brief Remove the \e pos th value from the provided variable */
-void xbt_cfg_rm_at(xbt_cfg_t cfg, const char *name, int pos)
-{
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_any);
-
- if (xbt_dynar_length(variable->content) == variable->min)
- THROWF(mismatch_error, 0,
- "Cannot remove %dth value from the config element %s since it's already at its minimal size (=%d)",
- pos, name, variable->min);
-
- xbt_dynar_remove_at(variable->content, pos, NULL);
-}
-
-/** @brief Remove all the values from a variable
- *
- * @param cfg the config set
- * @param name the name of the variable
- */
-void xbt_cfg_empty(xbt_cfg_t cfg, const char *name)
-{
- xbt_cfgelm_t variable = NULL;
- xbt_ex_t e;
-
- TRY {
- variable = xbt_dict_get((xbt_dict_t) cfg, name);
- } CATCH(e) {
- if (e.category != not_found_error)
- RETHROW;
-
- xbt_ex_free(e);
- THROWF(not_found_error, 0, "Can't empty '%s' since this option does not exist", name);
- }
-
- if (variable)
- xbt_dynar_reset(variable->content);
-}
/* 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",
* 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",
*
* \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",
* 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",
*
* \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);
xbt_cfg_t set = NULL;
xbt_log_threshold_set(&_XBT_LOGV(xbt_cfg), xbt_log_priority_critical);
- xbt_cfg_register_str(&set, "speed:1_to_2_int");
- xbt_cfg_register_str(&set, "peername:1_to_1_string");
- xbt_cfg_register_str(&set, "user:1_to_10_string");
+ xbt_cfg_register_str(&set, "speed:1_int");
+ xbt_cfg_register_str(&set, "peername:1_string");
+ xbt_cfg_register_str(&set, "user:1_string");
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:bidule");
+ 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:machin");
TRY {
- xbt_cfg_set_parse(set, "speed:42 speed:24 speed:34");
+ xbt_cfg_set_parse("speed:42 speed:24");
} 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");
-
- if (xbt_dynar_length(dyn) != 3)
- xbt_test_fail("Dynar length = %lu, I expected 3", xbt_dynar_length(dyn));
-
- if (strcmp(xbt_dynar_get_as(dyn, 0, char *), "foo"))
- xbt_test_fail("Dynar[0] = %s, I expected foo", xbt_dynar_get_as(dyn, 0, char *));
-
- if (strcmp(xbt_dynar_get_as(dyn, 1, char *), "bar"))
- xbt_test_fail("Dynar[1] = %s, I expected bar", xbt_dynar_get_as(dyn, 1, char *));
-
- 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 */
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);
}
-$ ${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"
{
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]);
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]);