From fa13efa2966dced0d57bd8f8b92025cad9d084e6 Mon Sep 17 00:00:00 2001 From: Sabir Mohammedi Taieb <52837091+Sabir97@users.noreply.github.com> Date: Wed, 4 Mar 2020 13:18:07 +0100 Subject: [PATCH] Print Total Migration Time and Energy in results Print two new lines in simulation results, one for the total migration time and another for the total migration energy, these metrics are calculated in the class PowerDatacenter, and we retrieve them using the getMigrationTime() and getMigrationEnergy() methods. --- .../java/org/cloudbus/cloudsim/examples/power/Helper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Helper.java b/modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Helper.java index 0d0feaec7..90a47c880 100644 --- a/modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Helper.java +++ b/modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Helper.java @@ -260,6 +260,10 @@ public static void printResults( int numberOfMigrations = datacenter.getMigrationCount(); Map slaMetrics = getSlaMetrics(vms); + + // get total migration time and energy from the class PowerDatacenter + double Emigr = datacenter.getMigrationEnergy(); + double Tmigr = datacenter.getMigrationTime(); double slaOverall = slaMetrics.get("overall"); double slaAverage = slaMetrics.get("average"); @@ -413,6 +417,9 @@ public static void printResults( Log.printLine(String.format( "StDev time before a VM migration: %.2f sec", stDevTimeBeforeVmMigration)); + //print total migration time and energy + Log.printLine(String.format("Migration Energy : %.5f kWh", Emigr)); + Log.printLine(String.format("Migration Time: %.2f sec", Tmigr)); if (datacenter.getVmAllocationPolicy() instanceof PowerVmAllocationPolicyMigrationAbstract) { PowerVmAllocationPolicyMigrationAbstract vmAllocationPolicy = (PowerVmAllocationPolicyMigrationAbstract) datacenter