Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get rid of mallocators for tasks
[simgrid.git] / src / simdag / sd_global.cpp
index 66f3c61..8aeb02a 100644 (file)
@@ -4,17 +4,12 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "instr/instr_interface.h"
 #include "simgrid/sg_config.h"
 #include "simgrid/host.h"
 #include "src/simdag/simdag_private.h"
 #include "src/surf/surf_interface.hpp"
 #include "simgrid/s4u/engine.hpp"
 
-#if HAVE_JEDULE
-#include "simgrid/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)");
 
@@ -36,8 +31,6 @@ void SD_init(int *argc, char **argv)
   sd_global = xbt_new(s_SD_global_t, 1);
   sd_global->watch_point_reached = false;
 
-  sd_global->task_mallocator=xbt_mallocator_new(65536, SD_task_new_f, SD_task_free_f, SD_task_recycle_f);
-
   sd_global->initial_tasks = new std::set<SD_task_t>();
   sd_global->runnable_tasks = new std::set<SD_task_t>();
   sd_global->completed_tasks = new std::set<SD_task_t>();
@@ -139,8 +132,8 @@ xbt_dynar_t SD_simulate(double how_long) {
     /* let's see which tasks are done */
     unsigned int iter;
     xbt_dynar_foreach(all_existing_models, iter, model) {
-      surf_action_t action;
-      while ((action = surf_model_extract_done_action_set(model))) {
+      surf_action_t action = surf_model_extract_done_action_set(model);
+      while (action != nullptr) {
         SD_task_t task = static_cast<SD_task_t>(action->getData());
         XBT_VERB("Task '%s' done", SD_task_get_name(task));
         SD_task_set_state(task, SD_DONE);
@@ -185,14 +178,17 @@ xbt_dynar_t SD_simulate(double how_long) {
             SD_task_run(output);
         }
         task->outputs->clear();
+        action = surf_model_extract_done_action_set(model);
       }
 
       /* let's see which tasks have just failed */
-      while ((action = surf_model_extract_failed_action_set(model))) {
+      action = surf_model_extract_failed_action_set(model);
+      while (action != nullptr) {
         SD_task_t task = static_cast<SD_task_t>(action->getData());
         XBT_VERB("Task '%s' failed", SD_task_get_name(task));
         SD_task_set_state(task, SD_FAILED);
         xbt_dynar_push(sd_global->return_set, &task);
+        action = surf_model_extract_failed_action_set(model);
       }
     }
   }
@@ -224,14 +220,11 @@ double SD_get_clock() {
  */
 void SD_exit()
 {
-  TRACE_surf_resource_utilization_release();
-
 #if HAVE_JEDULE
   jedule_sd_cleanup();
   jedule_sd_exit();
 #endif
 
-  xbt_mallocator_free(sd_global->task_mallocator);
   delete sd_global->initial_tasks;
   delete sd_global->runnable_tasks;
   delete sd_global->completed_tasks;