Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use (const) references with range-based for loops.
[simgrid.git] / src / surf / plugins / host_energy.cpp
index bc636d3..6e102e4 100644 (file)
@@ -66,7 +66,7 @@ the time, and our model holds.
 ### What if the host has only one core?
 
 In this case, the parameters \b OneCore and \b AllCores are obviously the same.
-Actually, SimGrid expect an energetic profile formated as 'Idle:Running' for mono-cores hosts.
+Actually, SimGrid expect an energetic profile formatted as 'Idle:Running' for mono-cores hosts.
 If you insist on passing 3 parameters in this case, then you must have the same value for \b OneCore and \b AllCores.
 
 \code{.xml}
@@ -310,7 +310,7 @@ void HostEnergy::initWattsRangeList()
   XBT_DEBUG("%s: profile: %s, cores: %d", host->getCname(), all_power_values_str, host->getCoreCount());
 
   int i = 0;
-  for (auto current_power_values_str : all_power_values) {
+  for (auto const& current_power_values_str : all_power_values) {
     /* retrieve the power values associated with the current pstate */
     std::vector<std::string> current_power_values;
     boost::split(current_power_values, current_power_values_str, boost::is_any_of(":"));
@@ -325,7 +325,7 @@ void HostEnergy::initWattsRangeList()
       } else { // size == 3
         xbt_assert((current_power_values.at(1)) == (current_power_values.at(2)),
                    "Power properties incorrectly defined for host %s.\n"
-                   "The energy profile of mono-cores should be formated as 'Idle:FullSpeed' only.\n"
+                   "The energy profile of mono-cores should be formatted as 'Idle:FullSpeed' only.\n"
                    "If you go for a 'Idle:OneCore:AllCores' power profile on mono-cores, then OneCore and AllCores "
                    "must be equal.",
                    host->getCname());
@@ -370,7 +370,7 @@ static void onCreation(simgrid::s4u::Host& host)
 
 static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State previous)
 {
-  for (simgrid::surf::Cpu* cpu : action->cpus()) {
+  for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
     simgrid::s4u::Host* host = cpu->getHost();
     if (host != nullptr) {
 
@@ -464,7 +464,7 @@ void sg_host_energy_update_all()
   simgrid::simix::kernelImmediate([]() {
     std::vector<simgrid::s4u::Host*> list;
     simgrid::s4u::Engine::getInstance()->getHostList(&list);
-    for (auto host : list)
+    for (auto const& host : list)
       if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
         host->extension<HostEnergy>()->update();
   });