X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b22adadfea7ebc1441083b43c6e287cdf1eaa79a..120a17a595bd3d7636a031ddaa5dc372826dba66:/examples/msg/energy-pstate/energy-pstate.c?ds=sidebyside diff --git a/examples/msg/energy-pstate/energy-pstate.c b/examples/msg/energy-pstate/energy-pstate.c index 12beaf56b9..227c1dafa3 100644 --- a/examples/msg/energy-pstate/energy-pstate.c +++ b/examples/msg/energy-pstate/energy-pstate.c @@ -19,7 +19,6 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test"); static int dvfs(int argc, char *argv[]) { double workload = 100E6; - int new_peak_index=2; msg_host_t host = MSG_host_self(); int nb = MSG_host_get_nb_pstates(host); @@ -37,15 +36,14 @@ static int dvfs(int argc, char *argv[]) XBT_INFO("Task1 simulation time: %e", task_time); // Change power peak - if ((new_peak_index >= nb) || (new_peak_index < 0)){ - XBT_INFO("Cannot set pstate %d, host supports only %d pstates", new_peak_index, nb); - return 0; - } + int new_pstate = 2; + xbt_assert(new_pstate < nb, "Cannot set the host %s at pstate %d because it only provides %d pstates.", + MSG_host_get_name(host), new_pstate, nb); - double peak_at = MSG_host_get_power_peak_at(host, new_peak_index); - XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_peak_index); + double peak_at = MSG_host_get_power_peak_at(host, new_pstate); + XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_pstate); - MSG_host_set_pstate(host, new_peak_index); + MSG_host_set_pstate(host, new_pstate); current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak);