xbt_cfg_set_parse(_sg_cfg_set, 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");
#endif
"\n"
"You can also use --help-logs and --help-log-categories to see the details of logging output.\n"
+"\n"
+"You can also use --version to get SimGrid version information.\n"
"\n"
);
shall_exit = 1;
sg_cfg_exit_early();
}
+/* 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);
+
+ if (!strcmp(val, "help")) {
+ model_help("plugin", surf_plugin_description);
+ sg_cfg_exit_early();
+ }
+
+ /* New Module missing */
+ int plugin_id = find_model_description(surf_plugin_description, val);
+ surf_plugin_description[plugin_id].model_init_preparse();
+}
+
/* callback of the workstation/model variable */
static void _sg_cfg_cb__workstation_model(const char *name, int pos)
{
find_model_description(surf_workstation_model_description, val);
}
+/* callback of the vm_workstation/model variable */
+static void _sg_cfg_cb__vm_workstation_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);
+
+ if (!strcmp(val, "help")) {
+ model_help("vm_workstation", surf_vm_workstation_model_description);
+ sg_cfg_exit_early();
+ }
+
+ /* Make sure that the model exists */
+ find_model_description(surf_vm_workstation_model_description, val);
+}
+
/* callback of the cpu/model variable */
static void _sg_cfg_cb__cpu_model(const char *name, int pos)
{
/* Create the configuration support */
if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */
+
+ /* Plugins configuration */
+
+ sprintf(description,
+ "The plugins. Possible values: ");
+ p = description;
+ while (*(++p) != '\0');
+ for (i = 0; surf_plugin_description[i].name; i++)
+ p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
+ surf_plugin_description[i].name);
+ sprintf(p,
+ ".\n (use 'help' as a value to see the long description of each plugin)");
+ xbt_cfg_register(&_sg_cfg_set, "plugin", description,
+ xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__plugin, NULL);
+
sprintf(description,
"The model to use for the CPU. Possible values: ");
p = description;
xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__storage_mode, NULL);
xbt_cfg_setdefault_string(_sg_cfg_set, "storage/model", "default");
- /* ********************************************************************* */
- /* TUTORIAL: New model */
- sprintf(description,
- "The model to use for the New model. Possible values: ");
- p = description;
- while (*(++p) != '\0');
- for (i = 0; surf_new_model_description[i].name; i++)
- p += sprintf(p, "%s%s", (i == 0 ? "" : ", "),
- surf_new_model_description[i].name);
- sprintf(p,
- ".\n (use 'help' as a value to see the long description of each model)");
- xbt_cfg_register(&_sg_cfg_set, "new_model/model", description,
- xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__storage_mode, NULL);
- xbt_cfg_setdefault_string(_sg_cfg_set, "new_model/model", "default");
- /* ********************************************************************* */
-
sprintf(description,
"The model to use for the network. Possible values: ");
p = description;
xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__workstation_model, NULL);
xbt_cfg_setdefault_string(_sg_cfg_set, "workstation/model", "default");
+ xbt_cfg_register(&_sg_cfg_set, "vm_workstation/model", description,
+ xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__vm_workstation_model, NULL);
+ xbt_cfg_setdefault_string(_sg_cfg_set, "vm_workstation/model", "default");
+
xbt_cfg_register(&_sg_cfg_set, "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)",
xbt_cfgelm_double, 1, 1, _sg_cfg_cb__tcp_gamma, NULL);
void surf_config_models_setup()
{
const char *workstation_model_name;
+ const char *vm_workstation_model_name;
int workstation_id = -1;
+ int vm_workstation_id = -1;
char *network_model_name = NULL;
char *cpu_model_name = NULL;
int storage_id = -1;
workstation_model_name =
xbt_cfg_get_string(_sg_cfg_set, "workstation/model");
+ vm_workstation_model_name =
+ xbt_cfg_get_string(_sg_cfg_set, "vm_workstation/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");
XBT_DEBUG("Call workstation_model_init");
surf_workstation_model_description[workstation_id].model_init_preparse();
+ XBT_DEBUG("Call vm_workstation_model_init");
+ vm_workstation_id = find_model_description(surf_vm_workstation_model_description,
+ vm_workstation_model_name);
+ surf_vm_workstation_model_description[vm_workstation_id].model_init_preparse();
+
XBT_DEBUG("Call storage_model_init");
storage_id = find_model_description(surf_storage_model_description, storage_model_name);
surf_storage_model_description[storage_id].model_init_preparse();
- /* ********************************************************************* */
- /* TUTORIAL: New model */
- int new_model_id = -1;
- char *new_model_name = NULL;
- new_model_name = xbt_cfg_get_string(_sg_cfg_set, "new_model/model");
- XBT_DEBUG("Call new model_init");
- new_model_id = find_model_description(surf_new_model_description, new_model_name);
- surf_new_model_description[new_model_id].model_init_preparse();
- /* ********************************************************************* */
}
int sg_cfg_get_int(const char* name)