/** * Sets the execution start time of this Cloudlet inside a CloudResource. * <br/> * <b>NOTE:</b> With new functionalities, such as being able to cancel / to * pause / to resume this Cloudlet, the execution start time only holds the * latest one. Meaning, all previous execution start time are ignored. * * @param clockTime the latest execution start time * @pre clockTime >= 0.0 * @post $none */ public void setExecStartTime(final double clockTime) { execStartTime = clockTime; if (record) { write("Sets the execution start time to " + num.format(clockTime)); } }
/** * Sets the length of this Cloudlet that has been executed so far. This * method is used by ResCloudlet class when an application is decided to * cancel or to move this Cloudlet into different CloudResources. * * @param length length of this Cloudlet * @see gridsim.AllocPolicy * @see gridsim.ResCloudlet * @pre length >= 0.0 * @post $none */ public void setCloudletFinishedSoFar(final long length) { // if length is -ve then ignore if (length < 0.0 || index < 0) { return; } final Resource res = resList.get(index); res.finishedSoFar = length; if (record) { write("Sets the length's finished so far to " + length); } }
/** * Sets the submission (arrival) time of this Cloudlet into a CloudResource. * * @param clockTime the submission time * @pre clockTime >= 0.0 * @post $none */ public void setSubmissionTime(final double clockTime) { if (clockTime < 0.0 || index < 0) { return; } final Resource res = resList.get(index); res.submissionTime = clockTime; if (record) { write("Sets the submission time to " + num.format(clockTime)); } }
/** * Sets the Cloudlet's execution parameters. These parameters are set by the * CloudResource before departure or sending back to the original Cloudlet's * owner. * * @param wallTime the time of this Cloudlet resides in a CloudResource * (from arrival time until departure time). * @param actualTime the total execution time of this Cloudlet in a * CloudResource. * * @see Resource#wallClockTime * @see Resource#actualCPUTime * * @pre wallTime >= 0.0 * @pre actualTime >= 0.0 * @post $none */ public void setExecParam(final double wallTime, final double actualTime) { if (wallTime < 0.0 || actualTime < 0.0 || index < 0) { return; } final Resource res = resList.get(index); res.wallClockTime = wallTime; res.actualCPUTime = actualTime; if (record) { write("Sets the wall clock time to " + num.format(wallTime) + " and the actual CPU time to " + num.format(actualTime)); } }
/** * Sets the user or owner ID of this Cloudlet. It is <tt>VERY</tt> important * to set the user ID, otherwise this Cloudlet will not be executed in a * CloudResource. * * @param id the user ID * @pre id >= 0 * @post $none */ public void setUserId(final int id) { userId = id; if (record) { write("Assigns the Cloudlet to " + CloudSim.getEntityName(id) + " (ID #" + id + ")"); } }
write("Allocates this Cloudlet to " + res.resourceName + " (ID #" + resourceID + ") with cost = $" + cost + "/sec"); } else if (record) { final int id = resList.get(index).resourceId; final String name = resList.get(index).resourceName; write("Moves Cloudlet from " + name + " (ID #" + id + ") to " + res.resourceName + " (ID #" + resourceID + ") with cost = $" + cost + "/sec");
/** * Sets the execution status code of this Cloudlet. * * @param newStatus the status code of this Cloudlet * @throws Exception Invalid range of Cloudlet status * @pre newStatus >= 0 && newStatus <= 8 * @ * post $none * * @todo It has to throw an specific (unckecked) exception */ public void setCloudletStatus(final int newStatus) throws Exception { // if the new status is same as current one, then ignore the rest if (status == newStatus) { return; } // throws an exception if the new status is outside the range if (newStatus < Cloudlet.CREATED || newStatus > Cloudlet.FAILED_RESOURCE_UNAVAILABLE) { throw new Exception( "Cloudlet.setCloudletStatus() : Error - Invalid integer range for Cloudlet status."); } if (newStatus == Cloudlet.SUCCESS) { finishTime = CloudSim.clock(); } if (record) { write("Sets Cloudlet status from " + getCloudletStatusString() + " to " + Cloudlet.getStatusString(newStatus)); } status = newStatus; }