From: Martin Quinson Date: Tue, 3 Feb 2015 00:58:49 +0000 (+0100) Subject: partially fix the energy public API (massive renames ongoing) X-Git-Tag: v3_12~760^2~17 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/971798e3427c72588306145e764b25f7fac5dd59 partially fix the energy public API (massive renames ongoing) --- diff --git a/examples/msg/energy/e1/e1.c b/examples/msg/energy/e1/e1.c index 6a3085d3df..bfbb0c0ae8 100644 --- a/examples/msg/energy/e1/e1.c +++ b/examples/msg/energy/e1/e1.c @@ -38,10 +38,10 @@ int dvfs(int argc, char *argv[]) int new_peak_index=2; host = MSG_host_self();; //MSG_get_host_by_name("MyHost1"); - int nb = MSG_get_host_nb_pstates(host); + int nb = MSG_host_get_pstate_number(host); XBT_INFO("Number of Processor states=%d", nb); - double current_peak = MSG_get_host_current_power_peak(host); + double current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); // Run a task @@ -59,12 +59,12 @@ int dvfs(int argc, char *argv[]) return 0; } - double peak_at = MSG_get_host_power_peak_at(host, new_peak_index); + 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); - MSG_set_host_power_peak_at(host, new_peak_index); + MSG_host_set_pstate(host, new_peak_index); - current_peak = MSG_get_host_current_power_peak(host); + current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); // Run a second task @@ -78,10 +78,10 @@ int dvfs(int argc, char *argv[]) // Verify the default pstate is set to 0 host = MSG_get_host_by_name("MyHost2"); - int nb2 = MSG_get_host_nb_pstates(host); + int nb2 = MSG_host_get_pstate_number(host); XBT_INFO("Number of Processor states=%d", nb2); - double current_peak2 = MSG_get_host_current_power_peak(host); + double current_peak2 = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak2); return 0; } diff --git a/examples/msg/energy/e2/e2.c b/examples/msg/energy/e2/e2.c index ee19dd82d0..8ba1d79002 100644 --- a/examples/msg/energy/e2/e2.c +++ b/examples/msg/energy/e2/e2.c @@ -30,14 +30,14 @@ int dvfs(int argc, char *argv[]) XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host,"watt_per_state")); XBT_INFO("Initial power peak=%.0E flop/s; Consumed energy (Joules)=%.0E J", - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); double start = MSG_get_clock(); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); XBT_INFO("Done sleeping (duration: %.2f s). Current power peak=%.0E; Current consumed energy=%.2f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // Run a task start = MSG_get_clock(); @@ -47,15 +47,15 @@ int dvfs(int argc, char *argv[]) MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); // ========= Change power peak ========= int pstate=2; - MSG_set_host_power_peak_at(host, pstate); + MSG_host_set_pstate(host, pstate); XBT_INFO("========= Requesting pstate %d (power should be of %.2f flop/s and is of %.2f flop/s", pstate, - MSG_get_host_power_peak_at(host, pstate), - MSG_get_host_current_power_peak(host)); + MSG_host_get_power_peak_at(host, pstate), + MSG_host_get_current_power_peak(host)); // Run a second task start = MSG_get_clock(); @@ -65,14 +65,14 @@ int dvfs(int argc, char *argv[]) MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); start = MSG_get_clock(); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(4); XBT_INFO("Done sleeping (duration: %.2f s). Current power peak=%.0E flop/s; Current consumed energy=%.0f J", MSG_get_clock()-start, - MSG_get_host_current_power_peak(host), MSG_get_host_consumed_energy(host)); + MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host)); return 0; } diff --git a/examples/msg/energy/e3/e3.c b/examples/msg/energy/e3/e3.c index 1eab1b8cf8..57d3c99e62 100644 --- a/examples/msg/energy/e3/e3.c +++ b/examples/msg/energy/e3/e3.c @@ -59,10 +59,10 @@ static int dvfs(int argc, char *argv[]) double task_time = 0; host = MSG_host_self(); - double current_peak = MSG_get_host_current_power_peak(host); + double current_peak = MSG_host_get_current_power_peak(host); XBT_INFO("Current power peak=%f", current_peak); - double consumed_energy = MSG_get_host_consumed_energy(host); + double consumed_energy = MSG_host_get_consumed_energy(host); XBT_INFO("Total energy (Joules): %f", consumed_energy); // Process 1 - long CPU task @@ -91,7 +91,7 @@ static int dvfs(int argc, char *argv[]) task_time = MSG_get_clock() - task_time; XBT_INFO("Task simulation time: %e", task_time); - consumed_energy = MSG_get_host_consumed_energy(host); + consumed_energy = MSG_host_get_consumed_energy(host); XBT_INFO("Total energy (Joules): %f", consumed_energy); return 0; diff --git a/include/msg/msg.h b/include/msg/msg.h index 43d94c5a3d..32a2de4507 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -136,11 +136,11 @@ XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h); XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv); XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host); -XBT_PUBLIC(double) MSG_get_host_power_peak_at(msg_host_t h, int pstate_index); -XBT_PUBLIC(double) MSG_get_host_current_power_peak(msg_host_t h); -XBT_PUBLIC(int) MSG_get_host_nb_pstates(msg_host_t h); -XBT_PUBLIC(void) MSG_set_host_power_peak_at(msg_host_t h, int pstate); -XBT_PUBLIC(double) MSG_get_host_consumed_energy(msg_host_t h); +XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate); +XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h); +XBT_PUBLIC(int) MSG_host_get_pstate_number(msg_host_t h); +XBT_PUBLIC(void) MSG_host_set_pstate(msg_host_t h, int pstate); +XBT_PUBLIC(double) MSG_host_get_consumed_energy(msg_host_t h); /*property handlers*/ XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host); diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index 1f36f3b5af..14aff6cb60 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -356,7 +356,7 @@ void MSG_host_get_params(msg_host_t host, ws_params_t params) * \param pstate_index pstate to test * \return Returns the processor speed associated with pstate_index */ -double MSG_get_host_power_peak_at(msg_host_t host, int pstate_index) { +double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (simcall_host_get_power_peak_at(host, pstate_index)); } @@ -367,7 +367,7 @@ double MSG_get_host_power_peak_at(msg_host_t host, int pstate_index) { * \param host host to test * \return Returns the current processor speed */ -double MSG_get_host_current_power_peak(msg_host_t host) { +double MSG_host_get_current_power_peak(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return simcall_host_get_current_power_peak(host); } @@ -377,7 +377,7 @@ double MSG_get_host_current_power_peak(msg_host_t host) { * * \param host host to test */ -int MSG_get_host_nb_pstates(msg_host_t host) { +int MSG_host_get_pstate_number(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return (simcall_host_get_nb_pstates(host)); @@ -389,7 +389,7 @@ int MSG_get_host_nb_pstates(msg_host_t host) { * \param host host to test * \param pstate_index pstate to switch to */ -void MSG_set_host_power_peak_at(msg_host_t host, int pstate_index) { +void MSG_host_set_pstate(msg_host_t host, int pstate_index) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); simcall_host_set_power_peak_at(host, pstate_index); @@ -401,7 +401,7 @@ void MSG_set_host_power_peak_at(msg_host_t host, int pstate_index) { * \param host host to test * \return Returns the consumed energy */ -double MSG_get_host_consumed_energy(msg_host_t host) { +double MSG_host_get_consumed_energy(msg_host_t host) { xbt_assert((host != NULL), "Invalid parameters (host is NULL)"); return simcall_host_get_consumed_energy(host); }