Buggy code:
public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShared { private double mips ; private int pesNumber ; private double totalMips ; private Map < String , Double > underAllocatedMips ; private double cachePreviousTime ; private List < Double > cacheCurrentRequestedMips ; public CloudletSchedulerDynamicWorkload ( double mips , int pesNumber ) { } @ Override public double updateVmProcessing ( double currentTime , List < Double > mipsShare ) { setCurrentMipsShare ( mipsShare ) ; double timeSpan = currentTime - ( getPreviousTime ( ) ) ; double nextEvent = Double . MAX_VALUE ; List < ResCloudlet > cloudletsToFinish = new ArrayList < ResCloudlet > ( ) ; for ( ResCloudlet rcl : getCloudletExecList ( ) ) { <START_BUG> rcl . updateCloudletFinishedSoFar ( ( ( long ) ( Math . ceil ( ( timeSpan * ( getTotalCurrentAllocatedMipsForCloudlet ( rcl , getPreviousTime ( ) ) ) ) ) ) ) ) ; <END_BUG> if ( ( rcl . getRemainingCloudletLength ( ) ) == 0 ) { cloudletsToFinish . add ( rcl ) ; continue ; } else { double estimatedFinishTime = getEstimatedFinishTime ( rcl , currentTime ) ; if ( ( estimatedFinishTime - currentTime ) < 0.1 ) { estimatedFinishTime = currentTime + 0.1 ; } if ( estimatedFinishTime < nextEvent ) { nextEvent = estimatedFinishTime ; } } } for ( ResCloudlet rgl : cloudletsToFinish ) { getCloudletExecList ( ) . remove ( rgl ) ; cloudletFinish ( rgl ) ; } setPreviousTime ( currentTime ) ; if ( getCloudletExecList ( ) . isEmpty ( ) ) { return 0 ; } return nextEvent ; } @ Override public double cloudletSubmit ( Cloudlet cl ) { } @ Override public double cloudletSubmit ( Cloudlet cl , double fileTransferTime ) { } @ Override public void cloudletFinish ( ResCloudlet rcl ) { } @ Override public double getTotalUtilizationOfCpu ( double time ) { } @ Override public List < Double > getCurrentRequestedMips ( ) { } @ Override public double getTotalCurrentRequestedMipsForCloudlet ( ResCloudlet rcl , double time ) { } @ Override public double getTotalCurrentAvailableMipsForCloudlet ( ResCloudlet rcl , List < Double > mipsShare ) { } @ Override public double getTotalCurrentAllocatedMipsForCloudlet ( ResCloudlet rcl , double time ) { } public void updateUnderAllocatedMipsForCloudlet ( ResCloudlet rcl , double mips ) { } public double getEstimatedFinishTime ( ResCloudlet rcl , double time ) { } public int getTotalCurrentMips ( ) { } public void setTotalMips ( double mips ) { } public double getTotalMips ( ) { } public void setPesNumber ( int pesNumber ) { } public int getPesNumber ( ) { } public void setMips ( double mips ) { } public double getMips ( ) { } public void setUnderAllocatedMips ( Map < String , Double > underAllocatedMips ) { } public Map < String , Double > getUnderAllocatedMips ( ) { } protected double getCachePreviousTime ( ) { } protected void setCachePreviousTime ( double cachePreviousTime ) { } protected List < Double > getCacheCurrentRequestedMips ( ) { } protected void setCacheCurrentRequestedMips ( List < Double > cacheCurrentRequestedMips ) { } }

Fix:
rcl . updateCloudletFinishedSoFar ( ( ( long ) ( ( timeSpan * ( getTotalCurrentAllocatedMipsForCloudlet ( rcl , getPreviousTime ( ) ) ) ) * 1000000 ) ) ) ;