/** * Instantiates a new VM scheduler * * @param mips The individual MIPS capacity of each PE allocated to the VM using the scheduler, * considering that all PEs have the same capacity. * @param numberOfPes The number of PEs allocated to the VM using the scheduler. */ public CloudletSchedulerDynamicWorkload(double mips, int numberOfPes) { super(); setMips(mips); setNumberOfPes(numberOfPes); /*@todo There shouldn't be a setter to total mips, considering that it is computed from number of PEs and mips. If the number of pes of mips is set any time after here, the total mips will be wrong. Just the getTotalMips is enough, and it have to compute there the total, instead of storing into an attribute.*/ setTotalMips(getNumberOfPes() * getMips()); setUnderAllocatedMips(new HashMap<String, Double>()); setCachePreviousTime(-1); }
@Override public List<Double> getCurrentRequestedMips() { if (getCachePreviousTime() == getPreviousTime()) { return getCacheCurrentRequestedMips(); } List<Double> currentMips = new ArrayList<Double>(); double totalMips = getTotalUtilizationOfCpu(getPreviousTime()) * getTotalMips(); double mipsForPe = totalMips / getNumberOfPes(); for (int i = 0; i < getNumberOfPes(); i++) { currentMips.add(mipsForPe); } setCachePreviousTime(getPreviousTime()); setCacheCurrentRequestedMips(currentMips); return currentMips; }