XBT_PUBLIC(void) xbt_cfg_set_parse(xbt_cfg_t cfg, const char *options);
/* Set the value of the cell \a name in \a cfg with the provided value.*/
-XBT_PUBLIC(void) xbt_cfg_set_int(xbt_cfg_t cfg, const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_set_boolean(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void*) xbt_cfg_set_as_string(xbt_cfg_t cfg, const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_set_int (const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_set_double (const char *name, double val);
+XBT_PUBLIC(void) xbt_cfg_set_string (const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_set_boolean (const char *name, const char *val);
+XBT_PUBLIC(void*) xbt_cfg_set_as_string(const char *name, const char *val);
/*
Set the default value of the cell \a name in \a cfg with the provided value.
If it was already set to something (possibly from the command line), do nothing.
*/
-XBT_PUBLIC(void) xbt_cfg_setdefault_int(xbt_cfg_t cfg, const char *name, int val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_double(xbt_cfg_t cfg, const char *name, double val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_string(xbt_cfg_t cfg, const char *name, const char *val);
-XBT_PUBLIC(void) xbt_cfg_setdefault_boolean(xbt_cfg_t cfg, const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_int (const char *name, int val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_double (const char *name, double val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_string (const char *name, const char *val);
+XBT_PUBLIC(void) xbt_cfg_setdefault_boolean(const char *name, const char *val);
/** @brief Remove the provided value from the cell #name in #cfg. */
XBT_PUBLIC(void) xbt_cfg_rm_int(xbt_cfg_t cfg, const char *name, int val);
XBT_PUBLIC(void) xbt_cfg_empty(xbt_cfg_t cfg, const char *name);
/** @brief Return if configuration is set by default*/
-XBT_PUBLIC(int) xbt_cfg_is_default_value(xbt_cfg_t cfg, const char *name);
+XBT_PUBLIC(int) xbt_cfg_is_default_value(const char *name);
/* @} */
* @{
*/
-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)
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);
-
-/* 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_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);
}
/**
opt = strchr(argv[i], '=');
opt++;
- xbt_cfg_set_parse(_sg_cfg_set, opt);
+ xbt_cfg_set_parse(simgrid_config, 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));
+ char *path = xbt_strdup(xbt_cfg_get_string_at(simgrid_config, name, pos));
xbt_dynar_push(surf_path, &path);
}
#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, 1, &_sg_cfg_cb__plugin);
describe_model(description, surf_cpu_model_description, "model", "The model to use for the CPU");
xbt_cfg_register_string("cpu/model", description, "Cas01", &_sg_cfg_cb__cpu_model);
NAN, _sg_cfg_cb__weight_S); /* real default for "network/weight_S" is set in network_*.cpp */
/* Inclusion path */
- xbt_cfg_register(&_sg_cfg_set, "path", "Lookup path for inclusions in platform and deployment XML files",
+ xbt_cfg_register(&simgrid_config, "path", "Lookup path for inclusions in platform and deployment XML files",
xbt_cfgelm_string, 1, 0, _sg_cfg_cb__surf_path);
xbt_cfg_register_boolean("cpu/maxmin_selective_update",
"Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
"no", NULL);
/* Replay (this part is enabled even if MC it disabled) */
- xbt_cfg_register(&_sg_cfg_set, "model-check/replay", "Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay);
+ xbt_cfg_register(&simgrid_config, "model-check/replay", "Enable replay mode with the given path", xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay);
#if HAVE_MC
/* do model-checking-record */
xbt_cfg_register_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(&_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_string("smpi/coll_selector", "Which collective selector to use", "default", NULL);
- xbt_cfg_register(&_sg_cfg_set, "smpi/gather",
+ xbt_cfg_register(&simgrid_config, "smpi/gather",
"Which collective to use for gather",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_gather);
- xbt_cfg_register(&_sg_cfg_set, "smpi/allgather",
+ xbt_cfg_register(&simgrid_config, "smpi/allgather",
"Which collective to use for allgather",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgather);
- xbt_cfg_register(&_sg_cfg_set, "smpi/barrier",
+ xbt_cfg_register(&simgrid_config, "smpi/barrier",
"Which collective to use for barrier",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_barrier);
- xbt_cfg_register(&_sg_cfg_set, "smpi/reduce_scatter",
+ xbt_cfg_register(&simgrid_config, "smpi/reduce_scatter",
"Which collective to use for reduce_scatter",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce_scatter);
- xbt_cfg_register(&_sg_cfg_set, "smpi/scatter",
+ xbt_cfg_register(&simgrid_config, "smpi/scatter",
"Which collective to use for scatter",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_scatter);
- xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv",
+ xbt_cfg_register(&simgrid_config, "smpi/allgatherv",
"Which collective to use for allgatherv",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgatherv);
- xbt_cfg_register(&_sg_cfg_set, "smpi/allreduce",
+ xbt_cfg_register(&simgrid_config, "smpi/allreduce",
"Which collective to use for allreduce",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allreduce);
- xbt_cfg_register(&_sg_cfg_set, "smpi/alltoall",
+ xbt_cfg_register(&simgrid_config, "smpi/alltoall",
"Which collective to use for alltoall",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoall);
- xbt_cfg_register(&_sg_cfg_set, "smpi/alltoallv",
+ xbt_cfg_register(&simgrid_config, "smpi/alltoallv",
"Which collective to use for alltoallv",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoallv);
- xbt_cfg_register(&_sg_cfg_set, "smpi/bcast",
+ xbt_cfg_register(&simgrid_config, "smpi/bcast",
"Which collective to use for bcast",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_bcast);
- xbt_cfg_register(&_sg_cfg_set, "smpi/reduce",
+ xbt_cfg_register(&simgrid_config, "smpi/reduce",
"Which collective to use for reduce",
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce);
#endif // HAVE_SMPI
xbt_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(simgrid_config);
_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(simgrid_config, 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 _sg_cfg_set = NULL;
+xbt_cfg_t simgrid_config = NULL;
/* xbt_cfgelm_t: the typedef corresponding to a config variable.
}
void xbt_cfg_register_double(const char *name, const char *desc, double default_value,xbt_cfg_cb_t cb_set){
- xbt_cfg_register(_sg_cfg_set,name,desc,xbt_cfgelm_double,1,1,cb_set);
- xbt_cfg_setdefault_double(_sg_cfg_set, name, default_value);
+ xbt_cfg_register(simgrid_config,name,desc,xbt_cfgelm_double,1,1,cb_set);
+ xbt_cfg_setdefault_double(name, default_value);
}
void xbt_cfg_register_int(const char *name, const char *desc, int default_value,xbt_cfg_cb_t cb_set){
- xbt_cfg_register(_sg_cfg_set,name,desc,xbt_cfgelm_int,1,1,cb_set);
- xbt_cfg_setdefault_int(_sg_cfg_set, name, default_value);
+ xbt_cfg_register(simgrid_config,name,desc,xbt_cfgelm_int,1,1,cb_set);
+ xbt_cfg_setdefault_int(name, default_value);
}
void xbt_cfg_register_string(const char *name, const char *desc, const char *default_value, xbt_cfg_cb_t cb_set){
- xbt_cfg_register(_sg_cfg_set,name,desc,xbt_cfgelm_string,1,1,cb_set);
- xbt_cfg_setdefault_string(_sg_cfg_set, name, default_value);
+ xbt_cfg_register(simgrid_config,name,desc,xbt_cfgelm_string,1,1,cb_set);
+ xbt_cfg_setdefault_string(name, default_value);
}
void xbt_cfg_register_boolean(const char *name, const char *desc, const char*default_value,xbt_cfg_cb_t cb_set){
- xbt_cfg_register(_sg_cfg_set,name,desc,xbt_cfgelm_boolean,1,1,cb_set);
- xbt_cfg_setdefault_boolean(_sg_cfg_set, name, default_value);
+ xbt_cfg_register(simgrid_config,name,desc,xbt_cfgelm_boolean,1,1,cb_set);
+ xbt_cfg_setdefault_boolean(name, default_value);
}
void xbt_cfg_register_alias(const char *newname, const char *oldname)
{
- if (_sg_cfg_set == NULL)
- _sg_cfg_set = xbt_cfg_new();
+ if (simgrid_config == NULL)
+ simgrid_config = xbt_cfg_new();
- xbt_cfgelm_t res = xbt_dict_get_or_null(_sg_cfg_set, 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(_sg_cfg_set, 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);
res->isdefault = 1;
res->content = (xbt_dynar_t)newname;
- xbt_dict_set(_sg_cfg_set, oldname, res, NULL);
+ xbt_dict_set(simgrid_config, oldname, res, NULL);
}
/** @brief Unregister an element from a config set.
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);
*
* @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(xbt_cfg_t cfg, 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);
+ xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_int);
if (variable->max == 1) {
xbt_dynar_set(variable->content, 0, &val);
* @param name the name of the variable
* @param val the doule to set
*/
-void xbt_cfg_set_double(xbt_cfg_t cfg, const char *name, double val)
+void xbt_cfg_set_double(const char *name, double val)
{
XBT_VERB("Configuration setting: %s=%f", name, val);
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
+ xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, name, xbt_cfgelm_double);
if (variable->max == 1) {
xbt_dynar_set(variable->content, 0, &val);
* @param val the value to be added
*
*/
-void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val)
+void xbt_cfg_set_string(const char *name, const char *val)
{
char *newval = xbt_strdup(val);
XBT_VERB("Configuration setting: %s=%s", name, val);
- xbt_cfgelm_t variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string);
+ xbt_cfgelm_t variable = xbt_cfgelm_get(simgrid_config, 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);
* @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){
}
/* 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 myset = make_set();
xbt_cfg_set_parse(myset, "peername:toto:42 speed:42");
- ival = xbt_cfg_get_int(myset, "speed");
+ ival = xbt_cfg_get_int("speed");
if (ival != 42)
xbt_test_fail("Speed value = %d, I expected 42", ival);
xbt_cfg_free(&myset);
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");
+ dyn = xbt_cfg_get_dynar("user");
if (xbt_dynar_length(dyn) != 3)
xbt_test_fail("Dynar length = %lu, I expected 3", xbt_dynar_length(dyn));
{
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_string("cpu/model","Cas01");
+ xbt_cfg_set_string("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_string("network/model","CM02");
+ xbt_cfg_set_string("cpu/model","Cas01");
xbt_assert(argc >1, "Usage : %s platform.txt\n", argv[0]);
parse_platform_file(argv[1]);