/** * Finalizes all relevant information before <tt>exiting</tt> the CloudResource entity. This * method sets the final data of: * <ul> * <li>wall clock time, i.e. the time of this Cloudlet resides in a CloudResource (from arrival * time until departure time). * <li>actual CPU time, i.e. the total execution time of this Cloudlet in a CloudResource. * <li>Cloudlet's finished time so far * </ul> * * @pre $none * @post $none */ public void finalizeCloudlet() { // Sets the wall clock time and actual CPU time double wallClockTime = CloudSim.clock() - arrivalTime; cloudlet.setExecParam(wallClockTime, totalCompletionTime); long finished = 0; //if (cloudlet.getCloudletTotalLength() * Consts.MILLION < cloudletFinishedSoFar) { if (cloudlet.getCloudletStatus()==Cloudlet.SUCCESS) { finished = cloudlet.getCloudletLength(); } else { finished = cloudletFinishedSoFar / Consts.MILLION; } cloudlet.setCloudletFinishedSoFar(finished); }