Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'smpi_cpp'
[simgrid.git] / src / surf / plugins / host_energy.cpp
index 13a867d..08ab4df 100644 (file)
@@ -3,11 +3,11 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include <simgrid/s4u/engine.hpp>
 #include "simgrid/plugins/energy.h"
 #include "simgrid/simix.hpp"
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
+#include <simgrid/s4u/engine.hpp>
 #include <utility>
 
 /** @addtogroup SURF_plugin_energy
@@ -170,7 +170,7 @@ double HostEnergy::getCurrentWattsValue(double cpu_load)
 {
   xbt_assert(!power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
 
-  /* min_power corresponds to the idle power (cpu load = 0) */
+  /* min_power corresponds to the power consumed when only one core is active */
   /* max_power is the power consumed at 100% cpu load       */
   auto range           = power_range_watts_list.at(host->pstate());
   double current_power = 0;
@@ -325,14 +325,6 @@ static void onSimulationEnd()
   XBT_INFO("Summed energy consumption: %f Joules; used hosts consumed: %f Joules; unused (idle) hosts consumed: %f",
            total_energy, used_hosts_energy, total_energy - used_hosts_energy);
 }
-  sg_host_t* host_list = sg_host_list();
-  int host_count       = sg_host_count();
-  double energy        = 0.0;
-  for (int i = 0; i < host_count; i++) {
-    energy += host_list[i]->extension<HostEnergy>()->getConsumedEnergy();
-  }
-  XBT_INFO("Summed energy consumption: %f Joules", energy);
-}
 
 /* **************************** Public interface *************************** */
 SG_BEGIN_DECL()