Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
protect this file against multiple inclusions to fix supernovae (oops)
[simgrid.git] / src / simdag / sd_global.c
index b84b7b1..01c3a62 100644 (file)
@@ -12,7 +12,7 @@
 #include "xbt/log.h"
 #include "xbt/str.h"
 #include "xbt/config.h"
-#include "instr/private.h"
+#include "instr/instr_private.h"
 #ifdef HAVE_LUA
 #include <lua.h>
 #include <lauxlib.h>
@@ -191,10 +191,6 @@ void SD_create_environment(const char *platform_file)
 
   DEBUG2("Workstation number: %d, link number: %d",
          SD_workstation_get_number(), SD_link_get_number());
-
-#ifdef HAVE_TRACING
-  TRACE_surf_save_onelink();
-#endif
 }
 
 /**
@@ -232,10 +228,6 @@ xbt_dynar_t SD_simulate(double how_long)
     first_time = 0;
   }
 
-  if (how_long > 0) {
-    surf_timer_model->extension.timer.set(surf_get_clock() + how_long,
-                                          NULL, NULL);
-  }
   sd_global->watch_point_reached = 0;
 
   /* explore the runnable tasks */
@@ -253,13 +245,11 @@ xbt_dynar_t SD_simulate(double how_long)
          !sd_global->watch_point_reached) {
     surf_model_t model = NULL;
     /* dumb variables */
-    void *fun = NULL;
-    void *arg = NULL;
 
 
     DEBUG1("Total time: %f", total_time);
 
-    elapsed_time = surf_solve();
+    elapsed_time = surf_solve(how_long > 0 ? surf_get_clock() + how_long : -1.0);
     DEBUG1("surf_solve() returns %f", elapsed_time);
     if (elapsed_time > 0.0)
       total_time += elapsed_time;
@@ -339,9 +329,6 @@ xbt_dynar_t SD_simulate(double how_long)
           xbt_dynar_push(changed_tasks, &task);
       }
     }
-
-    while (surf_timer_model->extension.timer.get(&fun, (void *) &arg)) {
-    }
   }
 
   if (!sd_global->watch_point_reached && how_long<0){
@@ -419,15 +406,16 @@ void SD_exit(void)
     xbt_free(sd_global);
     sd_global = NULL;
 
+#ifdef HAVE_TRACING
+  TRACE_end();
+#endif
+
     DEBUG0("Exiting Surf...");
     surf_exit();
   } else {
     WARN0("SD_exit() called, but SimDag is not running");
     /* we cannot use exceptions here because xbt is not running! */
   }
-#ifdef HAVE_TRACING
-  TRACE_end();
-#endif
 }
 
 /**