Buggy code:
public class CloudletSchedulerSpaceShared extends CloudletScheduler { private List < ? extends ResCloudlet > cloudletWaitingList ; private List < ? extends ResCloudlet > cloudletExecList ; private List < ? extends ResCloudlet > cloudletPausedList ; private List < ? extends ResCloudlet > cloudletFinishedList ; protected int currentCpus ; protected int usedPes ; public CloudletSchedulerSpaceShared ( ) { } @ Override public double updateVmProcessing ( double currentTime , List < Double > mipsShare ) { setCurrentMipsShare ( mipsShare ) ; double timeSpam = currentTime - ( getPreviousTime ( ) ) ; double capacity = 0.0 ; int cpus = 0 ; for ( Double mips : mipsShare ) { capacity += mips ; if ( mips > 0 ) { cpus ++ ; } } currentCpus = cpus ; capacity //= cpus ; for ( ResCloudlet rcl : getCloudletExecList ( ) ) { <START_BUG> rcl . updateCloudletFinishedSoFar ( ( ( long ) ( Math . ceil ( ( ( capacity * timeSpam ) * ( rcl . getPesNumber ( ) ) ) ) ) ) ) ; <END_BUG> } if ( ( ( getCloudletExecList ( ) . size ( ) ) == 0 ) && ( ( getCloudletWaitingList ( ) . size ( ) ) == 0 ) ) { setPreviousTime ( currentTime ) ; return 0.0 ; } int finished = 0 ; int cont = 0 ; List < ResCloudlet > toRemove = new ArrayList < ResCloudlet > ( ) ; for ( ResCloudlet rcl : getCloudletExecList ( ) ) { if ( ( rcl . getRemainingCloudletLength ( ) ) == 0 ) { toRemove . add ( rcl ) ; cloudletFinish ( rcl ) ; finished ++ ; } cont ++ ; } getCloudletExecList ( ) . removeAll ( toRemove ) ; if ( ! ( getCloudletWaitingList ( ) . isEmpty ( ) ) ) { for ( int i = 0 ; i < finished ; i ++ ) { toRemove . clear ( ) ; for ( ResCloudlet rcl : getCloudletWaitingList ( ) ) { if ( ( ( currentCpus ) - ( usedPes ) ) >= ( rcl . getPesNumber ( ) ) ) { rcl . setCloudletStatus ( INEXEC ) ; for ( int k = 0 ; k < ( rcl . getPesNumber ( ) ) ; k ++ ) { rcl . setMachineAndPeId ( 0 , i ) ; } getCloudletExecList ( ) . add ( rcl ) ; usedPes += rcl . getPesNumber ( ) ; toRemove . add ( rcl ) ; break ; } } getCloudletWaitingList ( ) . removeAll ( toRemove ) ; } } double nextEvent = Double . MAX_VALUE ; for ( ResCloudlet rcl : getCloudletExecList ( ) ) { double remainingLength = rcl . getRemainingCloudletLength ( ) ; double estimatedFinishTime = currentTime + ( remainingLength // ( capacity * ( rcl . getPesNumber ( ) ) ) ) ; if ( ( estimatedFinishTime - currentTime ) < 0.1 ) { estimatedFinishTime = currentTime + 0.1 ; } if ( estimatedFinishTime < nextEvent ) { nextEvent = estimatedFinishTime ; } } setPreviousTime ( currentTime ) ; return nextEvent ; } @ Override public Cloudlet cloudletCancel ( int cloudletId ) { } @ Override public boolean cloudletPause ( int cloudletId ) { } @ Override public void cloudletFinish ( ResCloudlet rcl ) { } @ Override public double cloudletResume ( int cloudletId ) { } @ Override public double cloudletSubmit ( Cloudlet cloudlet , double fileTransferTime ) { } @ Override public double cloudletSubmit ( Cloudlet cloudlet ) { } @ Override public int getCloudletStatus ( int cloudletId ) { } @ Override public double getTotalUtilizationOfCpu ( double time ) { } @ Override public boolean isFinishedCloudlets ( ) { } @ Override public Cloudlet getNextFinishedCloudlet ( ) { } @ Override public int runningCloudlets ( ) { } @ Override public Cloudlet migrateCloudlet ( ) { } @ SuppressWarnings ( "unchecked" ) protected < T extends ResCloudlet > List < T > getCloudletWaitingList ( ) { } protected < T extends ResCloudlet > void cloudletWaitingList ( List < T > cloudletWaitingList ) { } @ SuppressWarnings ( "unchecked" ) protected < T extends ResCloudlet > List < T > getCloudletExecList ( ) { } protected < T extends ResCloudlet > void setCloudletExecList ( List < T > cloudletExecList ) { } @ SuppressWarnings ( "unchecked" ) protected < T extends ResCloudlet > List < T > getCloudletPausedList ( ) { } protected < T extends ResCloudlet > void setCloudletPausedList ( List < T > cloudletPausedList ) { } @ SuppressWarnings ( "unchecked" ) protected < T extends ResCloudlet > List < T > getCloudletFinishedList ( ) { } protected < T extends ResCloudlet > void setCloudletFinishedList ( List < T > cloudletFinishedList ) { } @ Override public List < Double > getCurrentRequestedMips ( ) { } @ Override public double getTotalCurrentAvailableMipsForCloudlet ( ResCloudlet rcl , List < Double > mipsShare ) { } @ Override public double getTotalCurrentAllocatedMipsForCloudlet ( ResCloudlet rcl , double time ) { } @ Override public double getTotalCurrentRequestedMipsForCloudlet ( ResCloudlet rcl , double time ) { } @ Override public double getCurrentRequestedUtilizationOfRam ( ) { } @ Override public double getCurrentRequestedUtilizationOfBw ( ) { } }

Fix:
rcl . updateCloudletFinishedSoFar ( ( ( long ) ( ( ( capacity * timeSpam ) * ( rcl . getPesNumber ( ) ) ) * 1000000 ) ) ) ;