Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do connect all log channel manually to parent using XBT_LOG_CONNECT() too, so that...
[simgrid.git] / src / simix / smx_config.c
index e6cc7be..77d690f 100644 (file)
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 
-int _simix_init_status = 0; /* 0: beginning of time; 
-                             1: pre-inited (cfg_set created); 
-                             2: inited (running) */
+int _simix_init_status = 0;    /* 0: beginning of time; 
+                                  1: pre-inited (cfg_set created); 
+                                  2: inited (running) */
 xbt_cfg_t _simix_cfg_set = NULL;
 
 /* callback of the workstation_model variable */
 xbt_cfg_t _simix_cfg_set = NULL;
 
 /* callback of the workstation_model variable */
-static void _simix_cfg_cb__workstation_model(const char *name, int pos) 
+static void _simix_cfg_cb__workstation_model(const char *name, int pos)
 {
   char *val;
 
 {
   char *val;
 
-  xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
-  
-  val = xbt_cfg_get_string (_simix_cfg_set, name);
+  xbt_assert0(_simix_init_status < 2,
+             "Cannot change the model after the initialization");
+
+  val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
   /* New Module missing */
-  
-  find_resource_description(surf_workstation_resource_description,
-                           surf_workstation_resource_description_size,
+
+  find_model_description(surf_workstation_model_description,
+                           surf_workstation_model_description_size,
                            val);
 }
 
 /* callback of the cpu_model variable */
                            val);
 }
 
 /* callback of the cpu_model variable */
-static void _simix_cfg_cb__cpu_model(const char *name, int pos) 
+static void _simix_cfg_cb__cpu_model(const char *name, int pos)
 {
   char *val;
 
 {
   char *val;
 
-  xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
-  
-  val = xbt_cfg_get_string (_simix_cfg_set, name);
+  xbt_assert0(_simix_init_status < 2,
+             "Cannot change the model after the initialization");
+
+  val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
   /* New Module missing */
-  find_resource_description(surf_cpu_resource_description,
-                           surf_cpu_resource_description_size,
-                           val);
+  find_model_description(surf_cpu_model_description,
+                           surf_cpu_model_description_size, val);
 }
 }
+
 /* callback of the workstation_model variable */
 /* callback of the workstation_model variable */
-static void _simix_cfg_cb__network_model(const char *name, int pos) 
+static void _simix_cfg_cb__network_model(const char *name, int pos)
 {
   char *val;
 
 {
   char *val;
 
-  xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
-  
-  val = xbt_cfg_get_string (_simix_cfg_set, name);
+  xbt_assert0(_simix_init_status < 2,
+             "Cannot change the model after the initialization");
+
+  val = xbt_cfg_get_string(_simix_cfg_set, name);
   /* New Module missing */
   /* New Module missing */
-  find_resource_description(surf_network_resource_description,
-                           surf_network_resource_description_size,
-                           val);
+  find_model_description(surf_network_model_description,
+                           surf_network_model_description_size, val);
 }
 
 /* create the config set and register what should be */
 }
 
 /* create the config set and register what should be */
-void simix_config_init(void) 
+void simix_config_init(void)
 {
 
 {
 
-  if (_simix_init_status) 
-    return; /* Already inited, nothing to do */
-
+  if (_simix_init_status)
+    return;                    /* Already inited, nothing to do */
+
+  /* Connect our log channels: that must be done manually under windows */
+  XBT_LOG_CONNECT(simix_action, simix);
+  XBT_LOG_CONNECT(simix_deployment, simix);
+  XBT_LOG_CONNECT(simix_environment, simix);
+  XBT_LOG_CONNECT(simix_host, simix);
+  XBT_LOG_CONNECT(simix_kernel, simix);
+  XBT_LOG_CONNECT(simix_process, simix);
+  XBT_LOG_CONNECT(simix_synchro, simix);
+  
   _simix_init_status = 1;
   _simix_cfg_set = xbt_cfg_new();
   _simix_init_status = 1;
   _simix_cfg_set = xbt_cfg_new();
-  
-  xbt_cfg_register (_simix_cfg_set, 
-                    "workstation_model", xbt_cfgelm_string, 1,1,
-                    &_simix_cfg_cb__workstation_model,NULL);
-
-  xbt_cfg_register (_simix_cfg_set, 
-                    "cpu_model", xbt_cfgelm_string, 1,1,
-                    &_simix_cfg_cb__cpu_model,NULL); 
-  xbt_cfg_register (_simix_cfg_set, 
-                    "network_model", xbt_cfgelm_string, 1,1,
-                    &_simix_cfg_cb__network_model,NULL);
-                   
-  xbt_cfg_set_string(_simix_cfg_set,"workstation_model", "KCCFLN05");
+
+  xbt_cfg_register(_simix_cfg_set,
+                  "workstation_model", xbt_cfgelm_string, 1, 1,
+                  &_simix_cfg_cb__workstation_model, NULL);
+
+  xbt_cfg_register(_simix_cfg_set,
+                  "cpu_model", xbt_cfgelm_string, 1, 1,
+                  &_simix_cfg_cb__cpu_model, NULL);
+  xbt_cfg_register(_simix_cfg_set,
+                  "network_model", xbt_cfgelm_string, 1, 1,
+                  &_simix_cfg_cb__network_model, NULL);
+
+  xbt_cfg_set_string(_simix_cfg_set, "workstation_model", "CLM03");
 }
 
 }
 
-void simix_config_finalize(void) 
+void simix_config_finalize(void)
 {
 
 {
 
-  if (!_simix_init_status) 
-    return; /* Not initialized yet. Nothing to do */
+  if (!_simix_init_status)
+    return;                    /* Not initialized yet. Nothing to do */
 
   xbt_cfg_free(&_simix_cfg_set);
   _simix_init_status = 0;
 
   xbt_cfg_free(&_simix_cfg_set);
   _simix_init_status = 0;
@@ -104,10 +115,10 @@ void simix_config_finalize(void)
  *     \param name Configuration variable name that will change.
  *     \param pa A va_list with the others parameters
  */
  *     \param name Configuration variable name that will change.
  *     \param pa A va_list with the others parameters
  */
-void SIMIX_config(const char *name, va_list pa) 
+void SIMIX_config(const char *name, va_list pa)
 {
   if (!_simix_init_status) {
     simix_config_init();
   }
 {
   if (!_simix_init_status) {
     simix_config_init();
   }
-  xbt_cfg_set_vargs(_simix_cfg_set,name,pa);
+  xbt_cfg_set_vargs(_simix_cfg_set, name, pa);
 }
 }