X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/648a27ac5171a4e9fa142617ff7104aae77be888..2eba6b843463b01622d79c8ccc55bdffffd0454c:/examples/msg/energy-pstate/energy-pstate.c diff --git a/examples/msg/energy-pstate/energy-pstate.c b/examples/msg/energy-pstate/energy-pstate.c index ae278133dd..de0d0d1a22 100644 --- a/examples/msg/energy-pstate/energy-pstate.c +++ b/examples/msg/energy-pstate/energy-pstate.c @@ -19,13 +19,12 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(test, "Pstate properties test"); static int dvfs(int argc, char *argv[]) { double workload = 100E6; - int new_pstate = 2; msg_host_t host = MSG_host_self(); int nb = MSG_host_get_nb_pstates(host); XBT_INFO("Count of Processor states=%d", nb); - double current_peak = MSG_host_get_current_power_peak(host); + double current_peak = MSG_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak); // Run a task @@ -37,17 +36,16 @@ static int dvfs(int argc, char *argv[]) XBT_INFO("Task1 simulation time: %e", task_time); // Change power peak - if ((new_pstate >= nb) || (new_pstate < 0)) { - XBT_INFO("Cannot set pstate %d, host supports only %d pstates", new_pstate, 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_pstate); XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_pstate); MSG_host_set_pstate(host, new_pstate); - current_peak = MSG_host_get_current_power_peak(host); + current_peak = MSG_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak); // Run a second task @@ -63,7 +61,7 @@ static int dvfs(int argc, char *argv[]) int nb2 = MSG_host_get_nb_pstates(host); XBT_INFO("Count of Processor states=%d", nb2); - double current_peak2 = MSG_host_get_current_power_peak(host); + double current_peak2 = MSG_host_get_speed(host); XBT_INFO("Current power peak=%f", current_peak2); return 0; }