Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix #include
[simgrid.git] / examples / msg / energy / consumption / energy_consumption.c
index e058370..4203820 100644 (file)
@@ -4,11 +4,11 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include<stdio.h>
+#include <stdio.h>
 
 #include "simgrid/msg.h"
 #include "xbt/sysdep.h"         /* calloc */
-#include "simgrid/plugins.h"
+#include "simgrid/plugins/energy.h"
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
@@ -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 peak speed=%.0E flop/s; Energy dissipated =%.0E J",
-                 MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(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), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
 
   // Run a task
   start = MSG_get_clock();
@@ -47,9 +47,9 @@ int dvfs(int argc, char *argv[])
   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), 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));
+                 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));
 
   // ========= Change power peak =========
   int pstate=2;
@@ -67,24 +67,24 @@ int dvfs(int argc, char *argv[])
   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), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(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), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(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.",
-                 MSG_host_get_consumed_energy(MSG_host_by_name("MyHost2")) );
+                 sg_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",
                  MSG_get_clock()-start,
-                 MSG_host_get_current_power_peak(host), MSG_host_get_consumed_energy(host));
+                 MSG_host_get_current_power_peak(host), sg_host_get_consumed_energy(host));
   return 0;
 }