From: Christian Heinrich Date: Fri, 16 Jun 2017 08:14:27 +0000 (+0200) Subject: Revert "[ENERGY] Fixed wrong calculation for 1-core systems" X-Git-Tag: v3.16~79 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e3361464769385862476e0154a92370db824a607?ds=sidebyside Revert "[ENERGY] Fixed wrong calculation for 1-core systems" This reverts commit e96681fb89b328389ad0d4aecfe7addbda714da4. We decided to add an assert() instead, as the error was not really in the energy plugin but in the user-supplied platform. --- diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 332f4a1e0c..f7878d7b11 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -207,8 +207,8 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) double power_slope = 0; if (cpu_load > 0) { /* Something is going on, the machine is not idle */ - min_power = range.min; - max_power = range.max; + double min_power = range.min; + double max_power = range.max; /** * The min_power states how much we consume when only one single @@ -220,15 +220,15 @@ double HostEnergy::getCurrentWattsValue(double cpu_load) * i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power * (maxCpuLoad is by definition 1) */ + double power_slope; int coreCount = host->coreCount(); double coreReciprocal = static_cast(1) / static_cast(coreCount); - if (coreCount > 1) { + if (coreCount > 1) power_slope = (max_power - min_power) / (1 - coreReciprocal); - current_power = min_power + (cpu_load - coreReciprocal) * power_slope; - } else { - current_power = max_power; - } + else + power_slope = 0; // Should be 0, since max_power == min_power (in this case) + current_power = min_power + (cpu_load - coreReciprocal) * power_slope; } else { /* Our machine is idle, take the dedicated value! */ current_power = range.idle; }