- const char* old_prop = host_->get_property("watt_per_state");
- if (old_prop != nullptr) {
- std::vector<std::string> all_power_values;
- boost::split(all_power_values, old_prop, boost::is_any_of(","));
-
- xbt_assert(all_power_values.size() == (unsigned)host_->get_pstate_count(),
- "Invalid XML file. Found %zu energetic profiles for %d pstates", all_power_values.size(),
- host_->get_pstate_count());
-
- // XBT_ATTRIB_DEPRECATED_v327: puting this macro name here so that we find it during the deprecation cleanups of v3.28
- std::string msg = std::string("DEPRECATION WARNING: Property 'watt_per_state' will only work until v3.28.\n");
- msg += std::string("The old syntax 'Idle:OneCore:AllCores' must be converted into 'Idle:Epsilon:AllCores' to "
- "properly model the consumption of non-whole tasks on mono-core hosts. Here are the values to "
- "use for host '") +
- host_->get_cname() + "' in your XML file:\n";
- msg += " <prop id=\"wattage_per_state\" value=\"";
- for (auto const& current_power_values_str : all_power_values) {
- std::vector<std::string> current_power_values;
- boost::split(current_power_values, current_power_values_str, boost::is_any_of(":"));
- double p_idle = xbt_str_parse_double((current_power_values.at(0)).c_str(),
- "Invalid obsolete XML file. Fix your watt_per_state property.");
- double p_one_core;
- double p_full;
- double p_epsilon;
-
- if (current_power_values.size() == 3) {
- p_one_core = xbt_str_parse_double((current_power_values.at(1)).c_str(),
- "Invalid obsolete XML file. Fix your watt_per_state property.");
- p_full = xbt_str_parse_double((current_power_values.at(2)).c_str(),
- "Invalid obsolete XML file. Fix your watt_per_state property.");
- if (host_->get_core_count() == 1) {
- p_epsilon = p_full;
- } else {
- p_epsilon = p_one_core - ((p_full - p_one_core) / (host_->get_core_count() - 1));
- }
- } else { // consuption given with idle and full only
- p_full = xbt_str_parse_double((current_power_values.at(1)).c_str(),
- "Invalid obsolete XML file. Fix your watt_per_state property.");
- if (host_->get_core_count() == 1) {
- p_epsilon = p_full;
- } else {
- p_epsilon = p_idle;
- }
- }
-
- PowerRange range(p_idle, p_epsilon, p_full);
- power_range_watts_list_.push_back(range);
-
- msg += std::to_string(p_idle) + ":" + std::to_string(p_epsilon) + ":" + std::to_string(p_full);
- msg += ",";
- }
- msg.pop_back(); // Remove the extraneous ','
- msg += "\" />";
- XBT_WARN("%s", msg.c_str());
- return;
- }
-