@Test public void TestGetVMPredictedEnergy() { System.out.println("getVMPredictedEnergy"); EnergyUsagePrediction prediction; addVMs(vm1); addVMs(vm2); System.out.println("store values size is: " + host.getCalibrationData().size()); CpuOnlyEnergyPredictor predictor = new CpuOnlyEnergyPredictor(); setCalibrationData(host); host.setRamMb(32244); System.out.println("VM for Energy Prediction: " + vm1.toString()); System.out.println("Amount of VMs Inducing Load: " + vms.size()); System.out.println("Host To Query: " + host.getHostName()); prediction = predictor.getVMPredictedEnergy(vm1, vms, host); System.out.println("watts: " + prediction.getAvgPowerUsed() + " energy: " + prediction.getTotalEnergyUsed()); }
@Override public EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod) { EnergyDivision division = getEnergyUsage(host, virtualMachines); EnergyUsagePrediction hostAnswer; if (getDefaultAssumedCpuUsage() == -1) { hostAnswer = predictTotalEnergy(host, getCpuUtilisation(host, virtualMachines), timePeriod); } else { hostAnswer = predictTotalEnergy(host, getDefaultAssumedCpuUsage(), timePeriod); } hostAnswer.setAvgPowerUsed(hostAnswer.getTotalEnergyUsed() / ((double) TimeUnit.SECONDS.toHours(timePeriod.getDuration()))); EnergyUsagePrediction generalHostsAnswer = getGeneralHostPredictedEnergy(timePeriod); double generalPower = generalHostsAnswer.getAvgPowerUsed() / (double) virtualMachines.size(); double generalEnergy = generalHostsAnswer.getTotalEnergyUsed() / (double) virtualMachines.size(); EnergyUsagePrediction answer = new EnergyUsagePrediction(vm); answer.setDuration(hostAnswer.getDuration()); double vmsEnergyFraction = division.getEnergyUsage(hostAnswer.getTotalEnergyUsed(), vm); division.setConsiderIdleEnergy(isConsiderIdleEnergy()); answer.setTotalEnergyUsed(vmsEnergyFraction + generalEnergy); double vmsPowerFraction = division.getEnergyUsage(hostAnswer.getAvgPowerUsed(), vm); answer.setAvgPowerUsed(vmsPowerFraction + generalPower); return answer; }
CpuOnlyEnergyPredictor extends AbstractEnergyPredictor { @Override public EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod) { EnergyDivision division = getEnergyUsage(host, virtualMachines); EnergyUsagePrediction hostAnswer; if (getDefaultAssumedCpuUsage() == -1) { hostAnswer = predictTotalEnergy(host, getCpuUtilisation(host, virtualMachines), timePeriod); } else { hostAnswer = predictTotalEnergy(host, getDefaultAssumedCpuUsage(), timePeriod); } hostAnswer.setAvgPowerUsed(hostAnswer.getTotalEnergyUsed() / ((double) TimeUnit.SECONDS.toHours(timePeriod.getDuration()))); EnergyUsagePrediction generalHostsAnswer = getGeneralHostPredictedEnergy(timePeriod); double generalPower = generalHostsAnswer.getAvgPowerUsed() / (double) virtualMachines.size(); double generalEnergy = generalHostsAnswer.getTotalEnergyUsed() / (double) virtualMachines.size(); EnergyUsagePrediction answer = new EnergyUsagePrediction(vm); answer.setDuration(hostAnswer.getDuration()); double vmsEnergyFraction = division.getEnergyUsage(hostAnswer.getTotalEnergyUsed(), vm); division.setConsiderIdleEnergy(isConsiderIdleEnergy()); answer.setTotalEnergyUsed(vmsEnergyFraction + generalEnergy); double vmsPowerFraction = division.getEnergyUsage(hostAnswer.getAvgPowerUsed(), vm); answer.setAvgPowerUsed(vmsPowerFraction + generalPower); return answer; } }
CpuOnlyEnergyPredictor extends AbstractEnergyPredictor { @Override public EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod) { EnergyDivision division = getEnergyUsage(host, virtualMachines); EnergyUsagePrediction hostAnswer; if (getDefaultAssumedCpuUsage() == -1) { hostAnswer = predictTotalEnergy(host, getCpuUtilisation(host, virtualMachines), timePeriod); } else { hostAnswer = predictTotalEnergy(host, getDefaultAssumedCpuUsage(), timePeriod); } hostAnswer.setAvgPowerUsed(hostAnswer.getTotalEnergyUsed() / ((double) TimeUnit.SECONDS.toHours(timePeriod.getDuration()))); EnergyUsagePrediction generalHostsAnswer = getGeneralHostPredictedEnergy(timePeriod); double generalPower = generalHostsAnswer.getAvgPowerUsed() / (double) virtualMachines.size(); double generalEnergy = generalHostsAnswer.getTotalEnergyUsed() / (double) virtualMachines.size(); EnergyUsagePrediction answer = new EnergyUsagePrediction(vm); answer.setDuration(hostAnswer.getDuration()); double vmsEnergyFraction = division.getEnergyUsage(hostAnswer.getTotalEnergyUsed(), vm); division.setConsiderIdleEnergy(isConsiderIdleEnergy()); answer.setTotalEnergyUsed(vmsEnergyFraction + generalEnergy); double vmsPowerFraction = division.getEnergyUsage(hostAnswer.getAvgPowerUsed(), vm); answer.setAvgPowerUsed(vmsPowerFraction + generalPower); return answer; } CpuOnlyEnergyPredictor();  CpuOnlyEnergyPredictor(PropertiesConfiguration config); }
CpuOnlyEnergyPredictor extends AbstractEnergyPredictor { @Override public EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod) { EnergyDivision division = getEnergyUsage(host, virtualMachines); EnergyUsagePrediction hostAnswer; if (getDefaultAssumedCpuUsage() == -1) { hostAnswer = predictTotalEnergy(host, getCpuUtilisation(host, virtualMachines), timePeriod); } else { hostAnswer = predictTotalEnergy(host, getDefaultAssumedCpuUsage(), timePeriod); } hostAnswer.setAvgPowerUsed(hostAnswer.getTotalEnergyUsed() / ((double) TimeUnit.SECONDS.toHours(timePeriod.getDuration()))); EnergyUsagePrediction generalHostsAnswer = getGeneralHostPredictedEnergy(timePeriod); double generalPower = generalHostsAnswer.getAvgPowerUsed() / (double) virtualMachines.size(); double generalEnergy = generalHostsAnswer.getTotalEnergyUsed() / (double) virtualMachines.size(); EnergyUsagePrediction answer = new EnergyUsagePrediction(vm); answer.setDuration(hostAnswer.getDuration()); double vmsEnergyFraction = division.getEnergyUsage(hostAnswer.getTotalEnergyUsed(), vm); division.setConsiderIdleEnergy(isConsiderIdleEnergy()); answer.setTotalEnergyUsed(vmsEnergyFraction + generalEnergy); double vmsPowerFraction = division.getEnergyUsage(hostAnswer.getAvgPowerUsed(), vm); answer.setAvgPowerUsed(vmsPowerFraction + generalPower); return answer; } CpuOnlyEnergyPredictor();  CpuOnlyEnergyPredictor(PropertiesConfiguration config); @Override EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines, TimePeriod duration); @Override EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod); EnergyUsagePrediction predictTotalEnergy(Host host, double usageCPU, TimePeriod timePeriod); @Override double predictPowerUsed(Host host); @Override double predictPowerUsed(Host host, double usageCPU); @Override double getSumOfSquareError(Host host); @Override double getRootMeanSquareError(Host host); @Override void printFitInformation(Host host); @Override String toString(); }
CpuOnlyEnergyPredictor extends AbstractEnergyPredictor { @Override public EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod) { EnergyDivision division = getEnergyUsage(host, virtualMachines); EnergyUsagePrediction hostAnswer; if (getDefaultAssumedCpuUsage() == -1) { hostAnswer = predictTotalEnergy(host, getCpuUtilisation(host, virtualMachines), timePeriod); } else { hostAnswer = predictTotalEnergy(host, getDefaultAssumedCpuUsage(), timePeriod); } hostAnswer.setAvgPowerUsed(hostAnswer.getTotalEnergyUsed() / ((double) TimeUnit.SECONDS.toHours(timePeriod.getDuration()))); EnergyUsagePrediction generalHostsAnswer = getGeneralHostPredictedEnergy(timePeriod); double generalPower = generalHostsAnswer.getAvgPowerUsed() / (double) virtualMachines.size(); double generalEnergy = generalHostsAnswer.getTotalEnergyUsed() / (double) virtualMachines.size(); EnergyUsagePrediction answer = new EnergyUsagePrediction(vm); answer.setDuration(hostAnswer.getDuration()); double vmsEnergyFraction = division.getEnergyUsage(hostAnswer.getTotalEnergyUsed(), vm); division.setConsiderIdleEnergy(isConsiderIdleEnergy()); answer.setTotalEnergyUsed(vmsEnergyFraction + generalEnergy); double vmsPowerFraction = division.getEnergyUsage(hostAnswer.getAvgPowerUsed(), vm); answer.setAvgPowerUsed(vmsPowerFraction + generalPower); return answer; } CpuOnlyEnergyPredictor();  CpuOnlyEnergyPredictor(PropertiesConfiguration config); @Override EnergyUsagePrediction getHostPredictedEnergy(Host host, Collection<VM> virtualMachines, TimePeriod duration); @Override EnergyUsagePrediction getVMPredictedEnergy(VM vm, Collection<VM> virtualMachines, Host host, TimePeriod timePeriod); EnergyUsagePrediction predictTotalEnergy(Host host, double usageCPU, TimePeriod timePeriod); @Override double predictPowerUsed(Host host); @Override double predictPowerUsed(Host host, double usageCPU); @Override double getSumOfSquareError(Host host); @Override double getRootMeanSquareError(Host host); @Override void printFitInformation(Host host); @Override String toString();  }