Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Starting to code a "constant" network model.
[simgrid.git] / src / surf / surf.c
index 637ebf2..166c134 100644 (file)
@@ -125,15 +125,8 @@ const char *surf_action_state_names[6] = {
   "SURF_ACTION_NOT_IN_THE_SYSTEM"
 };
 
-int surf_network_model_description_size = 3
-#ifdef HAVE_GTNETS
-    + 1
-#endif
-#ifdef HAVE_SDP
-    + 1
-#endif
-    ;
-s_surf_model_description_t surf_network_model_description[] = {
+s_surf_model_description_t surf_network_model_description[surf_network_model_description_size] = {
+  {"Constant", NULL, surf_network_model_init_Constant},
   {"CM02", NULL, surf_network_model_init_CM02},
 #ifdef HAVE_GTNETS
   {"GTNets", NULL, surf_network_model_init_GTNETS},
@@ -145,17 +138,14 @@ s_surf_model_description_t surf_network_model_description[] = {
   {"Vegas", NULL, surf_network_model_init_Vegas}
 };
 
-int surf_cpu_model_description_size = 1;
-s_surf_model_description_t surf_cpu_model_description[] = {
+s_surf_model_description_t surf_cpu_model_description[surf_cpu_model_description_size] = {
   {"Cas01", NULL, surf_cpu_model_init_Cas01},
 };
 
-int surf_workstation_model_description_size = 4;
-s_surf_model_description_t surf_workstation_model_description[] = {
-  {"CLM03", NULL, surf_workstation_model_init_CLM03},
-  {"KCCFLN05", NULL, surf_workstation_model_init_KCCFLN05},
-  {"compound", NULL, surf_workstation_model_init_compound},
-  {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07}
+s_surf_model_description_t surf_workstation_model_description[surf_workstation_model_description_size] = {
+  {"CLM03", NULL, surf_workstation_model_init_CLM03, create_workstations},
+  {"compound", NULL, surf_workstation_model_init_compound, create_workstations},
+  {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL}
 };
 
 void update_model_description(s_surf_model_description_t * table,
@@ -311,6 +301,24 @@ void surf_action_set_data(surf_action_t action, void *data)
   action->data = data;
 }
 
+XBT_LOG_EXTERNAL_CATEGORY(surf_cpu);
+XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
+XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange);
+XBT_LOG_EXTERNAL_CATEGORY(surf_lagrange_dichotomy);
+XBT_LOG_EXTERNAL_CATEGORY(surf_maxmin);
+XBT_LOG_EXTERNAL_CATEGORY(surf_network);
+XBT_LOG_EXTERNAL_CATEGORY(surf_parse);
+XBT_LOG_EXTERNAL_CATEGORY(surf_timer);
+XBT_LOG_EXTERNAL_CATEGORY(surf_workstation);
+
+#ifdef HAVE_SDP
+  XBT_LOG_EXTERNAL_CATEGORY(surf_sdp_out);
+  XBT_LOG_EXTERNAL_CATEGORY(surf_sdp);
+#endif
+#ifdef HAVE_GTNETS
+  XBT_LOG_EXTERNAL_CATEGORY(surf_network_gtnets);
+#endif
+
 void surf_init(int *argc, char **argv)
 {
   int i, j;
@@ -318,6 +326,25 @@ void surf_init(int *argc, char **argv)
 
   const char *initial_path;
 
+  /* Connect our log channels: that must be done manually under windows */
+  XBT_LOG_CONNECT(surf_cpu, surf);
+  XBT_LOG_CONNECT(surf_kernel, surf);
+  XBT_LOG_CONNECT(surf_lagrange, surf);
+    XBT_LOG_CONNECT(surf_lagrange_dichotomy, surf_lagrange);
+  XBT_LOG_CONNECT(surf_maxmin, surf);
+  XBT_LOG_CONNECT(surf_network, surf);
+  XBT_LOG_CONNECT(surf_parse, surf);
+  XBT_LOG_CONNECT(surf_timer, surf);
+  XBT_LOG_CONNECT(surf_workstation, surf);
+
+#ifdef HAVE_SDP
+  XBT_LOG_CONNECT(surf_sdp_out, surf);
+  XBT_LOG_CONNECT(surf_sdp, surf);
+#endif
+#ifdef HAVE_GTNETS
+  XBT_LOG_CONNECT(surf_network_gtnets, surf);
+#endif
+   
   xbt_init(argc, argv);
   if (!surf_path) {
 
@@ -379,7 +406,11 @@ FILE *surf_fopen(const char *name, const char *mode)
        path_name_len = strlen(path) + strlen(name) + 1;        /* plus '/' */
        path_name = xbt_realloc(path_name, path_name_len + 1);
       }
+      #ifdef WIN32
+      sprintf(path_name, "%s\\%s", path, name);
+      #else
       sprintf(path_name, "%s/%s", path, name);
+      #endif
       file = fopen(path_name, mode);
       if (file)
        return file;