cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/schedulers/vm/VmSchedulerTimeShared.java
private double allocateMipsFromHostPesToGivenVirtualPe(Vm vm, final double requestedMipsForVmPe, Iterator<Pe> hostPesIterator) {
        if(requestedMipsForVmPe <= 0){
            return 0;
        }

        double allocatedMipsForVmPe = 0;
        /*
        * While all the requested MIPS for the VM PE was not allocated, try to find a Host PE
        * with that MIPS amount available.
        */
        while (allocatedMipsForVmPe <= 0 && hostPesIterator.hasNext()) {
            Pe selectedHostPe = hostPesIterator.next();
             if(allocateAllVmPeRequestedMipsFromHostPe(vm, selectedHostPe, requestedMipsForVmPe)){
                allocatedMipsForVmPe = requestedMipsForVmPe;
             } else {
                allocatedMipsForVmPe += allocatedAvailableMipsFromHostPeToVirtualPe(vm, selectedHostPe);
             }
        }

        return allocatedMipsForVmPe;
    }
/**
     * Try to allocate MIPS from one or more Host PEs to a specific Virtual PE (PE of a VM).
     *
     * @param vm the VM to try to find Host PEs for one of its Virtual PEs
     * @param requestedMipsForVmPe the amount of MIPS requested by such a VM PE
     * @param hostPesIterator a interator over the PEs of the {@link #getHost() Host} that the schedler will
     *                        iterate over to allocate PEs for a VM
     * @return the total MIPS allocated from one or more Host PEs for the requested VM PE
     *
     * @TODO @author manoelcampos The method implementation must to be checked. See the comments inside.
     * Probably there was performed an oversimplification when implementing this method,
     * as it is made for CloudletSchedulerTimeShared class.
     *
     */
Try to allocate MIPS from one or more Host PEs to a specific Virtual PE (PE of a VM).
@param vm the VM to try to find Host PEs for one of its Virtual PEs
@param requestedMipsForVmPe the amount of MIPS requested by such a VM PE
@param hostPesIterator a interator over the PEs of the  #getHost() Host that the schedler will
iterate over to allocate PEs for a VM
@return the total MIPS allocated from one or more Host PEs for the requested VM PE

@TODO @author manoelcampos The method implementation must to be checked. See the comments inside.
Probably there was performed an oversimplification when implementing this method,
as it is made for CloudletSchedulerTimeShared class.
Try to allocate MIPS from one or more Host PEs to a specific Virtual PE ( PE of a VM ) . @param vm the VM to try to find Host PEs for one of its Virtual PEs @param requestedMipsForVmPe the amount of MIPS requested by such a VM PE @param hostPesIterator a interator over the PEs of the #getHost () Host that the schedler will iterate over to allocate PEs for a VM @return the total MIPS allocated from one or more Host PEs for the requested VM PE @TODO @author manoelcampos The method implementation must to be checked . See the comments inside . Probably there was performed an oversimplification when implementing this method as it is made for CloudletSchedulerTimeShared class .
private double allocateMipsFromHostPesToGivenVirtualPe(Vm vm, final double requestedMipsForVmPe, Iterator<Pe> hostPesIterator) {
        if(requestedMipsForVmPe <= 0){
            return 0;
        }
        double allocatedMipsForVmPe = 0;
        /*
        * While all the requested MIPS for the VM PE was not allocated, try to find a Host PE
        * with that MIPS amount available.
        */
        while (allocatedMipsForVmPe <= 0 && hostPesIterator.hasNext()) {
            Pe selectedHostPe = hostPesIterator.next();
             if(allocateAllVmPeRequestedMipsFromHostPe(vm, selectedHostPe, requestedMipsForVmPe)){
                allocatedMipsForVmPe = requestedMipsForVmPe;
             } else {
                allocatedMipsForVmPe += allocatedAvailableMipsFromHostPeToVirtualPe(vm, selectedHostPe);
             }
        }
        return allocatedMipsForVmPe;
    }
private double allocateMipsFromHostPesToGivenVirtualPe ( Vm vm , final double requestedMipsForVmPe , Iterator < Pe > hostPesIterator ) { if ( requestedMipsForVmPe <= 0 ) { return 0 ; } double allocatedMipsForVmPe = 0 ; /*
        * While all the requested MIPS for the VM PE was not allocated, try to find a Host PE
        * with that MIPS amount available.
        */ while ( allocatedMipsForVmPe <= 0 && hostPesIterator . hasNext ( ) ) { Pe selectedHostPe = hostPesIterator . next ( ) ; if ( allocateAllVmPeRequestedMipsFromHostPe ( vm , selectedHostPe , requestedMipsForVmPe ) ) { allocatedMipsForVmPe = requestedMipsForVmPe ; } else { allocatedMipsForVmPe += allocatedAvailableMipsFromHostPeToVirtualPe ( vm , selectedHostPe ) ; } } return allocatedMipsForVmPe ; }
Try to allocate MIPS from one or more Host PEs to a specific Virtual PE (PE of a VM).
Try to allocate MIPS from one or more Host PEs to a specific Virtual PE ( PE of a VM ) .