CloudletExecution

public class CloudletExecution

Stores execution information about a Cloudlet submitted to a specific Datacenter for processing. This class keeps track of the time for all activities in the Datacenter for a specific Cloudlet. Before a Cloudlet exits the Datacenter, it is RECOMMENDED to call this method finalizeCloudlet().

It acts as a placeholder for maintaining the amount of resource share allocated at various times for simulating any scheduling using internal events.

As the VM where the Cloudlet is running might migrate to another Datacenter, each CloudletExecutionInfo object represents the data about execution of the cloudlet when the Vm was in a given Datacenter.

Author:Manzur Murshed, Rajkumar Buyya

Fields

NULL

public static final CloudletExecution NULL

A property that implements the Null Object Design Pattern for CloudletExecution objects.

Constructors

CloudletExecution

public CloudletExecution(Cloudlet cloudlet)

Instantiates a CloudletExecutionInfo object upon the arrival of a Cloudlet inside a Datacenter. The arriving time is determined by CloudSim.clock().

Parameters:
  • cloudlet – the Cloudlet to store execution information from

Methods

addVirtualRuntime

public double addVirtualRuntime(double timeToAdd)

Adds a given time to the virtual runtime.

Parameters:
  • timeToAdd – time to add to the virtual runtime (in seconds)
Returns:

the new virtual runtime (in seconds)

equals

public boolean equals(Object obj)

finalizeCloudlet

public void finalizeCloudlet()

Finalizes all relevant information before exiting the Datacenter entity. This method sets the final data of:

  • wall clock time, i.e. the time of this Cloudlet resides in a Datacenter (from arrival time until departure time).
  • actual CPU time, i.e. the total execution time of this Cloudlet in a Datacenter.
  • Cloudlet’s finished time so far

getCloudlet

public Cloudlet getCloudlet()

Gets the Cloudlet for which the execution information is related to.

Returns:cloudlet for this execution information object

getCloudletArrivalTime

public double getCloudletArrivalTime()

Gets the time the cloudlet arrived for execution inside the Datacenter.

Returns:arrival time

getCloudletId

public long getCloudletId()

Gets the ID of the Cloudlet this execution info is related to.

getCloudletLength

public long getCloudletLength()

Gets the Cloudlet's length.

Returns:Cloudlet’s length

getFileTransferTime

public double getFileTransferTime()

Gets the time to transfer the list of files required by the Cloudlet from the Datacenter storage (such as a Storage Area Network) to the Vm of the Cloudlet.

getFinishTime

public double getFinishTime()

Gets the time when the Cloudlet has finished completely (not just in a given Datacenter, but finished at all). If the cloudlet wasn’t finished completely yet, the value is equals to Cloudlet.NOT_ASSIGNED.

Returns:finish time of a cloudlet or -1.0 if it cannot finish in this hourly slot

getLastProcessingTime

public double getLastProcessingTime()

Gets the last time the Cloudlet was processed at the Datacenter where this execution information is related to.

Returns:the last time the Cloudlet was processed or zero when it has never been processed yet

getNumberOfPes

public long getNumberOfPes()

getRemainingCloudletLength

public long getRemainingCloudletLength()

Gets the remaining cloudlet length (in MI) that has to be execute yet, considering the Cloudlet.getLength().

Returns:remaining cloudlet length in MI

getTimeSlice

public double getTimeSlice()

Gets the timeslice assigned by a CloudletScheduler for a Cloudlet, which is the amount of time (in seconds) that such a Cloudlet will have to use the PEs of a Vm. Each CloudletScheduler implementation can make use of this attribute or not. CloudletSchedulers that use it, are in charge to compute the timeslice to assign to each Cloudlet.

Returns:Cloudlet timeslice (in seconds)

getVirtualRuntime

public double getVirtualRuntime()

Gets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by a CloudletScheduler (in seconds). The default value of this attribute is zero. Each scheduler implementation might set a value to such attribute to use it for context switch, preempting running Cloudlets to enable other ones to start executing. This way, the attribute is just used internally by specific CloudletSchedulers.

hashCode

public int hashCode()

setFileTransferTime

public void setFileTransferTime(double fileTransferTime)

Sets the time to transfer the list of files required by the Cloudlet from the Datacenter storage (such as a Storage Area Network) to the Vm of the Cloudlet.

Parameters:
  • fileTransferTime – the file transfer time to set

setFinishTime

public void setFinishTime(double time)

Sets the finish time for this Cloudlet. If time is negative, then it will be ignored.

Parameters:
  • time – finish time

setLastProcessingTime

public void setLastProcessingTime(double lastProcessingTime)

Sets the last time this Cloudlet was processed at a Datacenter.

Parameters:
  • lastProcessingTime – the last processing time to set

setStatus

public boolean setStatus(Cloudlet.Status newStatus)

Sets the Cloudlet status.

Parameters:
  • newStatus – the Cloudlet status
Returns:

true if the new status has been set, false otherwise

setTimeSlice

public void setTimeSlice(double timeSlice)

Sets the timeslice assigned by a CloudletScheduler for a Cloudlet, which is the amount of time (in seconds) that such a Cloudlet will have to use the PEs of a Vm. Each CloudletScheduler implementation can make use of this attribute or not. CloudletSchedulers that use it, are in charge to compute the timeslice to assign to each Cloudlet.

Parameters:
  • timeSlice – the Cloudlet timeslice to set (in seconds)

setVirtualRuntime

public void setVirtualRuntime(double virtualRuntime)

Sets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by a CloudletScheduler (in seconds). This attribute is used just internally by specific CloudletSchedulers.

Parameters:
  • virtualRuntime – the value to set (in seconds)

See also: .getVirtualRuntime()

toString

public String toString()

updateProcessing

public void updateProcessing(long partialFinishedInstructions)

Updates the length of cloudlet that has already been completed.

Parameters:
  • partialFinishedInstructions – the partial amount of instructions just executed, to be added to the instructionsFinishedSoFar, in Number of Instructions (instead of Million Instructions)