Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
deprecate properly another function
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 15 Jul 2017 20:44:37 +0000 (22:44 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 15 Jul 2017 20:44:37 +0000 (22:44 +0200)
examples/msg/energy-consumption/energy-consumption.c
examples/msg/energy-onoff/energy-onoff.c
examples/msg/energy-pstate/energy-pstate.c
include/simgrid/msg.h

index 00231b6..cf5c638 100644 (file)
@@ -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"));
   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);
            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();
 
   // 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"
   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);
 
   // ========= 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();
 
   // 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_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",
 
   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.",
 
   // =========== 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",
   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;
 }
 
   return 0;
 }
 
index 17ae54a..cd82406 100644 (file)
@@ -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"));
   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("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);
 
   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("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);
 
   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;
 }
 
   return 0;
 }
index 227c1da..de0d0d1 100644 (file)
@@ -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);
 
   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
   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);
 
 
   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
   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);
 
   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;
 }
   XBT_INFO("Current power peak=%f", current_peak2);
   return 0;
 }
index 5c4a1be..345b584 100644 (file)
@@ -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);
 
 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()
 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);
 }
 {
   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);
 
 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);
 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);
 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);