Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
dynar-- for hosts that restart
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 16 Aug 2016 21:18:44 +0000 (23:18 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 16 Aug 2016 21:18:44 +0000 (23:18 +0200)
src/include/surf/surf.h
src/simix/smx_global.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp

index d63b9d3..6b20c10 100644 (file)
@@ -681,11 +681,6 @@ XBT_PUBLIC(void) surf_vm_model_init_HL13();
  */
 XBT_PUBLIC_DATA(s_surf_model_description_t) surf_vm_model_description[];
 
-/** \ingroup SURF_simulation
- *  \brief List of hosts that have just restarted and whose autorestart process should be restarted.
- */
-XBT_PUBLIC_DATA(xbt_dynar_t) host_that_restart;
-
 /** \ingroup SURF_simulation
  *  \brief List of hosts for which one want to be notified if they ever restart.
  */
index 0a8a05c..b1e0b70 100644 (file)
@@ -531,13 +531,11 @@ void SIMIX_run()
     } while (again);
 
     /* Autorestart all process */
-    char *hostname = nullptr;
-    unsigned int iter;
-    xbt_dynar_foreach(host_that_restart,iter,hostname) {
-      XBT_INFO("Restart processes on host: %s",hostname);
-      SIMIX_host_autorestart(sg_host_by_name(hostname));
+    for (auto hostname: host_that_restart) {
+      XBT_INFO("Restart processes on host: %s", hostname.c_str());
+      SIMIX_host_autorestart(sg_host_by_name(hostname.c_str()));
     }
-    xbt_dynar_reset(host_that_restart);
+    host_that_restart.clear();
 
     /* Clean processes to destroy */
     SIMIX_process_empty_trash();
index d581269..a78b07a 100644 (file)
@@ -143,7 +143,7 @@ void CpuCas01::apply_event(tmgr_trace_iterator_t event, double value)
 
     if (value > 0) {
       if(isOff())
-        xbt_dynar_push_as(host_that_restart, char*, (char *)getName());
+        host_that_restart.push_back(getName());
       turnOn();
     } else {
       lmm_constraint_t cnst = getConstraint();
index 90e5e85..939a2fc 100644 (file)
@@ -459,7 +459,7 @@ void CpuTi::apply_event(tmgr_trace_iterator_t event, double value)
   } else if (event == stateEvent_) {
     if (value > 0) {
       if(isOff())
-        xbt_dynar_push_as(host_that_restart, char*, (char *)getName());
+        host_that_restart.push_back(getName());
       turnOn();
     } else {
       turnOff();
index 8a7caad..8728795 100644 (file)
@@ -17,6 +17,7 @@
 #include "virtual_machine.hpp"
 #include "src/instr/instr_private.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "simgrid/s4u/engine.hpp"
+#include <vector>
 
 XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (kernel)");
@@ -32,7 +33,7 @@ xbt_dynar_t model_list_invoke = nullptr;  /* to invoke callbacks */
 
 simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
 xbt_dynar_t surf_path = nullptr;
-xbt_dynar_t host_that_restart = xbt_dynar_new(sizeof(char*), nullptr);
+std::vector<std::string> host_that_restart;
 xbt_dict_t watched_hosts_lib;
 
 namespace simgrid {
@@ -326,7 +327,6 @@ void surf_exit()
 
   sg_config_finalize();
 
-  xbt_dynar_free(&host_that_restart);
   xbt_dynar_free(&surf_path);
 
   xbt_dict_free(&host_list);
index 13749c2..878a52d 100644 (file)
@@ -40,6 +40,11 @@ extern XBT_PRIVATE xbt_dynar_t surf_path;
 extern "C" {
 XBT_PUBLIC(double) surf_get_clock(void);
 }
+/** \ingroup SURF_simulation
+ *  \brief List of hosts that have just restarted and whose autorestart process should be restarted.
+ */
+XBT_PUBLIC_DATA(std::vector<std::string>) host_that_restart;
+
 
 extern XBT_PRIVATE double sg_sender_gap;