### 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}
double energy_this_step = instantaneous_consumption * (finish_time - start_time);
- // TODO Trace: Trace energy_this_step from start_time to finish_time in host->name()
+ // TODO Trace: Trace energy_this_step from start_time to finish_time in host->getName()
this->total_energy = previous_energy + energy_this_step;
this->last_updated = finish_time;
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(":"));
} 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());
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(&host)) // Ignore virtual machines
return;
- //TODO Trace: set to zero the energy variable associated to host->name()
+ // TODO Trace: set to zero the energy variable associated to host->getName()
host.extension_set(new HostEnergy(&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) {
}
/* **************************** Public interface *************************** */
-SG_BEGIN_DECL()
+extern "C" {
/** \ingroup plugin_energy
* \brief Enable host energy plugin
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();
});
double cpu_load = lmm_constraint_get_usage(host->pimpl_cpu->constraint()) / host->getSpeed();
return host->extension<HostEnergy>()->getCurrentWattsValue(cpu_load);
}
-
-SG_END_DECL()
+}