From 2eba6b843463b01622d79c8ccc55bdffffd0454c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 15 Jul 2017 22:44:37 +0200 Subject: [PATCH] deprecate properly another function --- .../energy-consumption/energy-consumption.c | 22 +++++++++---------- examples/msg/energy-onoff/energy-onoff.c | 20 ++++++++--------- examples/msg/energy-pstate/energy-pstate.c | 6 ++--- include/simgrid/msg.h | 12 ++++++---- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/examples/msg/energy-consumption/energy-consumption.c b/examples/msg/energy-consumption/energy-consumption.c index 00231b6855..cf5c6384e6 100644 --- a/examples/msg/energy-consumption/energy-consumption.c +++ b/examples/msg/energy-consumption/energy-consumption.c @@ -14,14 +14,14 @@ static int dvfs(int argc, char *argv[]) msg_host_t host = MSG_host_by_name("MyHost1"); XBT_INFO("Energetic profile: %s",MSG_host_get_property_value(host,"watt_per_state")); - XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_current_power_peak(host), + XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host), sg_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 peak speed=%.0E; Energy dissipated=%.2f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); + XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E; Energy dissipated=%.2f J", + MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); // Run a task start = MSG_get_clock(); @@ -30,15 +30,15 @@ static int dvfs(int argc, char *argv[]) MSG_task_execute (task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Current consumption: from %.0fW to %.0fW" - " depending on load; Energy dissipated=%.0f J", MSG_get_clock()-start, - MSG_host_get_current_power_peak(host), sg_host_get_wattmin_at(host,MSG_host_get_pstate(host)), - sg_host_get_wattmax_at(host,MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host)); + " depending on load; Energy dissipated=%.0f J", + MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_wattmin_at(host, MSG_host_get_pstate(host)), + sg_host_get_wattmax_at(host, MSG_host_get_pstate(host)), sg_host_get_consumed_energy(host)); // ========= Change power peak ========= int pstate=2; MSG_host_set_pstate(host, pstate); - XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", - pstate, MSG_host_get_power_peak_at(host, pstate), MSG_host_get_current_power_peak(host)); + XBT_INFO("========= Requesting pstate %d (speed should be of %.0E flop/s and is of %.0E flop/s)", pstate, + MSG_host_get_power_peak_at(host, pstate), MSG_host_get_speed(host)); // Run a second task start = MSG_get_clock(); @@ -47,13 +47,13 @@ static int dvfs(int argc, char *argv[]) MSG_task_execute (task1); MSG_task_destroy(task1); XBT_INFO("Task done (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); + MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); start = MSG_get_clock(); XBT_INFO("Sleep for 4 seconds"); MSG_process_sleep(4); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); + MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); // =========== Turn the other host off ========== XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.", @@ -62,7 +62,7 @@ static int dvfs(int argc, char *argv[]) start = MSG_get_clock(); MSG_process_sleep(10); XBT_INFO("Done sleeping (duration: %.2f s). Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_get_clock()-start, MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host)); + MSG_get_clock() - start, MSG_host_get_speed(host), sg_host_get_consumed_energy(host)); return 0; } diff --git a/examples/msg/energy-onoff/energy-onoff.c b/examples/msg/energy-onoff/energy-onoff.c index 17ae54ad40..cd82406db1 100644 --- a/examples/msg/energy-onoff/energy-onoff.c +++ b/examples/msg/energy-onoff/energy-onoff.c @@ -58,26 +58,26 @@ static int onoff(int argc, char *argv[]) { msg_host_t host1 = MSG_host_by_name("MyHost1"); XBT_INFO("Energetic profile: %s", MSG_host_get_property_value(host1,"watt_per_state")); - XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", - MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); + XBT_INFO("Initial peak speed=%.0E flop/s; Energy dissipated =%.0E J", MSG_host_get_speed(host1), + sg_host_get_consumed_energy(host1)); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); - XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", - MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); + XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_host_get_speed(host1), + sg_host_get_consumed_energy(host1)); simulate_shutdown(host1); - XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); + XBT_INFO("Host1 is now OFF. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_host_get_speed(host1), + sg_host_get_consumed_energy(host1)); XBT_INFO("Sleep for 10 seconds"); MSG_process_sleep(10); - XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", - MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); + XBT_INFO("Done sleeping. Current peak speed=%.0E; Energy dissipated=%.2f J", MSG_host_get_speed(host1), + sg_host_get_consumed_energy(host1)); simulate_bootup(host1); - XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", - MSG_host_get_current_power_peak(host1), sg_host_get_consumed_energy(host1)); + XBT_INFO("Host1 is now ON again. Current peak speed=%.0E flop/s; Energy dissipated=%.0f J", MSG_host_get_speed(host1), + sg_host_get_consumed_energy(host1)); return 0; } diff --git a/examples/msg/energy-pstate/energy-pstate.c b/examples/msg/energy-pstate/energy-pstate.c index 227c1dafa3..de0d0d1a22 100644 --- a/examples/msg/energy-pstate/energy-pstate.c +++ b/examples/msg/energy-pstate/energy-pstate.c @@ -24,7 +24,7 @@ static int dvfs(int argc, char *argv[]) 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 @@ -45,7 +45,7 @@ static int dvfs(int argc, char *argv[]) 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 @@ -61,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; } diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 5c4a1be6ad..345b584d32 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -169,7 +169,6 @@ XBT_PUBLIC(const char*) MSG_zone_get_property_value(msg_netzone_t as, const char XBT_PUBLIC(void) MSG_zone_set_property_value(msg_netzone_t netzone, const char* name, char* value); XBT_PUBLIC(void) MSG_zone_get_hosts(msg_netzone_t zone, xbt_dynar_t whereto); -/* Deprecated forms of the previous functions */ static inline XBT_ATTRIB_DEPRECATED_v319( "Use MSG_zone_get_root() instead: v3.19 will remove MSG_environment_get_routing_root() completely.") msg_netzone_t MSG_environment_get_routing_root() @@ -272,12 +271,17 @@ static inline double { return MSG_host_get_speed(host); } +static inline double XBT_ATTRIB_DEPRECATED_v320( + "Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() completely.") + MSG_host_get_current_power_peak(msg_host_t host) +{ + return MSG_host_get_speed(host); +} XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate); -#define MSG_host_get_current_power_peak(h) MSG_host_get_speed(h) /* deprecated */ XBT_PUBLIC(int) MSG_host_get_nb_pstates(msg_host_t h); -#define MSG_host_get_pstate(h) sg_host_get_pstate(h) /* deprecated */ -#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* deprecated */ +#define MSG_host_get_pstate(h) sg_host_get_pstate(h) /* users don't know that MSG is the C version of SimGrid */ +#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* (same here) */ XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(); XBT_PUBLIC(int) MSG_get_host_number(); XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host); -- 2.20.1