Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecate the is_off() methods.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 11 Feb 2019 19:40:35 +0000 (20:40 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 12 Feb 2019 16:30:02 +0000 (17:30 +0100)
They are simply the negation of is_on() and, when the two forms are defined,
we may wonder if there is some kind of intermediate state neither on(), nor
off().

26 files changed:
include/simgrid/host.h
include/simgrid/kernel/resource/Resource.hpp
include/simgrid/msg.h
include/simgrid/s4u/Host.hpp
include/simgrid/s4u/Link.hpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/SleepImpl.cpp
src/kernel/context/Context.cpp
src/kernel/resource/Resource.cpp
src/msg/msg_legacy.cpp
src/plugins/vm/VirtualMachineImpl.cpp
src/plugins/vm/VmLiveMigration.cpp
src/s4u/s4u_Host.cpp
src/s4u/s4u_Link.cpp
src/simix/ActorImpl.cpp
src/simix/smx_host.cpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/smpi/plugins/load_balancer/LoadBalancer.cpp
src/surf/StorageImpl.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_ti.cpp
src/surf/network_cm02.cpp
src/surf/network_interface.cpp
src/surf/ptask_L07.cpp
src/surf/storage_n11.cpp

index f59db85..0289c05 100644 (file)
@@ -101,7 +101,7 @@ XBT_PUBLIC void sg_host_set_pstate(sg_host_t host, int pstate);
 XBT_PUBLIC void sg_host_turn_on(sg_host_t host);
 XBT_PUBLIC void sg_host_turn_off(sg_host_t host);
 XBT_PUBLIC int sg_host_is_on(sg_host_t host);
 XBT_PUBLIC void sg_host_turn_on(sg_host_t host);
 XBT_PUBLIC void sg_host_turn_off(sg_host_t host);
 XBT_PUBLIC int sg_host_is_on(sg_host_t host);
-XBT_PUBLIC int sg_host_is_off(sg_host_t host);
+XBT_ATTRIB_DEPRECATED_v325("Please use !sg_host_is_on()") XBT_PUBLIC int sg_host_is_off(sg_host_t host);
 
 /** @ingroup m_host_management
  * @brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
 
 /** @ingroup m_host_management
  * @brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
index fa581d1..ced4543 100644 (file)
@@ -58,7 +58,7 @@ public:
   /** @brief Check if the current Resource is active */
   virtual bool is_on() const;
   /** @brief Check if the current Resource is shut down */
   /** @brief Check if the current Resource is active */
   virtual bool is_on() const;
   /** @brief Check if the current Resource is shut down */
-  virtual bool is_off() const;
+  XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") virtual bool is_off() const;
   /** @brief Turn on the current Resource */
   virtual void turn_on();
   /** @brief Turn off the current Resource */
   /** @brief Turn on the current Resource */
   virtual void turn_on();
   /** @brief Turn off the current Resource */
index 97087ae..1014114 100644 (file)
@@ -110,18 +110,18 @@ XBT_PUBLIC int MSG_host_get_pstate(sg_host_t host);
 XBT_PUBLIC void MSG_host_set_pstate(sg_host_t host, int pstate);
 /** @brief Start the host if it is off
  *
 XBT_PUBLIC void MSG_host_set_pstate(sg_host_t host, int pstate);
 /** @brief Start the host if it is off
  *
- * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref SURF_plugin_energy
+ * See also #MSG_host_is_on() to test the current state of the host and @ref SURF_plugin_energy
  * for more info on DVFS.
  */
 XBT_PUBLIC void MSG_host_on(sg_host_t h);
 /** @brief Stop the host if it is on
  *
  * for more info on DVFS.
  */
 XBT_PUBLIC void MSG_host_on(sg_host_t h);
 /** @brief Stop the host if it is on
  *
- * See also MSG_host_is_on() and MSG_host_is_off() to test the current state of the host and @ref SURF_plugin_energy
+ * See also MSG_host_is_on() to test the current state of the host and @ref SURF_plugin_energy
  * for more info on DVFS.
  */
 XBT_PUBLIC void MSG_host_off(sg_host_t h);
 XBT_PUBLIC int MSG_host_is_on(sg_host_t h);
  * for more info on DVFS.
  */
 XBT_PUBLIC void MSG_host_off(sg_host_t h);
 XBT_PUBLIC int MSG_host_is_on(sg_host_t h);
-XBT_PUBLIC int MSG_host_is_off(sg_host_t h);
+XBT_ATTRIB_DEPRECATED_v325("Please use !MSG_host_is_on()") XBT_PUBLIC int MSG_host_is_off(sg_host_t h);
 XBT_PUBLIC xbt_dict_t MSG_host_get_properties(sg_host_t host);
 XBT_PUBLIC const char* MSG_host_get_property_value(sg_host_t host, const char* name);
 XBT_PUBLIC void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value);
 XBT_PUBLIC xbt_dict_t MSG_host_get_properties(sg_host_t host);
 XBT_PUBLIC const char* MSG_host_get_property_value(sg_host_t host, const char* name);
 XBT_PUBLIC void MSG_host_set_property_value(sg_host_t host, const char* name, const char* value);
index 45bfeb1..f39f06f 100644 (file)
@@ -95,7 +95,7 @@ public:
   /** Returns if that host is currently up and running */
   bool is_on() const;
   /** Returns if that host is currently down and offline */
   /** Returns if that host is currently up and running */
   bool is_on() const;
   /** Returns if that host is currently down and offline */
-  bool is_off() const { return not is_on(); }
+  XBT_ATTRIB_DEPRECATED_v325("Please use !is_on()") bool is_off() const { return not is_on(); }
 
   const char* get_property(std::string key) const;
   void set_property(std::string key, std::string value);
 
   const char* get_property(std::string key) const;
   void set_property(std::string key, std::string value);
@@ -188,7 +188,7 @@ public:
   /** @deprecated See Host::is_on() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_on()") bool isOn() { return is_on(); }
   /** @deprecated See Host::is_off() */
   /** @deprecated See Host::is_on() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_on()") bool isOn() { return is_on(); }
   /** @deprecated See Host::is_off() */
-  XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_off()") bool isOff() { return is_off(); }
+  XBT_ATTRIB_DEPRECATED_v323("Please use Host::is_off()") bool isOff() { return not is_on(); }
   /** @deprecated See Host::get_property() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_property()") const char* getProperty(const char* key)
   {
   /** @deprecated See Host::get_property() */
   XBT_ATTRIB_DEPRECATED_v323("Please use Host::get_property()") const char* getProperty(const char* key)
   {
index c34383a..29a2412 100644 (file)
@@ -62,7 +62,6 @@ public:
   void turn_on();
   bool is_on() const;
   void turn_off();
   void turn_on();
   bool is_on() const;
   void turn_off();
-  bool is_off() const;
 
   void* get_data(); /** Should be used only from the C interface. Prefer extensions in C++ */
   void set_data(void* d);
 
   void* get_data(); /** Should be used only from the C interface. Prefer extensions in C++ */
   void set_data(void* d);
index 5da186d..cac429a 100644 (file)
@@ -91,7 +91,7 @@ void ExecImpl::set_priority(double priority)
 
 void ExecImpl::post()
 {
 
 void ExecImpl::post()
 {
-  if (host_ && host_->is_off()) { /* FIXME: handle resource failure for parallel tasks too */
+  if (host_ && not host_->is_on()) { /* FIXME: handle resource failure for parallel tasks too */
     /* If the host running the synchro failed, notice it. This way, the asking
      * process can be killed if it runs on that host itself */
     state_ = SIMIX_FAILED;
     /* If the host running the synchro failed, notice it. This way, the asking
      * process can be killed if it runs on that host itself */
     state_ = SIMIX_FAILED;
index ea0fe2d..f666d03 100644 (file)
@@ -42,7 +42,7 @@ void SleepImpl::post()
     smx_simcall_t simcall = simcalls_.front();
     simcalls_.pop_front();
     e_smx_state_t result;
     smx_simcall_t simcall = simcalls_.front();
     simcalls_.pop_front();
     e_smx_state_t result;
-    if (host_ && host_->is_off()) {
+    if (host_ && not host_->is_on()) {
       /* If the host running the synchro failed, notice it. This way, the asking
        * actor can be killed if it runs on that host itself */
       result = SIMIX_SRC_HOST_FAILURE;
       /* If the host running the synchro failed, notice it. This way, the asking
        * actor can be killed if it runs on that host itself */
       result = SIMIX_SRC_HOST_FAILURE;
@@ -64,7 +64,7 @@ void SleepImpl::post()
         THROW_IMPOSSIBLE;
         break;
     }
         THROW_IMPOSSIBLE;
         break;
     }
-    if (simcall->issuer->host_->is_off()) {
+    if (not simcall->issuer->host_->is_on()) {
       simcall->issuer->context_->iwannadie = true;
     }
     simcall_process_sleep__set__result(simcall, result);
       simcall->issuer->context_->iwannadie = true;
     }
     simcall_process_sleep__set__result(simcall, result);
index 9d66f8c..5831381 100644 (file)
@@ -86,7 +86,7 @@ void Context::stop()
 {
   actor_->finished_ = true;
 
 {
   actor_->finished_ = true;
 
-  if (actor_->auto_restart_ && actor_->host_->is_off()) {
+  if (actor_->auto_restart_ && not actor_->host_->is_on()) {
     XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", actor_->host_->get_cname(),
               actor_->get_cname());
     watched_hosts.insert(actor_->host_->get_cname());
     XBT_DEBUG("Insert host %s to watched_hosts because it's off and %s needs to restart", actor_->host_->get_cname(),
               actor_->get_cname());
     watched_hosts.insert(actor_->host_->get_cname());
index e835455..28d84cf 100644 (file)
@@ -23,7 +23,7 @@ bool Resource::is_on() const
 {
   return is_on_;
 }
 {
   return is_on_;
 }
-bool Resource::is_off() const
+bool Resource::is_off() const // deprecated
 {
   return not is_on_;
 }
 {
   return not is_on_;
 }
index 7636c9d..578f862 100644 (file)
@@ -283,9 +283,9 @@ int MSG_host_is_on(sg_host_t h)
 {
   return sg_host_is_on(h);
 }
 {
   return sg_host_is_on(h);
 }
-int MSG_host_is_off(sg_host_t h)
+int MSG_host_is_off(sg_host_t h) // deprecated
 {
 {
-  return sg_host_is_off(h);
+  return not sg_host_is_on(h);
 }
 xbt_dict_t MSG_host_get_properties(sg_host_t host)
 {
 }
 xbt_dict_t MSG_host_get_properties(sg_host_t host)
 {
index 3ea3633..2d0b97d 100644 (file)
@@ -42,7 +42,7 @@ const double virt_overhead = 1; // 0.95
 
 static void hostStateChange(s4u::Host& host)
 {
 
 static void hostStateChange(s4u::Host& host)
 {
-  if (host.is_off()) { // just turned off.
+  if (not host.is_on()) { // just turned off.
     std::vector<s4u::VirtualMachine*> trash;
     /* Find all VMs living on that host */
     for (s4u::VirtualMachine* const& vm : VirtualMachineImpl::allVms_)
     std::vector<s4u::VirtualMachine*> trash;
     /* Find all VMs living on that host */
     for (s4u::VirtualMachine* const& vm : VirtualMachineImpl::allVms_)
index 8d40812..209ec15 100644 (file)
@@ -326,10 +326,10 @@ void sg_vm_migrate(simgrid::s4u::VirtualMachine* vm, simgrid::s4u::Host* dst_pm)
 {
   simgrid::s4u::Host* src_pm = vm->get_pm();
 
 {
   simgrid::s4u::Host* src_pm = vm->get_pm();
 
-  if (src_pm->is_off())
+  if (not src_pm->is_on())
     THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->get_cname(),
            src_pm->get_cname());
     THROWF(vm_error, 0, "Cannot migrate VM '%s' from host '%s', which is offline.", vm->get_cname(),
            src_pm->get_cname());
-  if (dst_pm->is_off())
+  if (not dst_pm->is_on())
     THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->get_cname(), dst_pm->get_cname());
   if (vm->get_state() != simgrid::s4u::VirtualMachine::state::RUNNING)
     THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->get_cname());
     THROWF(vm_error, 0, "Cannot migrate VM '%s' to host '%s', which is offline.", vm->get_cname(), dst_pm->get_cname());
   if (vm->get_state() != simgrid::s4u::VirtualMachine::state::RUNNING)
     THROWF(vm_error, 0, "Cannot migrate VM '%s' that is not running yet.", vm->get_cname());
index 3c5e613..515f776 100644 (file)
@@ -84,7 +84,7 @@ Host* Host::current()
 
 void Host::turn_on()
 {
 
 void Host::turn_on()
 {
-  if (is_off()) {
+  if (not is_on()) {
     simgrid::simix::simcall([this] {
       this->pimpl_cpu->turn_on();
       this->pimpl_->turn_on();
     simgrid::simix::simcall([this] {
       this->pimpl_cpu->turn_on();
       this->pimpl_->turn_on();
@@ -490,7 +490,7 @@ void sg_host_set_pstate(sg_host_t host, int pstate)
  *
  * @brief Start the host if it is off
  *
  *
  * @brief Start the host if it is off
  *
- * See also #sg_host_is_on() and #sg_host_is_off() to test the current state of the host and @ref plugin_energy
+ * See also #sg_host_is_on() to test the current state of the host and @ref plugin_energy
  * for more info on DVFS.
  */
 void sg_host_turn_on(sg_host_t host)
  * for more info on DVFS.
  */
 void sg_host_turn_on(sg_host_t host)
@@ -502,7 +502,7 @@ void sg_host_turn_on(sg_host_t host)
  *
  * @brief Stop the host if it is on
  *
  *
  * @brief Stop the host if it is on
  *
- * See also #MSG_host_is_on() and #MSG_host_is_off() to test the current state of the host and @ref plugin_energy
+ * See also #MSG_host_is_on() to test the current state of the host and @ref plugin_energy
  * for more info on DVFS.
  */
 void sg_host_turn_off(sg_host_t host)
  * for more info on DVFS.
  */
 void sg_host_turn_off(sg_host_t host)
@@ -524,15 +524,10 @@ int sg_host_is_on(sg_host_t host)
   return host->is_on();
 }
 
   return host->is_on();
 }
 
-/** @ingroup m_host_management
- * @brief Determine if a host is currently off.
- *
- * See also #sg_host_turn_on() and #sg_host_turn_off() to switch the host ON and OFF and @ref plugin_energy for more
- * info on DVFS.
- */
+/** @deprecated */
 int sg_host_is_off(sg_host_t host)
 {
 int sg_host_is_off(sg_host_t host)
 {
-  return host->is_off();
+  return not host->is_on();
 }
 
 /** @brief Get the properties of a host */
 }
 
 /** @brief Get the properties of a host */
index b3470e5..d09897b 100644 (file)
@@ -82,10 +82,6 @@ bool Link::is_on() const
 {
   return this->pimpl_->is_on();
 }
 {
   return this->pimpl_->is_on();
 }
-bool Link::is_off() const
-{
-  return this->pimpl_->is_off();
-}
 
 void* Link::get_data()
 {
 
 void* Link::get_data()
 {
index eb14cb6..f81c789 100644 (file)
@@ -115,7 +115,7 @@ void ActorImpl::exit()
   exception           = nullptr;
 
   // Forcefully kill the actor if its host is turned off. Not a HostFailureException because you should not survive that
   exception           = nullptr;
 
   // Forcefully kill the actor if its host is turned off. Not a HostFailureException because you should not survive that
-  if (host_->is_off())
+  if (not host_->is_on())
     this->throw_exception(std::make_exception_ptr(simgrid::kernel::context::StopRequest("host failed")));
 
   /* destroy the blocking synchro if any */
     this->throw_exception(std::make_exception_ptr(simgrid::kernel::context::StopRequest("host failed")));
 
   /* destroy the blocking synchro if any */
@@ -279,7 +279,7 @@ void ActorImpl::resume()
 
 smx_activity_t ActorImpl::sleep(double duration)
 {
 
 smx_activity_t ActorImpl::sleep(double duration)
 {
-  if (host_->is_off())
+  if (not host_->is_on())
     throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
         XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there.")));
 
     throw_exception(std::make_exception_ptr(simgrid::HostFailureException(
         XBT_THROW_POINT, std::string("Host ") + std::string(host_->get_cname()) + " failed, you cannot sleep there.")));
 
@@ -349,7 +349,7 @@ ActorImplPtr ActorImpl::create(std::string name, simgrid::simix::ActorCode code,
 
   XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
 
 
   XBT_DEBUG("Start actor %s@'%s'", name.c_str(), host->get_cname());
 
-  if (host->is_off()) {
+  if (not host->is_on()) {
     XBT_WARN("Cannot launch actor '%s' on failed host '%s'", name.c_str(), host->get_cname());
     return nullptr;
   }
     XBT_WARN("Cannot launch actor '%s' on failed host '%s'", name.c_str(), host->get_cname());
     return nullptr;
   }
@@ -417,7 +417,7 @@ smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostn
   sg_host_t host = sg_host_by_name(hostname);
   XBT_DEBUG("Attach process %s on host '%s'", name, hostname);
 
   sg_host_t host = sg_host_by_name(hostname);
   XBT_DEBUG("Attach process %s on host '%s'", name, hostname);
 
-  if (host->is_off()) {
+  if (not host->is_on()) {
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, hostname);
     return nullptr;
   }
     XBT_WARN("Cannot launch process '%s' on failed host '%s'", name, hostname);
     return nullptr;
   }
index 597021e..fa667b6 100644 (file)
@@ -129,9 +129,9 @@ void SIMIX_execution_finish(smx_activity_t synchro)
     simcall_execution_wait__set__result(simcall, exec->state_);
 
     /* Fail the process if the host is down */
     simcall_execution_wait__set__result(simcall, exec->state_);
 
     /* Fail the process if the host is down */
-    if (simcall->issuer->host_->is_off())
-      simcall->issuer->context_->iwannadie = true;
-    else
+    if (simcall->issuer->host_->is_on())
       SIMIX_simcall_answer(simcall);
       SIMIX_simcall_answer(simcall);
+    else
+      simcall->issuer->context_->iwannadie = true;
   }
 }
   }
 }
index 24947e8..bb18ed0 100644 (file)
@@ -54,9 +54,9 @@ void SIMIX_io_finish(smx_activity_t synchro)
     }
 
     simcall->issuer->waiting_synchro = nullptr;
     }
 
     simcall->issuer->waiting_synchro = nullptr;
-    if (simcall->issuer->host_->is_off())
-      simcall->issuer->context_->iwannadie = true;
-    else
+    if (simcall->issuer->host_->is_on())
       SIMIX_simcall_answer(simcall);
       SIMIX_simcall_answer(simcall);
+    else
+      simcall->issuer->context_->iwannadie = true;
   }
 }
   }
 }
index ed7189c..06e856a 100644 (file)
@@ -520,7 +520,7 @@ void SIMIX_comm_finish(smx_activity_t synchro)
 
     /* Check out for errors */
 
 
     /* Check out for errors */
 
-    if (simcall->issuer->host_->is_off()) {
+    if (not simcall->issuer->host_->is_on()) {
       simcall->issuer->context_->iwannadie = true;
       simcall->issuer->exception =
           std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
       simcall->issuer->context_->iwannadie = true;
       simcall->issuer->exception =
           std::make_exception_ptr(simgrid::HostFailureException(XBT_THROW_POINT, "Host failed"));
@@ -640,10 +640,10 @@ void SIMIX_comm_finish(smx_activity_t synchro)
       }
     }
 
       }
     }
 
-    if (simcall->issuer->host_->is_off())
-      simcall->issuer->context_->iwannadie = true;
-    else
+    if (simcall->issuer->host_->is_on())
       SIMIX_simcall_answer(simcall);
       SIMIX_simcall_answer(simcall);
+    else
+      simcall->issuer->context_->iwannadie = true;
   }
 }
 
   }
 }
 
index 2b6ea9d..987ce39 100644 (file)
@@ -53,9 +53,8 @@ LoadBalancer::~LoadBalancer()
 void LoadBalancer::run()
 {
   simgrid::s4u::Engine* engine                     = simgrid::s4u::Engine::get_instance();
 void LoadBalancer::run()
 {
   simgrid::s4u::Engine* engine                     = simgrid::s4u::Engine::get_instance();
-  std::vector<simgrid::s4u::Host*> available_hosts = engine->get_filtered_hosts([](simgrid::s4u::Host* host) {
-    return not host->is_off();
-  });
+  std::vector<simgrid::s4u::Host*> available_hosts =
+      engine->get_filtered_hosts([](simgrid::s4u::Host* host) { return host->is_on(); });
   xbt_assert(available_hosts.size() > 0, "No hosts available; are they all switched off?");
 
   // TODO: Account for daemon background load (-> use especially the availability file)
   xbt_assert(available_hosts.size() > 0, "No hosts available; are they all switched off?");
 
   // TODO: Account for daemon background load (-> use especially the availability file)
index c709305..0053a4f 100644 (file)
@@ -81,7 +81,7 @@ void StorageImpl::apply_event(kernel::profile::Event* /*event*/, double /*value*
 
 void StorageImpl::turn_on()
 {
 
 void StorageImpl::turn_on()
 {
-  if (is_off()) {
+  if (not is_on()) {
     Resource::turn_on();
     s4u::Storage::on_state_change(this->piface_);
   }
     Resource::turn_on();
     s4u::Storage::on_state_change(this->piface_);
   }
index c3ca28c..ab669d9 100644 (file)
@@ -130,7 +130,7 @@ void CpuCas01::apply_event(kernel::profile::Event* event, double value)
     xbt_assert(get_core_count() == 1, "FIXME: add state change code also for constraint_core[i]");
 
     if (value > 0) {
     xbt_assert(get_core_count() == 1, "FIXME: add state change code also for constraint_core[i]");
 
     if (value > 0) {
-      if (is_off()) {
+      if (not is_on()) {
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
@@ -163,12 +163,13 @@ void CpuCas01::apply_event(kernel::profile::Event* event, double value)
 /** @brief Start a new execution on this CPU lasting @param size flops and using one core */
 CpuAction* CpuCas01::execution_start(double size)
 {
 /** @brief Start a new execution on this CPU lasting @param size flops and using one core */
 CpuAction* CpuCas01::execution_start(double size)
 {
-  return new CpuCas01Action(get_model(), size, is_off(), speed_.scale * speed_.peak, get_constraint());
+  return new CpuCas01Action(get_model(), size, not is_on(), speed_.scale * speed_.peak, get_constraint());
 }
 
 CpuAction* CpuCas01::execution_start(double size, int requested_cores)
 {
 }
 
 CpuAction* CpuCas01::execution_start(double size, int requested_cores)
 {
-  return new CpuCas01Action(get_model(), size, is_off(), speed_.scale * speed_.peak, get_constraint(), requested_cores);
+  return new CpuCas01Action(get_model(), size, not is_on(), speed_.scale * speed_.peak, get_constraint(),
+                            requested_cores);
 }
 
 CpuAction* CpuCas01::sleep(double duration)
 }
 
 CpuAction* CpuCas01::sleep(double duration)
@@ -177,7 +178,8 @@ CpuAction* CpuCas01::sleep(double duration)
     duration = std::max(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", get_cname(), duration);
     duration = std::max(duration, sg_surf_precision);
 
   XBT_IN("(%s,%g)", get_cname(), duration);
-  CpuCas01Action* action = new CpuCas01Action(get_model(), 1.0, is_off(), speed_.scale * speed_.peak, get_constraint());
+  CpuCas01Action* action =
+      new CpuCas01Action(get_model(), 1.0, not is_on(), speed_.scale * speed_.peak, get_constraint());
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->set_max_duration(duration);
 
   // FIXME: sleep variables should not consume 1.0 in System::expand()
   action->set_max_duration(duration);
index 35c0c03..0f5809f 100644 (file)
@@ -400,7 +400,7 @@ void CpuTi::apply_event(kernel::profile::Event* event, double value)
 
   } else if (event == state_event_) {
     if (value > 0) {
 
   } else if (event == state_event_) {
     if (value > 0) {
-      if (is_off()) {
+      if (not is_on()) {
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
@@ -583,7 +583,7 @@ void CpuTi::set_modified(bool modified)
  * Action *
  **********/
 
  * Action *
  **********/
 
-CpuTiAction::CpuTiAction(CpuTi* cpu, double cost) : CpuAction(cpu->get_model(), cost, cpu->is_off()), cpu_(cpu)
+CpuTiAction::CpuTiAction(CpuTi* cpu, double cost) : CpuAction(cpu->get_model(), cost, not cpu->is_on()), cpu_(cpu)
 {
   cpu_->set_modified(true);
 }
 {
   cpu_->set_modified(true);
 }
index 1c75de1..3deb80e 100644 (file)
@@ -222,12 +222,13 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
              src->get_cname(), dst->get_cname());
 
              "You're trying to send data from %s to %s but there is no connecting path between these two hosts.",
              src->get_cname(), dst->get_cname());
 
-  bool failed = std::any_of(route.begin(), route.end(), [](const LinkImpl* link) { return link->is_off(); });
+  bool failed = std::any_of(route.begin(), route.end(), [](const LinkImpl* link) { return not link->is_on(); });
 
   if (cfg_crosstraffic) {
     dst->route_to(src, back_route, nullptr);
     if (not failed)
 
   if (cfg_crosstraffic) {
     dst->route_to(src, back_route, nullptr);
     if (not failed)
-      failed = std::any_of(back_route.begin(), back_route.end(), [](const LinkImpl* link) { return link->is_off(); });
+      failed =
+          std::any_of(back_route.begin(), back_route.end(), [](const LinkImpl* link) { return not link->is_on(); });
   }
 
   NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
   }
 
   NetworkCm02Action *action = new NetworkCm02Action(this, size, failed);
index 6d2a96e..9bdcd82 100644 (file)
@@ -126,7 +126,7 @@ s4u::Link::SharingPolicy LinkImpl::get_sharing_policy()
 
 void LinkImpl::turn_on()
 {
 
 void LinkImpl::turn_on()
 {
-  if (is_off()) {
+  if (not is_on()) {
     Resource::turn_on();
     s4u::Link::on_state_change(this->piface_);
   }
     Resource::turn_on();
     s4u::Link::on_state_change(this->piface_);
   }
index acda211..9668d51 100644 (file)
@@ -121,7 +121,7 @@ void HostL07Model::update_actions_state(double /*now*/, double delta)
       while (cnst != nullptr) {
         i++;
         void* constraint_id = cnst->get_id();
       while (cnst != nullptr) {
         i++;
         void* constraint_id = cnst->get_id();
-        if (static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->is_off()) {
+        if (not static_cast<simgrid::kernel::resource::Resource*>(constraint_id)->is_on()) {
           XBT_DEBUG("Action (%p) Failed!!", &action);
           action.finish(kernel::resource::Action::State::FAILED);
           break;
           XBT_DEBUG("Action (%p) Failed!!", &action);
           action.finish(kernel::resource::Action::State::FAILED);
           break;
@@ -324,7 +324,7 @@ void CpuL07::apply_event(kernel::profile::Event* triggered, double value)
 
   } else if (triggered == state_event_) {
     if (value > 0) {
 
   } else if (triggered == state_event_) {
     if (value > 0) {
-      if (is_off()) {
+      if (not is_on()) {
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
         XBT_VERB("Restart processes on host %s", get_host()->get_cname());
         get_host()->turn_on();
       }
index 31693c9..2b12036 100644 (file)
@@ -101,17 +101,17 @@ StorageN11::StorageN11(StorageModel* model, std::string name, kernel::lmm::Syste
 
 StorageAction* StorageN11::io_start(sg_size_t size, s4u::Io::OpType type)
 {
 
 StorageAction* StorageN11::io_start(sg_size_t size, s4u::Io::OpType type)
 {
-  return new StorageN11Action(get_model(), size, is_off(), this, type);
+  return new StorageN11Action(get_model(), size, not is_on(), this, type);
 }
 
 StorageAction* StorageN11::read(sg_size_t size)
 {
 }
 
 StorageAction* StorageN11::read(sg_size_t size)
 {
-  return new StorageN11Action(get_model(), size, is_off(), this, s4u::Io::OpType::READ);
+  return new StorageN11Action(get_model(), size, not is_on(), this, s4u::Io::OpType::READ);
 }
 
 StorageAction* StorageN11::write(sg_size_t size)
 {
 }
 
 StorageAction* StorageN11::write(sg_size_t size)
 {
-  return new StorageN11Action(get_model(), size, is_off(), this, s4u::Io::OpType::WRITE);
+  return new StorageN11Action(get_model(), size, not is_on(), this, s4u::Io::OpType::WRITE);
 }
 
 /**********
 }
 
 /**********