-/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2018. The SimGrid Team. All rights reserved. */
/* 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. */
host.extension_set(new HostEnergy(&host));
}
-static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::surf::Action::State previous)
+static void onActionStateChange(simgrid::surf::CpuAction* action, simgrid::kernel::resource::Action::State previous)
{
for (simgrid::surf::Cpu* const& cpu : action->cpus()) {
simgrid::s4u::Host* host = cpu->getHost();
static void onSimulationEnd()
{
- std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->getHostList();
+ std::vector<simgrid::s4u::Host*> hosts = simgrid::s4u::Engine::getInstance()->getAllHosts();
double total_energy = 0.0; // Total energy consumption (whole platform)
double used_hosts_energy = 0.0; // Energy consumed by hosts that computed something
void sg_host_energy_update_all()
{
simgrid::simix::kernelImmediate([]() {
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->getHostList();
+ std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::getInstance()->getAllHosts();
for (auto const& host : list)
if (dynamic_cast<simgrid::s4u::VirtualMachine*>(host) == nullptr) // Ignore virtual machines
host->extension<HostEnergy>()->update();
double sg_host_get_consumed_energy(sg_host_t host)
{
xbt_assert(HostEnergy::EXTENSION_ID.valid(),
- "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getConsumedEnergy();
}
double sg_host_get_wattmin_at(sg_host_t host, int pstate)
{
xbt_assert(HostEnergy::EXTENSION_ID.valid(),
- "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getWattMinAt(pstate);
}
/** @ingroup plugin_energy
double sg_host_get_wattmax_at(sg_host_t host, int pstate)
{
xbt_assert(HostEnergy::EXTENSION_ID.valid(),
- "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getWattMaxAt(pstate);
}
double sg_host_get_current_consumption(sg_host_t host)
{
xbt_assert(HostEnergy::EXTENSION_ID.valid(),
- "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
+ "The Energy plugin is not active. Please call sg_host_energy_plugin_init() during initialization.");
return host->extension<HostEnergy>()->getCurrentWattsValue();
}
}