Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright notices
[simgrid.git] / examples / msg / energy / consumption / energy_consumption.c
index 822f1d7..8f928ae 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2010, 2013-2014. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2013-2015. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@ int dvfs(int argc, char *argv[])
 {
   msg_host_t host = NULL;
   msg_task_t task1 = NULL;
-  host = MSG_get_host_by_name("MyHost1");
+  host = MSG_host_by_name("MyHost1");
 
 
   XBT_INFO("Energetic profile: %s",
@@ -45,9 +45,11 @@ int dvfs(int argc, char *argv[])
   task1 = MSG_task_create ("t1", 100E6, 0, NULL);
   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",
+  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), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(host), MSG_host_get_wattmin_at(host,MSG_host_get_pstate(host)),
+                 MSG_host_get_wattmax_at(host,MSG_host_get_pstate(host)),
+                 MSG_host_get_consumed_energy(host));
 
   // ========= Change power peak =========
   int pstate=2;
@@ -76,8 +78,8 @@ int dvfs(int argc, char *argv[])
 
   // =========== Turn the other host off ==========
   XBT_INFO("Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated %.0f J so far.",
-                 MSG_host_get_consumed_energy(MSG_get_host_by_name("MyHost2")) );
-  MSG_host_off(MSG_get_host_by_name("MyHost2"));
+                 MSG_host_get_consumed_energy(MSG_host_by_name("MyHost2")) );
+  MSG_host_off(MSG_host_by_name("MyHost2"));
   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",