Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
2 fixes in host-energy plugin
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 8 Mar 2019 16:52:01 +0000 (17:52 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 8 Mar 2019 16:52:07 +0000 (17:52 +0100)
- When computing the current watts, consistently use the pstate that
  was set at the beginning of the previous period.
  (the pstate at the end of the period was used to determinate whether
  or not we are in boot/shutdown state, ie, whether speed==0)
- Do not mark as used hosts that are just turned on and off. This is
  to be consistent with the tesh files while fixing the other bug.

src/plugins/host_energy.cpp

index f10c827..f52746b 100644 (file)
@@ -244,7 +244,7 @@ double HostEnergy::get_current_watts_value()
   if (this->pstate_ == pstate_off_) // The host is off (or was off at the beginning of this time interval)
     return this->watts_off_;
 
-  double current_speed = host_->get_speed();
+  double current_speed = host_->get_pstate_speed(this->pstate_);
 
   double cpu_load;
 
@@ -252,16 +252,17 @@ double HostEnergy::get_current_watts_value()
     // Some users declare a pstate of speed 0 flops (e.g., to model boot time).
     // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN
     cpu_load = 1;
-  else
+  else {
     cpu_load = host_->pimpl_cpu->get_constraint()->get_usage() / current_speed;
 
-  /** Divide by the number of cores here **/
-  cpu_load /= host_->pimpl_cpu->get_core_count();
+    /** Divide by the number of cores here **/
+    cpu_load /= host_->pimpl_cpu->get_core_count();
 
-  if (cpu_load > 1) // A machine with a load > 1 consumes as much as a fully loaded machine, not more
-    cpu_load = 1;
-  if (cpu_load > 0)
-    host_was_used_ = true;
+    if (cpu_load > 1) // A machine with a load > 1 consumes as much as a fully loaded machine, not more
+      cpu_load = 1;
+    if (cpu_load > 0)
+      host_was_used_ = true;
+  }
 
   /* The problem with this model is that the load is always 0 or 1, never something less.
    * Another possibility could be to model the total energy as