Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
the prototype of the models in surf changed a looong time ago. I've no damn idea...
[simgrid.git] / testsuite / surf / surf_usage2.c
index 762fedb..9192bf7 100644 (file)
@@ -47,7 +47,13 @@ void test(char *platform)
   surf_action_t commAB = NULL;
   double now = -1.0;
 
-  surf_workstation_model_init_CLM03(platform);
+  int workstation_id =
+      find_model_description(surf_workstation_model_description,"CLM03");
+
+  surf_workstation_model_description[workstation_id].model_init(platform);
+  parse_platform_file(platform);
+  if (surf_workstation_model_description[workstation_id].create_ws)
+    surf_workstation_model_description[workstation_id].create_ws();
 
   /*********************** WORKSTATION ***********************************/
   workstationA =
@@ -56,10 +62,10 @@ void test(char *platform)
       surf_workstation_model->common_public->name_service("Cpu B");
 
   /* Let's check that those two processors exist */
-  DEBUG2("%s : %p\n",
+  DEBUG2("%s : %p",
         surf_workstation_model->common_public->
         get_resource_name(workstationA), workstationA);
-  DEBUG2("%s : %p\n",
+  DEBUG2("%s : %p",
         surf_workstation_model->common_public->
         get_resource_name(workstationB), workstationB);
 
@@ -81,30 +87,30 @@ void test(char *platform)
   surf_solve();                        /* Takes traces into account. Returns 0.0 */
   do {
     surf_action_t action = NULL;
-    int i;
+    unsigned int iter;
     surf_model_t model = NULL;
 
     now = surf_get_clock();
-    DEBUG1("Next Event : " "%g" "\n", now);
+    DEBUG1("Next Event : %g", now);
 
-    xbt_dynar_foreach(model_list, i, model) {
-      DEBUG1("\t %s actions\n", model->common_public->name);
+    xbt_dynar_foreach(model_list, iter, model) {
+      DEBUG1("\t %s actions", model->common_public->name);
       while ((action =
             xbt_swag_extract(model->common_public->states.
                              failed_action_set))) {
-       DEBUG1("\t * Failed : %p\n", action);
+       DEBUG1("\t * Failed : %p", action);
        model->common_public->action_free(action);
       }
       while ((action =
             xbt_swag_extract(model->common_public->states.
                              done_action_set))) {
-       DEBUG1("\t * Done : %p\n", action);
+       DEBUG1("\t * Done : %p", action);
        model->common_public->action_free(action);
       }
     }
   } while (surf_solve()>=0.0);
 
-  DEBUG0("Simulation Terminated\n");
+  DEBUG0("Simulation Terminated");
 
 }