/** * Requests updating of cloudlets' processing in VMs running in this host. * * @param currentTime the current time * @return expected time of completion of the next cloudlet in all VMs in this host or * {@link Double#MAX_VALUE} if there is no future events expected in this host * @pre currentTime >= 0.0 * @post $none * @todo there is an inconsistency between the return value of this method * and the individual call of {@link Vm#updateVmProcessing(double, java.util.List), * and consequently the {@link CloudletScheduler#updateVmProcessing(double, java.util.List)}. * The current method returns {@link Double#MAX_VALUE} while the other ones * return 0. It has to be checked if there is a reason for this * difference.} */ public double updateVmsProcessing(double currentTime) { double smallerTime = Double.MAX_VALUE; for (Vm vm : getVmList()) { double time = vm.updateVmProcessing( currentTime, getVmScheduler().getAllocatedMipsForVm(vm)); if (time > 0.0 && time < smallerTime) { smallerTime = time; } } return smallerTime; }
for(Cloudlet cloudlet: getCloudletSubmittedList()){ if(!finishedCloudlets.contains(cloudlet) && cloudlet.isFinished()){ Vm vm = getVmsCreatedList().get(cloudlet.getVmId()-1); vm.setCurrentAllocatedRam(vm.getCurrentAllocatedRam() - (int)(cloudlet.getUtilizationOfRam(CloudSim.clock())*100)); vm.updateVmProcessing(CloudSim.clock(), null); finishedCloudlets.add(cloudlet); } }
vm.updateVmProcessing(CloudSim.clock(), getVmScheduler().getAllocatedMipsForVm(vm));
/** * Creates the given VM within the NetworkDatacenter. * It can be directly accessed by Datacenter Broker which manages allocation of Cloudlets. * * @param vm * @return true if the VW was created successfully, false otherwise */ public boolean processVmCreateNetwork(Vm vm) { boolean result = getVmAllocationPolicy().allocateHostForVm(vm); if (result) { VmToSwitchid.put(vm.getId(), ((NetworkHost) vm.getHost()).sw.getId()); VmtoHostlist.put(vm.getId(), vm.getHost().getId()); System.out.println(vm.getId() + " VM is created on " + vm.getHost().getId()); getVmList().add(vm); vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(vm).getVmScheduler() .getAllocatedMipsForVm(vm)); } return result; }
@Override public double updateVmProcessing(final double currentTime, final List<Double> mipsShare) { double time = super.updateVmProcessing(currentTime, mipsShare); if (currentTime > getPreviousTime() && (currentTime - 0.1) % getSchedulingInterval() == 0) { double utilization = getTotalUtilizationOfCpu(getCloudletScheduler().getPreviousTime()); if (CloudSim.clock() != 0 || utilization != 0) { addUtilizationHistoryValue(utilization); } setPreviousTime(currentTime); } return time; }
vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(vm).getVmScheduler() .getAllocatedMipsForVm(vm));