From: Frederic Suter Date: Wed, 17 Aug 2016 18:29:48 +0000 (+0200) Subject: store host and not names X-Git-Tag: v3_14~536 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9cfec5c3cb3c01283f6b556b10e93c5417a0d1a8?ds=sidebyside store host and not names Bonus : 2 malloc -> new --- diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index b1e0b70468..e78012d79a 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -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(); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index a78b07aa38..feb1c57f4b 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -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(); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index 939a2fcbc7..8ab9009066 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -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(xbt_malloc0(sizeof(double) * nbPoints_)); - integral_ = static_cast(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(); diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index 87287951b7..ac01f2715a 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -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 host_that_restart; +std::vector host_that_restart; xbt_dict_t watched_hosts_lib; namespace simgrid { diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 878a52d9e8..b0d4d98bb1 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -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) host_that_restart; +XBT_PUBLIC_DATA(std::vector) host_that_restart; extern XBT_PRIVATE double sg_sender_gap;