Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / examples / c / exec-dvfs / exec-dvfs.c
index 5eb9f6b..bdb4de4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2020. The SimGrid Team.
+/* Copyright (c) 2007-2022. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -17,10 +17,10 @@ static void dvfs(int argc, char* argv[])
 {
   sg_host_t host = sg_host_self();
 
-  int nb = sg_host_get_nb_pstates(host);
-  XBT_INFO("Count of Processor states=%d", nb);
+  unsigned long nb = sg_host_get_nb_pstates(host);
+  XBT_INFO("Count of Processor states=%lu", nb);
 
-  double current_peak = sg_host_speed(host);
+  double current_peak = sg_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak);
 
   sg_actor_execute(100E6);
@@ -29,16 +29,16 @@ static void dvfs(int argc, char* argv[])
   XBT_INFO("Task1 simulation time: %e", task_time);
 
   // Change power peak
-  int new_pstate = 2;
-  xbt_assert(new_pstate < nb, "Cannot set the host %s at pstate %d because it only provides %d pstates.",
+  unsigned long new_pstate = 2;
+  xbt_assert(new_pstate < nb, "Cannot set the host %s at pstate %lu because it only provides %lu pstates.",
              sg_host_get_name(host), new_pstate, nb);
 
   double peak_at = sg_host_get_pstate_speed(host, new_pstate);
-  XBT_INFO("Changing power peak value to %f (at index %d)", peak_at, new_pstate);
+  XBT_INFO("Changing power peak value to %f (at index %lu)", peak_at, new_pstate);
 
   sg_host_set_pstate(host, new_pstate);
 
-  current_peak = sg_host_speed(host);
+  current_peak = sg_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak);
 
   sg_actor_execute(100E6);
@@ -48,10 +48,10 @@ static void dvfs(int argc, char* argv[])
 
   // Verify the default pstate is set to 0
   host    = sg_host_by_name("MyHost2");
-  int nb2 = sg_host_get_nb_pstates(host);
-  XBT_INFO("Count of Processor states=%d", nb2);
+  unsigned long nb2 = sg_host_get_nb_pstates(host);
+  XBT_INFO("Count of Processor states=%lu", nb2);
 
-  double current_peak2 = sg_host_speed(host);
+  double current_peak2 = sg_host_get_speed(host);
   XBT_INFO("Current power peak=%f", current_peak2);
 }
 
@@ -59,7 +59,7 @@ int main(int argc, char* argv[])
 {
   simgrid_init(&argc, argv);
 
-  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s msg_platform.xml\n", argv[0], argv[0]);
+  xbt_assert(argc == 2, "Usage: %s platform_file\n\tExample: %s platform.xml\n", argv[0], argv[0]);
 
   simgrid_load_platform(argv[1]);