/** * Gets the Cloudlet's length. * * @return Cloudlet's length * @pre $none * @post $none */ public long getCloudletLength() { return cloudlet.getCloudletLength(); }
/** * Gets the total length (across all PEs) of this Cloudlet. It considers the * {@link #cloudletLength} of the cloudlet to be executed in each Pe and the * {@link #numberOfPes}.<br/> * * For example, setting the cloudletLenght as 10000 MI and * {@link #numberOfPes} to 4, each Pe will execute 10000 MI. Thus, the * entire cloudlet has a total length of 40000 MI. * * * @return the total length of this Cloudlet * * @see #setCloudletLength(long) * @pre $none * @post $result >= 0.0 */ public long getCloudletTotalLength() { return getCloudletLength() * getNumberOfPes(); }
@Override public double cloudletSubmit(Cloudlet cloudlet, double fileTransferTime) { ResCloudlet rcl = new ResCloudlet(cloudlet); rcl.setCloudletStatus(Cloudlet.INEXEC); for (int i = 0; i < cloudlet.getNumberOfPes(); i++) { rcl.setMachineAndPeId(0, i); } getCloudletExecList().add(rcl); // use the current capacity to estimate the extra amount of // time to file transferring. It must be added to the cloudlet length double extraSize = getCapacity(getCurrentMipsShare()) * fileTransferTime; long length = (long) (cloudlet.getCloudletLength() + extraSize); cloudlet.setCloudletLength(length); return cloudlet.getCloudletLength() / getCapacity(getCurrentMipsShare()); }
/** * Receives an cloudlet to be executed in the VM managed by this scheduler. * * @param cloudlet the submited cloudlet * @param fileTransferTime time required to move the required files from the SAN to the VM * @return expected finish time of this cloudlet * @pre gl != null * @post $none */ @Override public double cloudletSubmit(Cloudlet cloudlet, double fileTransferTime) { ResCloudlet rcl = new ResCloudlet(cloudlet); rcl.setCloudletStatus(Cloudlet.INEXEC); for (int i = 0; i < cloudlet.getNumberOfPes(); i++) { rcl.setMachineAndPeId(0, i); } getCloudletExecList().add(rcl); // use the current capacity to estimate the extra amount of // time to file transferring. It must be added to the cloudlet length double extraSize = getCapacity(getCurrentMipsShare()) * fileTransferTime; long length = (long) (cloudlet.getCloudletLength() + extraSize); cloudlet.setCloudletLength(length); return cloudlet.getCloudletLength() / getCapacity(getCurrentMipsShare()); }
/** * 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); }
long length = cloudlet.getCloudletLength(); length += extraSize; cloudlet.setCloudletLength(length); return cloudlet.getCloudletLength() / capacity;
long length = cloudlet.getCloudletLength(); length += extraSize; cloudlet.setCloudletLength(length); return cloudlet.getCloudletLength() / capacity;
/** * Processes the return of cloudlets. * * @param ev a simulation event. * @since 1.0 */ @Override protected void processCloudletReturn(SimEvent ev) { Cloudlet cloudlet = (Cloudlet) ev.getData(); getCloudletReceivedList().add(cloudlet); Log.printLine(CloudSim.clock()+": "+getName()+ ": Cloudlet "+cloudlet.getCloudletId()+" received"); cloudletsSubmitted -= 1; Cloudlet newCloudlet = new Cloudlet(this.cloudletId, (long) ((long)this.maxLengthOfCloudlets * RandomNumberGenerator.getRandomNumbers(1).get(0)), cloudlet.getNumberOfPes(), cloudlet.getCloudletLength(), cloudlet.getCloudletOutputSize(), cloudlet.getUtilizationModelCpu(), cloudlet.getUtilizationModelRam(), cloudlet.getUtilizationModelBw()); newCloudlet.setUserId(getId()); newCloudlet.setVmId(cloudlet.getVmId()); getCloudletList().add(newCloudlet); this.cloudletId++; submitCloudlets(); }