From 2610c767cf32eacd2d27a192667892e86eb384a6 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 6 Mar 2017 23:59:25 +0100 Subject: [PATCH 1/1] Those damn VM keep getting in our way --- src/surf/plugins/host_energy.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 6afa7f043c..aa6af90cee 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -320,12 +320,15 @@ static void onSimulationEnd() double total_energy = 0.0; // Total energy consumption (whole plattform) double used_hosts_energy = 0.0; // Energy consumed by hosts that computed something for (int i = 0; i < host_count; i++) { - bool host_was_used = (host_list[i]->extension()->last_updated != 0); - double energy = 0.0; - energy = host_list[i]->extension()->getConsumedEnergy(); - total_energy += energy; - if (host_was_used) - used_hosts_energy += energy; + if (dynamic_cast(host_list[i]) == nullptr) { // Ignore virtual machines + + bool host_was_used = (host_list[i]->extension()->last_updated != 0); + double energy = 0.0; + energy = host_list[i]->extension()->getConsumedEnergy(); + total_energy += energy; + if (host_was_used) + used_hosts_energy += energy; + } } XBT_INFO("Summed energy consumption: %f Joules; used hosts consumed: %f Joules; unused (idle) hosts consumed: %f", total_energy, used_hosts_energy, total_energy - used_hosts_energy); -- 2.20.1