Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace surf by surf++ and make it compile
[simgrid.git] / src / instr / jedule / jedule_sd_binding.c
index dd3f433..b46cc9d 100644 (file)
@@ -6,8 +6,6 @@
  */
 
 
-#include <stdio.h>
-
 #include "xbt/asserts.h"
 #include "xbt/dynar.h"
 
@@ -20,6 +18,8 @@
 #include "instr/jedule/jedule_platform.h"
 #include "instr/jedule/jedule_output.h"
 
+#include <stdio.h>
+
 #ifdef HAVE_JEDULE
 
 XBT_LOG_NEW_CATEGORY(jedule, "Logging specific to Jedule");
@@ -38,7 +38,7 @@ void jedule_log_sd_event(SD_task_t task) {
   host_list = xbt_dynar_new(sizeof(char*), NULL);
 
   for(i=0; i<task->workstation_nb; i++) {
-    char *hostname = (char*)surf_resource_name(task->workstation_list[i]->surf_workstation);
+    char *hostname = sg_host_name(task->workstation_list[i]);
     xbt_dynar_push(host_list, &hostname);
   }
 
@@ -71,13 +71,11 @@ static void create_hierarchy(AS_t current_comp,
 
     xbt_dynar_foreach(current_comp->index_network_elm, 
           dynar_cursor, network_elem) {
-      char *hostname;
-      hostname = strdup(network_elem->name);
-      xbt_dynar_push(hosts, &hostname);
+      xbt_dynar_push_as(hosts, char*, network_elem->name);
     }
 
     jed_simgrid_add_resources(current_container, hosts);
-
+    xbt_dynar_free(&hosts);
   } else {
     xbt_dict_foreach(current_comp->routing_sons, cursor, key, elem) {
       jed_simgrid_container_t child_container;
@@ -123,6 +121,12 @@ void jedule_sd_init() {
   jedule_init_output();
 }
 
+void jedule_sd_exit(void)
+{
+  jed_free_jedule(jedule);
+  jedule = NULL;
+}
+
 void jedule_sd_dump() {
   FILE *fh;
     char fname[1024];