Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
store host and not names
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Aug 2016 18:29:48 +0000 (20:29 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 17 Aug 2016 18:29:48 +0000 (20:29 +0200)
Bonus : 2 malloc -> new

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 b1e0b70..e78012d 100644 (file)
@@ -531,9 +531,9 @@ void SIMIX_run()
     } while (again);
 
     /* Autorestart all process */
-    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()));
+    for (auto host: host_that_restart) {
+      XBT_INFO("Restart processes on host: %s", sg_host_get_name(host));
+      SIMIX_host_autorestart(host);
     }
     host_that_restart.clear();
 
index a78b07a..feb1c57 100644 (file)
@@ -143,7 +143,7 @@ void CpuCas01::apply_event(tmgr_trace_iterator_t event, double value)
 
     if (value > 0) {
       if(isOff())
-        host_that_restart.push_back(getName());
+        host_that_restart.push_back(getHost());
       turnOn();
     } else {
       lmm_constraint_t cnst = getConstraint();
index 939a2fc..8ab9009 100644 (file)
@@ -32,8 +32,8 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace)
   double time = 0;
   int i = 0;
   nbPoints_ = speedTrace->event_list.size() + 1;
-  timePoints_ = static_cast<double*>(xbt_malloc0(sizeof(double) * nbPoints_));
-  integral_ =  static_cast<double*>(xbt_malloc0(sizeof(double) * nbPoints_));
+  timePoints_ = new double[nbPoints_];
+  integral_ =  new double[nbPoints_];
   for (auto val : speedTrace->event_list) {
     timePoints_[i] = time;
     integral_[i] = integral;
@@ -47,8 +47,8 @@ CpuTiTrace::CpuTiTrace(tmgr_trace_t speedTrace)
 
 CpuTiTrace::~CpuTiTrace()
 {
-  xbt_free(timePoints_);
-  xbt_free(integral_);
+  delete [] timePoints_;
+  delete [] integral_;
 }
 
 CpuTiTgmr::~CpuTiTgmr()
@@ -459,7 +459,7 @@ void CpuTi::apply_event(tmgr_trace_iterator_t event, double value)
   } else if (event == stateEvent_) {
     if (value > 0) {
       if(isOff())
-        host_that_restart.push_back(getName());
+        host_that_restart.push_back(getHost());
       turnOn();
     } else {
       turnOff();
index 8728795..ac01f27 100644 (file)
@@ -33,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;
-std::vector<std::string> host_that_restart;
+std::vector<sg_host_t> host_that_restart;
 xbt_dict_t watched_hosts_lib;
 
 namespace simgrid {
index 878a52d..b0d4d98 100644 (file)
@@ -43,7 +43,7 @@ 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;
+XBT_PUBLIC_DATA(std::vector<sg_host_t>) host_that_restart;
 
 
 extern XBT_PRIVATE double sg_sender_gap;