/** * Returns PE capacity in MIPS. * * @return mips * @todo It considers that all PEs have the same capacity, * what has been shown doesn't be assured. The peList * received by the VmScheduler can be heterogeneous PEs. */ public double getPeCapacity() { if (getPeList() == null) { Log.printLine("Pe list is empty"); return 0; } return getPeList().get(0).getMips(); }
/** * Returns maximum available MIPS among all the host's PEs. * * @return max mips */ public double getMaxAvailableMips() { if (getPeList() == null) { Log.printLine("Pe list is empty"); return 0; } double max = 0.0; for (Pe pe : getPeList()) { double tmp = pe.getPeProvisioner().getAvailableMips(); if (tmp > max) { max = tmp; } } return max; }
/** * Releases PEs allocated to all the VMs of the host the VmScheduler is associated to. * After that, all PEs will be available to be used on demand for requesting VMs. * * @pre $none * @post $none */ public void deallocatePesForAllVms() { getMipsMap().clear(); setAvailableMips(PeList.getTotalMips(getPeList())); for (Pe pe : getPeList()) { pe.getPeProvisioner().deallocateMipsForAllVms(); } }
/** * Creates a new VmScheduler. * * @param pelist the list of PEs of the host where the VmScheduler is associated to. * @pre peList != $null * @post $none */ public VmScheduler(List<? extends Pe> pelist) { setPeList(pelist); setPeMap(new HashMap<String, List<Pe>>()); setMipsMap(new HashMap<String, List<Double>>()); setAvailableMips(PeList.getTotalMips(getPeList())); setVmsMigratingIn(new ArrayList<String>()); setVmsMigratingOut(new ArrayList<String>()); }