// Forwards declaration needed to make this function a friend (because friends have external linkage by default)
static void on_simulation_end();
-namespace simgrid {
-namespace plugin {
+namespace simgrid::plugin {
class PowerRange {
public:
const char* off_power_str = host_->get_property("wattage_off");
if (off_power_str != nullptr) {
try {
- this->watts_off_ = std::stod(std::string(off_power_str));
+ this->watts_off_ = std::stod(off_power_str);
} catch (const std::invalid_argument&) {
- throw std::invalid_argument(std::string("Invalid value for property wattage_off of host ") + host_->get_cname() +
- ": " + off_power_str);
+ throw std::invalid_argument("Invalid value for property wattage_off of host " + host_->get_name() + ": " +
+ off_power_str);
}
}
/* watts_off is 0 by default */
has_pstate_power_values_ = true;
}
-} // namespace plugin
-} // namespace simgrid
+} // namespace simgrid::plugin
using simgrid::plugin::HostEnergy;
simgrid::s4u::Host* host = cpu->get_iface();
if (host != nullptr) {
// If it's a VM, take the corresponding PM
- const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
- if (vm) // If it's a VM, take the corresponding PM
+ if (const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host))
host = vm->get_pm();
// Get the host_energy extension for the relevant host
simgrid::s4u::Exec::on_start_cb([](simgrid::s4u::Exec const& activity) {
if (activity.get_host_number() == 1) { // We only run on one host
simgrid::s4u::Host* host = activity.get_host();
- const simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
- if (vm != nullptr)
+ if (const auto* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host))
host = vm->get_pm();
xbt_assert(host != nullptr);
host->extension<HostEnergy>()->update();