In this example, the idle consumption is 95 Watts, 93 Watts and 90 Watts in each pstate while the CPU burn consumption are at 200 Watts,
170 Watts and 150 Watts respectively.
In this example, the idle consumption is 95 Watts, 93 Watts and 90 Watts in each pstate while the CPU burn consumption are at 200 Watts,
170 Watts and 150 Watts respectively.
-To change the pstate of a given CPU, use the following functions: #MSG_host_get_nb_pstates(), #MSG_host_set_pstate(), #MSG_host_get_power_peak_at().
+To change the pstate of a given CPU, use the following functions: #MSG_host_get_nb_pstates(), simgrid#s4u#Host#set_pstate(), #MSG_host_get_power_peak_at().
-To simulate the energy-related elements, first call the #sg_energy_plugin_init() before your #MSG_init(),
-and then use the following function to retrieve the consumption of a given host: #MSG_host_get_consumed_energy().
+To simulate the energy-related elements, first call the simgrid#energy#sg_energy_plugin_init() before your #MSG_init(),
+and then use the following function to retrieve the consumption of a given host: MSG_host_get_consumed_energy().
instantaneous_consumption = this->watts_off;
else
instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
instantaneous_consumption = this->watts_off;
else
instantaneous_consumption = this->getCurrentWattsValue(cpu_load);
surf_host->getName(), start_time, finish_time, surf_host->p_cpu->m_speedPeak, previous_energy, energy_this_step);
}
surf_host->getName(), start_time, finish_time, surf_host->p_cpu->m_speedPeak, previous_energy, energy_this_step);
}
- if (host->getProperties() != NULL) {
- char* off_power_str = (char*)xbt_dict_get_or_null(host->getProperties(), "watt_off");
+ if (host->properties() != NULL) {
+ char* off_power_str = (char*)xbt_dict_get_or_null(
+ host->properties(), "watt_off");
double HostEnergy::getWattMinAt(int pstate)
{
xbt_assert(!power_range_watts_list.empty(),
double HostEnergy::getWattMinAt(int pstate)
{
xbt_assert(!power_range_watts_list.empty(),
return power_range_watts_list[pstate].first;
}
double HostEnergy::getWattMaxAt(int pstate)
{
xbt_assert(!power_range_watts_list.empty(),
return power_range_watts_list[pstate].first;
}
double HostEnergy::getWattMaxAt(int pstate)
{
xbt_assert(!power_range_watts_list.empty(),
double HostEnergy::getCurrentWattsValue(double cpu_load)
{
xbt_assert(!power_range_watts_list.empty(),
double HostEnergy::getCurrentWattsValue(double cpu_load)
{
xbt_assert(!power_range_watts_list.empty(),
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
double min_power = range.first;
double max_power = range.second;
double power_slope = max_power - min_power;
double min_power = range.first;
double max_power = range.second;
double power_slope = max_power - min_power;
xbt_assert(xbt_dynar_length(current_power_values) > 1,
"Power properties incorrectly defined - "
"could not retrieve min and max power values for host %s",
xbt_assert(xbt_dynar_length(current_power_values) > 1,
"Power properties incorrectly defined - "
"could not retrieve min and max power values for host %s",
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
return;
host.extension_set(new HostEnergy(&host));
}
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
return;
host.extension_set(new HostEnergy(&host));
}
-static void onActionStateChange(simgrid::surf::CpuAction *action,
- e_surf_action_state_t old, e_surf_action_state_t cur) {
+static void onActionStateChange(simgrid::surf::CpuAction *action, e_surf_action_state_t previous) {
const char *name = getActionCpu(action)->getName();
simgrid::surf::Host *host = sg_host_by_name(name)->extension<simgrid::surf::Host>();
simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);
const char *name = getActionCpu(action)->getName();
simgrid::surf::Host *host = sg_host_by_name(name)->extension<simgrid::surf::Host>();
simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
return;
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host)) // Ignore virtual machines
return;
// Ignore virtual machines
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host))
// Ignore virtual machines
simgrid::surf::Host* surf_host = host.extension<simgrid::surf::Host>();
if (dynamic_cast<simgrid::surf::VirtualMachine*>(surf_host))
HostEnergy *host_energy = host.extension<HostEnergy>();
host_energy->update();
XBT_INFO("Total energy of host %s: %f Joules",
HostEnergy *host_energy = host.extension<HostEnergy>();
host_energy->update();
XBT_INFO("Total energy of host %s: %f Joules",
- simgrid::Host::onCreation.connect(&onCreation);
- simgrid::Host::onStateChange.connect(&onHostStateChange);
- simgrid::Host::onDestruction.connect(&onHostDestruction);
+ simgrid::s4u::Host::onCreation.connect(&onCreation);
+ simgrid::s4u::Host::onStateChange.connect(&onHostStateChange);
+ simgrid::s4u::Host::onDestruction.connect(&onHostDestruction);