/** * Gets the total monetary cost of all resources allocated to the VM, * namely the processing power, bandwidth, memory and storage. * * @return */ public double getTotalCost() { return getProcessingCost() + getStorageCost() + getMemoryCost() + getBwCost(); } }
/** * Gets the total monetary cost of processing power allocated from the PM hosting the VM. * * @return */ public double getProcessingCost() { final double hostMips = vm.getHost().getPeList().stream() .findFirst() .map(Pe::getCapacity) .orElse(0L); final double costPerMI = hostMips > 0 ? getDcCharacteristics().getCostPerSecond()/hostMips : 0.0; return costPerMI * getVm().getMips() * getVm().getNumberOfPes(); }
/** * Calculates the cost price of resources (processing, bw, memory, storage) * of each or all of the Datacenter VMs() * */ double getTotalCostPrice() { VmCost vmCost; double totalCost = 0.0; for (Vm vm : getVmList()) { if (vm.getCloudletScheduler().hasFinishedCloudlets()) { vmCost = new VmCost(vm); totalCost += vmCost.getTotalCost(); } else { System.out.printf( "\t%s didn't execute any Cloudlet.\n", vm); } } return totalCost; }
/** * Gets the total monetary cost of the VM's allocated memory. * * @return */ public double getMemoryCost() { return getDcCharacteristics().getCostPerMem() * vm.getRam().getCapacity(); }
/** * Gets the total monetary cost of the VM's allocated storage. * * @return getStorageCost */ public double getStorageCost() { return getDcCharacteristics().getCostPerStorage() * vm.getStorage().getCapacity(); }
/** * Gets the total monetary cost of the VM's allocated BW. * * @return */ public double getBwCost() { return getDcCharacteristics().getCostPerBw() * vm.getBw().getCapacity(); }