Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
partially fix the energy public API (massive renames ongoing)
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 3 Feb 2015 00:58:49 +0000 (01:58 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 3 Feb 2015 00:58:49 +0000 (01:58 +0100)
examples/msg/energy/e1/e1.c
examples/msg/energy/e2/e2.c
examples/msg/energy/e3/e3.c
include/msg/msg.h
src/msg/msg_host.c

index 6a3085d..bfbb0c0 100644 (file)
@@ -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 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);
 
   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
   XBT_INFO("Current power peak=%f", current_peak);
 
   // Run a task
@@ -59,12 +59,12 @@ int dvfs(int argc, char *argv[])
          return 0;
          }
 
          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);
 
   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
   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");
 
   // 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);
 
   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;
 }
   XBT_INFO("Current power peak=%f", current_peak2);
   return 0;
 }
index ee19dd8..8ba1d79 100644 (file)
@@ -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",
   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,
 
   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();
 
   // 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_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;
 
   // ========= 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,
   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();
 
   // 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_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,
 
   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;
 }
 
   return 0;
 }
index 1eab1b8..57d3c99 100644 (file)
@@ -59,10 +59,10 @@ static int dvfs(int argc, char *argv[])
   double task_time = 0;
   host = MSG_host_self();
 
   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);
 
   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
   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);
 
   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;
   XBT_INFO("Total energy (Joules): %f", consumed_energy);
 
   return 0;
index 43d94c5..32a2de4 100644 (file)
@@ -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(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);
 
 /*property handlers*/
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
index 1f36f3b..14aff6c 100644 (file)
@@ -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
  */
  * \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));
 }
          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
  */
  * \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);
 }
          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
  */
  *
  * \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));
 
          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
  */
  * \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);
          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
  */
  * \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);
 }
          xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
          return simcall_host_get_consumed_energy(host);
 }