Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[HostLoad] Update when calling getters
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 26 Jul 2018 09:16:41 +0000 (11:16 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 26 Jul 2018 14:45:10 +0000 (16:45 +0200)
This will allow us to remove the CpuAction hook and replace it with
hooks that are only used after a calculation has completed.

If for instance a daemon (dvfs, load balancer, ...) wants to get
up-to-date information, this is now assured through the update call.

src/plugins/host_load.cpp

index 5387b3c..c12ac69 100644 (file)
@@ -40,10 +40,10 @@ public:
   explicit HostLoad(simgrid::s4u::Host&& ptr) = delete;
 
   double get_current_load();
-  double get_average_load() { return (theor_max_flops_ == 0) ? 0 : computed_flops_ / theor_max_flops_; };
-  double get_computed_flops() { return computed_flops_; }
-  double get_idle_time() { return idle_time_; } /** Return idle time since last reset */
-  double get_total_idle_time() { return total_idle_time_; } /** Return idle time over the whole simulation */
+  double get_average_load() { update(); return (theor_max_flops_ == 0) ? 0 : computed_flops_ / theor_max_flops_; };
+  double get_computed_flops() { update(); return computed_flops_; }
+  double get_idle_time() { update(); return idle_time_; } /** Return idle time since last reset */
+  double get_total_idle_time() { update(); return total_idle_time_; } /** Return idle time over the whole simulation */
   void update();
   void reset();