Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
added jedule output to SimDAG
[simgrid.git] / src / simdag / sd_global.c
index 71eb57a..a73ce53 100644 (file)
 #include "xbt/log.h"
 #include "xbt/str.h"
 #include "xbt/config.h"
-#include "instr/private.h"
+#include "instr/instr_private.h"
+#include "surf/surfxml_parse.h"
 #ifdef HAVE_LUA
 #include <lua.h>
 #include <lauxlib.h>
 #include <lualib.h>
 #endif
 
+#ifdef HAVE_JEDULE
+#include "instr/jedule/jedule_sd_binding.h"
+#endif
+
 XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_kernel, sd,
                                 "Logging specific to SimDag (kernel)");
@@ -91,6 +96,10 @@ void SD_init(int *argc, char **argv)
 #ifdef HAVE_TRACING
   TRACE_start ();
 #endif
+
+#ifdef HAVE_JEDULE
+  jedule_sd_init();
+#endif
 }
 
 /**
@@ -138,6 +147,12 @@ void SD_application_reinit(void)
     sd_global->failed_task_set =
         xbt_swag_new(xbt_swag_offset(task, state_hookup));
     sd_global->task_number = 0;
+
+#ifdef HAVE_JEDULE
+    jedule_sd_cleanup();
+    jedule_sd_init();
+#endif
+
   } else {
     WARN0("SD_application_reinit called before initialization of SimDag");
     /* we cannot use exceptions here because xbt is not running! */
@@ -170,11 +185,13 @@ void SD_create_environment(const char *platform_file)
   void *surf_workstation = NULL;
   void *surf_link = NULL;
 
-  SD_CHECK_INIT_DONE();
+  platform_filename = bprintf("%s",platform_file);
 
-  DEBUG0("SD_create_environment");
-
-  surf_config_models_setup(platform_file);
+  // Reset callbacks
+  surf_parse_reset_callbacks();
+  // Add config callbacks
+  surf_parse_add_callback_config();
+  SD_CHECK_INIT_DONE();
   parse_platform_file(platform_file);
   surf_config_models_create_elms();
 
@@ -191,9 +208,8 @@ 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();
+#ifdef HAVE_JEDULE
+  jedule_setup_platform();
 #endif
 }
 
@@ -410,15 +426,20 @@ void SD_exit(void)
     xbt_free(sd_global);
     sd_global = NULL;
 
+#ifdef HAVE_TRACING
+  TRACE_end();
+#endif
+#ifdef HAVE_JEDULE
+  jedule_sd_dump();
+  jedule_sd_cleanup();
+#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
 }
 
 /**