From ea4eb2d3ae5dd567ff62f88b7e61605a94ebff0e Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Thu, 15 Feb 2018 15:14:00 +0100 Subject: [PATCH] [DVFS] Fix the update() method. The update() will be called AFTER a pstate has already been changed; this implies that we need to keep track of what pstate was active before the change in order to update the flops already computed correctly. --- src/surf/plugins/host_load.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/surf/plugins/host_load.cpp b/src/surf/plugins/host_load.cpp index 8e3dd94986..82668bd172 100644 --- a/src/surf/plugins/host_load.cpp +++ b/src/surf/plugins/host_load.cpp @@ -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); } } -- 2.20.1