From: clement-dell Date: Tue, 8 Oct 2019 13:45:02 +0000 (+0200) Subject: [Energy] Missing power profiles for a host defaulted to 0 X-Git-Tag: v3.24~5^2~5 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d0ca0b57339ad99a6b5d1a49be3a4ad69fc5916c?hp=cc8d2ce4d1db8900ad36293537ce7a0f7091cc3f [Energy] Missing power profiles for a host defaulted to 0 SG will not complain with an assert as long as this host is not used --- diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index b5968923e6..a5543c46db 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -394,9 +394,17 @@ void HostEnergy::init_watts_range_list() XBT_WARN("%s", msg.c_str()); return; } + const char* all_power_values_str = host_->get_property("wattage_per_state"); - if (all_power_values_str == nullptr) + if (all_power_values_str == nullptr) { + /* If no power values are given, we assume it's 0 everywhere */ + XBT_DEBUG("No energetic profiles given for host %s, using 0 W by default.", host_->get_cname()); + for (int i = 0; i < host_->get_pstate_count(); ++i) { + PowerRange range(0,0,0); + power_range_watts_list_.push_back(range); + } return; + } std::vector all_power_values; boost::split(all_power_values, all_power_values_str, boost::is_any_of(","));