From 929da6cee6c76f9eb52bda952a6701592f8f78e3 Mon Sep 17 00:00:00 2001 From: Andreas Egger Date: Sat, 22 Jun 2013 02:37:08 +0200 Subject: [PATCH] Some own test outputs on resize and delays --- .../lsdc/management/MachineManager.java | 10 +++-- .../tuwien/lsdc/sched/AbstractScheduler.java | 4 +- src/at/ac/tuwien/lsdc/sched/SchedulerA.java | 4 +- src/at/ac/tuwien/lsdc/types/ScenarioData.java | 19 ++++++++- .../ac/tuwien/lsdc/types/SchedulerData.java | 39 ++++++++++++++++++- .../ac/tuwien/lsdc/types/VirtualMachine.java | 7 +++- 6 files changed, 71 insertions(+), 12 deletions(-) diff --git a/src/at/ac/tuwien/lsdc/management/MachineManager.java b/src/at/ac/tuwien/lsdc/management/MachineManager.java index fe5f282..4a5c8fa 100644 --- a/src/at/ac/tuwien/lsdc/management/MachineManager.java +++ b/src/at/ac/tuwien/lsdc/management/MachineManager.java @@ -24,7 +24,7 @@ public class MachineManager { private int totalPMs = 0; private int totalVMs = 0; - private int totalResizeCalls = 0; + private static int totalResizeCalls = 0; public MachineManager(int numPMs) { this.numPMs = numPMs; @@ -59,7 +59,7 @@ public class MachineManager { PhysicalMachine pm = PMs.get(id); totalVMs += pm.getTotalVMs(); pm.stop(); - totalResizeCalls += pm.getTotalResizeCalls(); +// totalResizeCalls += pm.getTotalResizeCalls(); PMs.remove(id); } } @@ -187,8 +187,12 @@ public class MachineManager { return totalVMs; } - public int getTotalResizeCalls() { + public static int getTotalResizeCalls() { return totalResizeCalls; } + + public static void addResizeCall() { + totalResizeCalls ++; + } } diff --git a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java index db020b9..9cb795a 100644 --- a/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java +++ b/src/at/ac/tuwien/lsdc/sched/AbstractScheduler.java @@ -309,7 +309,7 @@ public abstract class AbstractScheduler { SchedulerData data = new SchedulerData(currTime, manager.getTotalRam(), manager.getTotalCpu(), manager.getTotalSize(), manager.countCurrentlyRunningPMs(), manager.countCurrentlyRunningVMs(), manager.getCurrentConsumption(), - numCurrInSourced, numCurrOutSourced); + numCurrInSourced, numCurrOutSourced, MachineManager.getTotalResizeCalls(), delayedApps.size()); totalConsumption += manager.getCurrentConsumption(); try { logger.logSchedulerData(data); @@ -326,7 +326,7 @@ public abstract class AbstractScheduler { protected ScenarioData doEndLogging() { return new ScenarioData(getSchedulerType(), scenario.toString(), manager.getTotalPMs(), manager.getTotalVMs(), endTime, NumberUtils.roundDouble(totalConsumption), - numTotalInSourced, numTotalOutSourced, manager.getTotalResizeCalls()); + numTotalInSourced, numTotalOutSourced, MachineManager.getTotalResizeCalls(), delayedApps.size()); } protected abstract String getSchedulerType(); diff --git a/src/at/ac/tuwien/lsdc/sched/SchedulerA.java b/src/at/ac/tuwien/lsdc/sched/SchedulerA.java index 15db35c..cd9ad86 100644 --- a/src/at/ac/tuwien/lsdc/sched/SchedulerA.java +++ b/src/at/ac/tuwien/lsdc/sched/SchedulerA.java @@ -121,8 +121,8 @@ public class SchedulerA extends AbstractScheduler { } } } - else - log.warn("Application " + app.toString() + " could not be deployed on any pm"); +// else +// log.warn("Application " + app.toString() + " could not be deployed on any pm"); } } diff --git a/src/at/ac/tuwien/lsdc/types/ScenarioData.java b/src/at/ac/tuwien/lsdc/types/ScenarioData.java index 1aa1c10..dd02c52 100644 --- a/src/at/ac/tuwien/lsdc/types/ScenarioData.java +++ b/src/at/ac/tuwien/lsdc/types/ScenarioData.java @@ -11,6 +11,7 @@ public class ScenarioData { private int totalInSourced; private int totalOutSourced; private int totalResizeCalls; + private int delayedApps; public ScenarioData(String scheduler, String scenario, long totalPMs, long totalVMs, long totalDuration, double totalConsumption, @@ -26,11 +27,27 @@ public class ScenarioData { this.totalOutSourced = totalOutSourced; this.totalResizeCalls = totalResizeCalls; } + + public ScenarioData(String scheduler, String scenario, long totalPMs, + long totalVMs, long totalDuration, double totalConsumption, + int totalInSourced, int totalOutSourced, + int totalResizeCalls, int delayedApps) { + this.scheduler = scheduler; + this.scenario = scenario; + this.totalPMs = totalPMs; + this.totalVMs = totalVMs; + this.totalDuration = totalDuration; + this.totalConsumption = totalConsumption; + this.totalInSourced = totalInSourced; + this.totalOutSourced = totalOutSourced; + this.totalResizeCalls = totalResizeCalls; + this.delayedApps = delayedApps; + } public String[] toStringArray() { return new String[] { scheduler, scenario, String.valueOf(totalPMs), String.valueOf(totalVMs), String.valueOf(totalDuration), String.valueOf(totalConsumption), String.valueOf(totalInSourced), - String.valueOf(totalOutSourced), String.valueOf(totalResizeCalls) }; + String.valueOf(totalOutSourced), String.valueOf(totalResizeCalls), String.valueOf(delayedApps) }; } @Override diff --git a/src/at/ac/tuwien/lsdc/types/SchedulerData.java b/src/at/ac/tuwien/lsdc/types/SchedulerData.java index dae6deb..becf72e 100644 --- a/src/at/ac/tuwien/lsdc/types/SchedulerData.java +++ b/src/at/ac/tuwien/lsdc/types/SchedulerData.java @@ -11,7 +11,9 @@ public class SchedulerData { private double totalConsumption; private int inSourced; private int outSourced; - + private int totalResized; + private int delayedApps; + public SchedulerData(long timestamp, long totalRAM, long totalCPU, long totalSize, long runningPMs, long runningVMs, double totalConsumption, int inSourced, int outSourced) { @@ -25,13 +27,45 @@ public class SchedulerData { this.inSourced = inSourced; this.outSourced = outSourced; } + + public SchedulerData(long timestamp, long totalRAM, long totalCPU, + long totalSize, long runningPMs, long runningVMs, + double totalConsumption, int inSourced, int outSourced, int totalResized) { + this.timestamp = timestamp; + this.totalRAM = totalRAM; + this.totalCPU = totalCPU; + this.totalSize = totalSize; + this.runningPMs = runningPMs; + this.runningVMs = runningVMs; + this.totalConsumption = totalConsumption; + this.inSourced = inSourced; + this.outSourced = outSourced; + this.totalResized = totalResized; + } + + public SchedulerData(long timestamp, long totalRAM, long totalCPU, + long totalSize, long runningPMs, long runningVMs, + double totalConsumption, int inSourced, int outSourced, int totalResized, int delayedApps) { + this.timestamp = timestamp; + this.totalRAM = totalRAM; + this.totalCPU = totalCPU; + this.totalSize = totalSize; + this.runningPMs = runningPMs; + this.runningVMs = runningVMs; + this.totalConsumption = totalConsumption; + this.inSourced = inSourced; + this.outSourced = outSourced; + this.totalResized = totalResized; + this.delayedApps = delayedApps; + } public String[] toStringArray() { return new String[] { String.valueOf(timestamp), String.valueOf(totalRAM), String.valueOf(totalCPU), String.valueOf(totalSize), String.valueOf(runningPMs), String.valueOf(runningVMs), String.valueOf(totalConsumption), - String.valueOf(inSourced), String.valueOf(outSourced) }; + String.valueOf(inSourced), String.valueOf(outSourced), + String.valueOf(totalResized), String.valueOf(delayedApps)}; } @Override @@ -41,6 +75,7 @@ public class SchedulerData { + totalSize + ", runningPMs=" + runningPMs + ", runningVMs=" + runningVMs + ", totalConsumption=" + totalConsumption + ", inSourced=" + inSourced + ", outSourced=" + outSourced + + ", totalResized=" + totalResized + ", delayed=" + delayedApps + "]"; } diff --git a/src/at/ac/tuwien/lsdc/types/VirtualMachine.java b/src/at/ac/tuwien/lsdc/types/VirtualMachine.java index 3803e43..06cb452 100644 --- a/src/at/ac/tuwien/lsdc/types/VirtualMachine.java +++ b/src/at/ac/tuwien/lsdc/types/VirtualMachine.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashMap; import at.ac.tuwien.lsdc.exception.VMResizeException; +import at.ac.tuwien.lsdc.management.MachineManager; public class VirtualMachine { @@ -92,7 +93,8 @@ public class VirtualMachine { reservedSize = reservedSize + diffSize; reservedRAM = reservedRAM + diffRAM; reservedCPU = reservedCPU + diffCPU; - totalResizeCalls++; +// totalResizeCalls++; + MachineManager.addResizeCall(); return true; } @@ -102,7 +104,8 @@ public class VirtualMachine { reservedSize = reservedSize - app.getSize(); reservedRAM = reservedRAM - app.getRam(); reservedCPU = reservedCPU - app.getCpu(); - totalResizeCalls++; +// totalResizeCalls++; + MachineManager.addResizeCall(); return true; } -- 2.43.0