Class CloudletExecution

java.lang.Object
org.cloudbus.cloudsim.cloudlets.CloudletExecution

public class CloudletExecution
extends Object
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.

Since:
CloudSim Toolkit 1.0
Author:
Manzur Murshed, Rajkumar Buyya
  • Field Summary

    Fields
    Modifier and Type Field Description
    static CloudletExecution NULL
    A property that implements the Null Object Design Pattern for CloudletExecution objects.
  • Constructor Summary

    Constructors
    Constructor Description
    CloudletExecution​(Cloudlet cloudlet)
    Instantiates a CloudletExecutionInfo object upon the arrival of a Cloudlet inside a Datacenter.
  • Method Summary

    Modifier and Type Method Description
    double addVirtualRuntime​(double timeToAdd)
    Adds a given time to the virtual runtime.
    boolean equals​(Object obj)  
    void finalizeCloudlet()
    Finalizes all relevant information before exiting the Datacenter entity.
    Cloudlet getCloudlet()
    Gets the Cloudlet for which the execution information is related to.
    double getCloudletArrivalTime()
    Gets the time the cloudlet arrived for execution inside the Datacenter.
    long getCloudletId()
    Gets the ID of the Cloudlet this execution info is related to.
    long getCloudletLength()
    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.
    double getFinishTime()
    Gets the time when the Cloudlet has finished completely (not just in a given Datacenter, but finished at all).
    double getLastAllocatedMips()
    Gets the last actually allocated MIPS for the Cloudlet.
    double getLastProcessingTime()
    Gets the last time the Cloudlet was processed at the Datacenter where this execution information is related to.
    long getNumberOfPes()  
    long getRemainingCloudletLength()
    Gets the remaining cloudlet length (in MI) that has to be execute yet, considering the Cloudlet.getLength().
    double getTimeSlice()
    Gets the time-slice 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.
    double getVirtualRuntime()
    Gets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by a CloudletScheduler (in seconds).
    int hashCode()  
    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.
    void setFinishTime​(double time)
    Sets the finish time for this Cloudlet.
    void setLastAllocatedMips​(double lastAllocatedMips)
    Sets the last actually allocated MIPS for the Cloudlet.
    void setLastProcessingTime​(double lastProcessingTime)
    Sets the last time this Cloudlet was processed at a Datacenter.
    boolean setStatus​(Cloudlet.Status newStatus)
    Sets the Cloudlet status.
    void setTimeSlice​(double timeSlice)
    Sets the time-slice 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.
    void setVirtualRuntime​(double virtualRuntime)
    Sets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by a CloudletScheduler (in seconds).
    String toString()  
    void updateProcessing​(double partialFinishedInstructions)
    Updates the length of cloudlet that has executed so far.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • 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
  • Method Details

    • getCloudletLength

      public long getCloudletLength()
      Returns:
      Cloudlet's length
    • getNumberOfPes

      public long getNumberOfPes()
    • 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
    • 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
    • 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
    • updateProcessing

      public void updateProcessing​(double partialFinishedInstructions)
      Updates the length of cloudlet that has executed so far.
      Parameters:
      partialFinishedInstructions - the partial amount of instructions just executed, to be added to the instructionsFinishedSoFar, in Number of Instructions (instead of Million Instructions)
    • getCloudletArrivalTime

      public double getCloudletArrivalTime()
      Gets the time the cloudlet arrived for execution inside the Datacenter.
      Returns:
      arrival time
    • 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
    • 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
    • getCloudlet

      public Cloudlet getCloudlet()
      Gets the Cloudlet for which the execution information is related to.
      Returns:
      cloudlet for this execution information object
    • getCloudletId

      public long getCloudletId()
      Gets the ID of the Cloudlet this execution info is related to.
      Returns:
    • 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.
      Returns:
    • 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
    • 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
    • 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
    • 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.
      Returns:
    • 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)
    • 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()
    • getTimeSlice

      public double getTimeSlice()
      Gets the time-slice 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 time-slice to assign to each Cloudlet.
      Returns:
      Cloudlet time-slice (in seconds)
    • setTimeSlice

      public void setTimeSlice​(double timeSlice)
      Sets the time-slice 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 time-slice to assign to each Cloudlet.
      Parameters:
      timeSlice - the Cloudlet time-slice to set (in seconds)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getLastAllocatedMips

      public double getLastAllocatedMips()
      Gets the last actually allocated MIPS for the Cloudlet. That means if no MIPS was allocated for a given time, it is not stored. This value is used to compute the expected finish time of a Cloudlet. If the allocated MIPS is zero, we don't have how to compute that.
      Returns:
    • setLastAllocatedMips

      public void setLastAllocatedMips​(double lastAllocatedMips)
      Sets the last actually allocated MIPS for the Cloudlet. That means if no MIPS was allocated for a given time, it is not stored. This value is used to compute the expected finish time of a Cloudlet. If the allocated MIPS is zero, we don't have how to compute that.
      Parameters:
      lastAllocatedMips - the value to set (if zero or negative, the attribute is not changed)