Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[DVFS] Fix the update() method.
[simgrid.git] / src / surf / plugins / host_load.cpp
index 8e3dd94..82668bd 100644 (file)
@@ -72,13 +72,21 @@ void HostLoad::update()
 {
   double now = surf_get_clock();
   if (last_updated < now) {
+    /* flops == pstate_speed * cores_being_currently_used */
+    computed_flops += (now - last_updated) * current_flops;
+
     /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k \in {0, 1, ..., cores}
      * number of active cores */
     current_flops = host->pimpl_cpu->constraint()->get_usage();
 
-    /* flops == pstate_speed * cores_being_currently_used */
-    computed_flops += (now - last_updated) * current_flops;
-    last_updated = now;
+    if (was_prev_idle) {
+      idle_time += (now - last_updated);
+    }
+
+    theor_max_flops += current_speed * host->getCoreCount() * (now - last_updated);
+    current_speed    = host->getSpeed();
+    last_updated     = now;
+    was_prev_idle    = (current_flops == 0);
   }
 }