Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more include cleanups
[simgrid.git] / src / plugins / host_dvfs.cpp
index cd54f15..9b8e037 100644 (file)
@@ -3,21 +3,18 @@
 /* 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 "simgrid/plugins/dvfs.h"
-#include "simgrid/plugins/load.h"
-#include "simgrid/s4u/Engine.hpp"
+#include <simgrid/plugins/dvfs.h>
+#include <simgrid/plugins/load.h>
+#include <xbt/config.hpp>
+
 #include "src/internal_config.h" // HAVE_SMPI
-#include "src/kernel/activity/ExecImpl.hpp"
-#include "src/plugins/vm/VirtualMachineImpl.hpp"
+#include "src/surf/network_interface.hpp"
 #if HAVE_SMPI
+#include "src/smpi/include/smpi_request.hpp"
 #include "src/smpi/plugins/ampi/ampi.hpp"
 #endif
-#include <xbt/config.hpp>
 
 #include <boost/algorithm/string.hpp>
-#if HAVE_SMPI
-#include "src/smpi/include/smpi_request.hpp"
-#endif
 
 SIMGRID_REGISTER_PLUGIN(host_dvfs, "Dvfs support", &sg_host_dvfs_plugin_init)
 
@@ -205,7 +202,7 @@ public:
        */
       // Load is now < freq_up_threshold; exclude pstate 0 (the fastest)
       // because pstate 0 can only be selected if load > freq_up_threshold_
-      unsigned long new_pstate = static_cast<int>(get_max_pstate() - load * (get_max_pstate() + 1));
+      auto new_pstate = get_max_pstate() - static_cast<unsigned long>(load) * (get_max_pstate() + 1);
       if (new_pstate < get_min_pstate())
         new_pstate = get_min_pstate();
       get_host()->set_pstate(new_pstate);
@@ -264,11 +261,10 @@ public:
 
 #if HAVE_SMPI
 class Adagio : public Governor {
-private:
-  int best_pstate     = 0;
-  double start_time   = 0;
-  double comp_counter = 0;
-  double comp_timer   = 0;
+  unsigned long best_pstate = 0;
+  double start_time         = 0;
+  double comp_counter       = 0;
+  double comp_timer         = 0;
 
   std::vector<std::vector<double>> rates; // Each host + all frequencies of that host
 
@@ -327,7 +323,7 @@ public:
     if (rates[task_id][best_pstate] == 0)
       best_pstate = 0;
     get_host()->set_pstate(best_pstate); // Load our schedule
-    XBT_DEBUG("Set pstate to %i", best_pstate);
+    XBT_DEBUG("Set pstate to %lu", best_pstate);
   }
 
   void post_task()