From 9f6aa57a6e1eea25b6dabbe7f87717a6ca0f4523 Mon Sep 17 00:00:00 2001 From: CARASTAN DOS SANTOS Danilo Date: Thu, 23 Nov 2017 18:18:28 +0100 Subject: [PATCH] fixed energy plugin: getCurrentWattsValue was not returning watts_off when host is off --- src/surf/plugins/host_energy.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index a66839f20a..7b9c025dc6 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -250,6 +250,14 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) { xbt_assert(not power_range_watts_list.empty(), "No power range properties specified for host %s", host->getCname()); + /* + * * Return watts_off if pstate == pstate_off + * * this happens when host is off + */ + if (this->pstate == pstate_off) { + return watts_off; + } + /* min_power corresponds to the power consumed when only one core is active */ /* max_power is the power consumed at 100% cpu load */ auto range = power_range_watts_list.at(this->pstate); -- 2.20.1