Interface Cloudlet
-
- All Superinterfaces:
ChangeableId
,Comparable<Cloudlet>
,CustomerEntity
,Delayable
,Identifiable
,UniquelyIdentifiable
- All Known Implementing Classes:
CloudletAbstract
,CloudletSimple
,NetworkCloudlet
public interface Cloudlet extends UniquelyIdentifiable, Comparable<Cloudlet>, CustomerEntity
An interface to be implemented by each class that provides basic cloudlet features. The interface implements the Null Object Design Pattern in order to start avoidingNullPointerException
when using theNULL
object instead of attributingnull
toCloudlet
variables.- Since:
- CloudSim Plus 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Cloudlet.Status
Status of Cloudlets
-
Field Summary
Fields Modifier and Type Field Description static int
NOT_ASSIGNED
Value to indicate that the cloudlet was not assigned to a Datacenter yet.static Cloudlet
NULL
An attribute that implements the Null Object Design Pattern forCloudlet
objects.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addFinishedLengthSoFar(long partialFinishedMI)
Adds the partial length of this Cloudlet that has executed so far (in MI).Cloudlet
addOnFinishListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified when a cloudlet finishes its execution at a givenVm
.Cloudlet
addOnStartListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified when the Cloudlet starts executing in someVm
.Cloudlet
addOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified every time the processing of the Cloudlet is updated in itsVm
.boolean
addRequiredFile(String fileName)
Adds a file to the list or required files.boolean
addRequiredFiles(List<String> fileNames)
Adds a list of files to the required files list.void
assignToDatacenter(Datacenter datacenter)
Sets the parameters of the Datacenter where the Cloudlet is going to be executed.boolean
deleteRequiredFile(String filename)
Deletes the given filename from the list.double
getAccumulatedBwCost()
The total bandwidth (bw) cost for transferring the cloudlet by the network, according to thegetFileSize()
.double
getActualCpuTime()
Returns the total execution time of the Cloudlet in seconds.double
getActualCpuTime(Datacenter datacenter)
Gets the total execution time of this Cloudlet in a given Datacenter ID.double
getArrivalTime(Datacenter datacenter)
Gets the arrival time of this Cloudlet in the given Datacenter.DatacenterBroker
getBroker()
Gets theDatacenterBroker
that represents the owner of this Cloudlet.double
getCostPerBw()
Gets the cost of each byte of bandwidth (bw) consumed.double
getCostPerSec()
Gets the cost/sec of running the Cloudlet in the latest Datacenter.double
getCostPerSec(Datacenter datacenter)
Gets the cost running this Cloudlet in a given Datacenter.double
getExecStartTime()
Gets the latest execution start time of this Cloudlet.long
getFileSize()
Gets the input file size of this Cloudlet before execution (in bytes).long
getFinishedLengthSoFar()
Gets the length of this Cloudlet that has been executed so far from the latest Datacenter (in MI).long
getFinishedLengthSoFar(Datacenter datacenter)
Gets the length of this Cloudlet that has been executed so far (in MI), according to thegetLength()
.double
getFinishTime()
Gets the time when this Cloudlet has completed executing in the latest Datacenter.long
getJobId()
Gets the id of the job that this Cloudlet belongs to, if any.Datacenter
getLastDatacenter()
Gets the latestDatacenter
where the Cloudlet was processed.double
getLastDatacenterArrivalTime()
Gets the arrival time of this Cloudlet from the latest Datacenter where it has executed.long
getLength()
Gets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.int
getNetServiceLevel()
Gets the Type of Service (ToS) of IPv4 for sending Cloudlet over the network.long
getNumberOfPes()
Gets the number of Processing Elements (PEs) from the VM, that is required to execute this cloudlet.long
getOutputSize()
Gets the output file size of this Cloudlet after execution (in bytes).int
getPriority()
Gets the priority of this Cloudlet for scheduling inside a Vm.List<String>
getRequiredFiles()
Gets the list of required files to be used by the cloudlet (if any).Cloudlet.Status
getStatus()
Gets the execution status of this Cloudlet.double
getTotalCost()
Gets the total cost of executing this Cloudlet.long
getTotalLength()
Gets the total length (across all PEs) of this Cloudlet (in MI).UtilizationModel
getUtilizationModelBw()
Gets the utilization model that defines how the cloudlet will use the VM's bandwidth (bw).UtilizationModel
getUtilizationModelCpu()
Gets the utilization model that defines how the cloudlet will use the VM's CPU.UtilizationModel
getUtilizationModelRam()
Gets the utilization model that defines how the cloudlet will use the VM's RAM.double
getUtilizationOfBw()
Gets the utilization of Bandwidth at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theBW utilizaton model
.double
getUtilizationOfBw(double time)
Gets the utilization of Bandwidth at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelBw()
()}.double
getUtilizationOfCpu()
Gets the utilization of CPU at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theCPU utilizaton model
.double
getUtilizationOfCpu(double time)
Gets the utilization of CPU at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelCpu()
.double
getUtilizationOfRam()
Gets the utilization of RAM at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theRAM utilizaton model
.double
getUtilizationOfRam(double time)
Gets the utilization of RAM at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelRam()
()}.Vm
getVm()
Gets the id of Vm that is planned to execute the cloudlet.double
getWaitingTime()
Gets the time the cloudlet had to wait before start executing on a resource.double
getWallClockTime(Datacenter datacenter)
Gets the time of this Cloudlet resides in a given Datacenter (from arrival time until departure time).double
getWallClockTimeInLastExecutedDatacenter()
Gets the time of this Cloudlet resides in the latest Datacenter (from arrival time until departure time).boolean
isAssignedToDatacenter()
boolean
isBindToVm()
Indicates if the Cloudlet is bounded to a specific Vm, meaning that theDatacenterBroker
doesn't have to select a VM for it.boolean
isFinished()
Checks whether this Cloudlet has finished executing or not.void
notifyOnUpdateProcessingListeners(double time)
Notifies all registered listeners about the update on Cloudlet processing.double
registerArrivalInDatacenter()
Register the arrival time of this Cloudlet into a Datacenter to the current simulation time and returns this time.boolean
removeOnFinishListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onCloudletFinishEventListener Listboolean
removeOnStartListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onStartListener List.boolean
removeOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onUpdateCloudletProcessingListener List.boolean
requiresFiles()
Checks whether this cloudlet requires any files or not.void
setBroker(DatacenterBroker broker)
Sets aDatacenterBroker
that represents the owner of this Cloudlet.void
setExecStartTime(double clockTime)
Sets thelatest execution start time
of this Cloudlet.Cloudlet
setFileSize(long fileSize)
Sets the input file size of this Cloudlet before execution (in bytes).void
setJobId(long jobId)
Sets the id of the job that this Cloudlet belongs to, if any.Cloudlet
setLength(long length)
Sets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.boolean
setNetServiceLevel(int netServiceLevel)
Sets the Type of Service (ToS) for sending this cloudlet over a network.Cloudlet
setNumberOfPes(long numberOfPes)
Sets the number of PEs required to run this Cloudlet.Cloudlet
setOutputSize(long outputSize)
Sets the output file size of this Cloudlet after execution (in bytes).void
setPriority(int priority)
Sets thepriority
of this Cloudlet for scheduling inside a Vm.boolean
setStatus(Cloudlet.Status newStatus)
Sets the status of this Cloudlet.Cloudlet
setUtilizationModel(UtilizationModel utilizationModel)
Sets the same utilization model for defining the usage of Bandwidth, CPU and RAM.Cloudlet
setUtilizationModelBw(UtilizationModel utilizationModelBw)
Sets theutilization model of bw
.Cloudlet
setUtilizationModelCpu(UtilizationModel utilizationModelCpu)
Sets theutilization model of cpu
.Cloudlet
setUtilizationModelRam(UtilizationModel utilizationModelRam)
Sets theutilization model of ram
.Cloudlet
setVm(Vm vm)
Sets the id ofVm
that is planned to execute the cloudlet.boolean
setWallClockTime(double wallTime, double actualCpuTime)
Sets the wall clock time the cloudlet spent executing on the current Datacenter.-
Methods inherited from interface org.cloudbus.cloudsim.core.ChangeableId
setId
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.cloudbus.cloudsim.core.CustomerEntity
getSimulation
-
Methods inherited from interface org.cloudbus.cloudsim.core.Delayable
getSubmissionDelay, setSubmissionDelay
-
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
-
Methods inherited from interface org.cloudbus.cloudsim.core.UniquelyIdentifiable
getUid
-
-
-
-
Field Detail
-
NOT_ASSIGNED
static final int NOT_ASSIGNED
Value to indicate that the cloudlet was not assigned to a Datacenter yet.- See Also:
- Constant Field Values
-
-
Method Detail
-
addRequiredFile
boolean addRequiredFile(String fileName)
Adds a file to the list or required files.- Parameters:
fileName
- the name of the required file- Returns:
- true if the file was added (it didn't exist in the list of required files), false otherwise (it did already exist)
-
addRequiredFiles
boolean addRequiredFiles(List<String> fileNames)
Adds a list of files to the required files list. Just the files that don't exist yet in the current required list will be added.- Parameters:
fileNames
- the list of files to be added- Returns:
- true if at leat one file was added, false if no file was added (in the case that all given files already exist in the current required list)
-
deleteRequiredFile
boolean deleteRequiredFile(String filename)
Deletes the given filename from the list.- Parameters:
filename
- the given filename to be deleted- Returns:
- true if the file was found and removed, false if not found
-
requiresFiles
boolean requiresFiles()
Checks whether this cloudlet requires any files or not.- Returns:
- true if required, false otherwise
-
getRequiredFiles
List<String> getRequiredFiles()
Gets the list of required files to be used by the cloudlet (if any). The time to transfer these files by the network is considered when placing the cloudlet inside a given VM- Returns:
- the required files
-
getAccumulatedBwCost
double getAccumulatedBwCost()
The total bandwidth (bw) cost for transferring the cloudlet by the network, according to thegetFileSize()
.- Returns:
- the accumulated bw cost
-
getActualCpuTime
double getActualCpuTime(Datacenter datacenter)
Gets the total execution time of this Cloudlet in a given Datacenter ID.- Parameters:
datacenter
- the Datacenter entity- Returns:
- the total execution time of this Cloudlet in the given Datacenter or 0 if the Cloudlet was not executed there
-
getActualCpuTime
double getActualCpuTime()
Returns the total execution time of the Cloudlet in seconds.- Returns:
- time in which the Cloudlet was running
or
NOT_ASSIGNED
if it hasn't finished yet
-
getFileSize
long getFileSize()
Gets the input file size of this Cloudlet before execution (in bytes). This size has to be considered the program + input data sizes.- Returns:
- the input file size of this Cloudlet (in bytes)
-
getOutputSize
long getOutputSize()
Gets the output file size of this Cloudlet after execution (in bytes). It is the data produced as result of cloudlet execution that needs to be transferred thought the network to simulate sending response data to the user.- Returns:
- the Cloudlet output file size (in bytes)
-
getStatus
Cloudlet.Status getStatus()
Gets the execution status of this Cloudlet.- Returns:
- the Cloudlet status
-
assignToDatacenter
void assignToDatacenter(Datacenter datacenter)
Sets the parameters of the Datacenter where the Cloudlet is going to be executed. From the second time this method is called, every call makes the cloudlet to be migrated to the indicated Datacenter.NOTE: This method should be called only by a
Datacenter
entity.- Parameters:
datacenter
- the Datacenter where the cloudlet will be executed
-
registerArrivalInDatacenter
double registerArrivalInDatacenter()
Register the arrival time of this Cloudlet into a Datacenter to the current simulation time and returns this time.- Returns:
- the arrived time set or
NOT_ASSIGNED
if the cloudlet is not assigned to a Datacenter
-
isAssignedToDatacenter
boolean isAssignedToDatacenter()
- Returns:
- true if the cloudlet has even been assigned to a Datacenter in order to run, false otherwise.
-
getCostPerBw
double getCostPerBw()
Gets the cost of each byte of bandwidth (bw) consumed.Realize costs must be defined for Datacenters by accessing the
DatacenterCharacteristics
object from eachDatacenter
instance and setting the bandwidth cost.- Returns:
- the cost per bw
- See Also:
DatacenterCharacteristics.setCostPerBw(double)
-
getCostPerSec
double getCostPerSec()
Gets the cost/sec of running the Cloudlet in the latest Datacenter.Realize costs must be defined for Datacenters by accessing the
DatacenterCharacteristics
object from eachDatacenter
instance and setting the CPU cost.- Returns:
- the cost associated with running this Cloudlet or 0.0 if was not assigned to any Datacenter yet
- See Also:
DatacenterCharacteristics.setCostPerSecond(double)
-
getCostPerSec
double getCostPerSec(Datacenter datacenter)
Gets the cost running this Cloudlet in a given Datacenter.Realize costs must be defined for Datacenters by accessing the
DatacenterCharacteristics
object from eachDatacenter
instance and setting the CPU cost.- Parameters:
datacenter
- the Datacenter entity- Returns:
- the cost associated with running this Cloudlet in the given Datacenter or 0 if the Cloudlet was not executed there not found
- See Also:
DatacenterCharacteristics.setCostPerSecond(double)
-
getTotalCost
double getTotalCost()
Gets the total cost of executing this Cloudlet. Total Cost = input data transfer + processing cost + output transfer cost .Realize costs must be defined for Datacenters by accessing the
DatacenterCharacteristics
object from eachDatacenter
instance and setting costs for each resource.- Returns:
- the total cost of executing the Cloudlet
- See Also:
DatacenterCharacteristics.setCostPerSecond(double)
,DatacenterCharacteristics.setCostPerBw(double)
-
getExecStartTime
double getExecStartTime()
Gets the latest execution start time of this Cloudlet. With new functionalities, such as CANCEL, PAUSED and RESUMED, this attribute only stores the latest execution time. Previous execution time are ignored. This time represents the simulation second when the cloudlet started.- Returns:
- the latest execution start time
-
getFinishTime
double getFinishTime()
Gets the time when this Cloudlet has completed executing in the latest Datacenter. This time represents the simulation second when the cloudlet finished.- Returns:
- the finish or completion time of this Cloudlet; or
NOT_ASSIGNED
if not finished yet.
-
getLastDatacenterArrivalTime
double getLastDatacenterArrivalTime()
Gets the arrival time of this Cloudlet from the latest Datacenter where it has executed.- Returns:
- the arrival time or
NOT_ASSIGNED
if the cloudlet has never been assigned to a Datacenter
-
getArrivalTime
double getArrivalTime(Datacenter datacenter)
Gets the arrival time of this Cloudlet in the given Datacenter.- Parameters:
datacenter
- the Datacenter entity- Returns:
- the arrival time or
NOT_ASSIGNED
if the cloudlet has never been assigned to a Datacenter
-
getJobId
long getJobId()
Gets the id of the job that this Cloudlet belongs to, if any. This field is just used for classification. If there is an supposed job that multiple Cloudlets belong to, one can set the job id for all Cloudlets of that job in order to classify them. Besides classification, this field doesn't have any effect.- Returns:
- the job id or
NOT_ASSIGNED
if the Cloudlet doesn't belong to a job
-
setJobId
void setJobId(long jobId)
Sets the id of the job that this Cloudlet belongs to, if any. This field is just used for classification. If there is an supposed job that multiple Cloudlets belong to, one can set the job id for all Cloudlets of that job in order to classify them. Besides classification, this field doesn't have any effect.- Parameters:
jobId
- the job id to set
-
getPriority
int getPriority()
Gets the priority of this Cloudlet for scheduling inside a Vm. EachCloudletScheduler
implementation can define if it will use this attribute to impose execution priorities or not. How the priority is interpreted and what is the range of values it accepts depends on theCloudletScheduler
that is being used by the Vm running the Cloudlet.- Returns:
- priority of this cloudlet
-
setPriority
void setPriority(int priority)
Sets thepriority
of this Cloudlet for scheduling inside a Vm. EachCloudletScheduler
implementation can define if it will use this attribute to impose execution priorities or not. How the priority is interpreted and what is the range of values it accepts depends on theCloudletScheduler
that is being used by the Vm running the Cloudlet.- Parameters:
priority
- priority of this Cloudlet
-
getNetServiceLevel
int getNetServiceLevel()
Gets the Type of Service (ToS) of IPv4 for sending Cloudlet over the network. It is the ToS this cloudlet receives in the network (applicable to selected CloudletTaskScheduler class only).- Returns:
- the network service level
-
getNumberOfPes
long getNumberOfPes()
Gets the number of Processing Elements (PEs) from the VM, that is required to execute this cloudlet.- Returns:
- number of PEs
- See Also:
getTotalLength()
-
getLastDatacenter
Datacenter getLastDatacenter()
Gets the latestDatacenter
where the Cloudlet was processed.- Returns:
- the Datacenter or
Datacenter.NULL
if the Cloudlet has not being processed yet.
-
getUtilizationModelBw
UtilizationModel getUtilizationModelBw()
Gets the utilization model that defines how the cloudlet will use the VM's bandwidth (bw).- Returns:
- the utilization model of bw
-
getUtilizationModelCpu
UtilizationModel getUtilizationModelCpu()
Gets the utilization model that defines how the cloudlet will use the VM's CPU.- Returns:
- the utilization model of cpu
-
getUtilizationModelRam
UtilizationModel getUtilizationModelRam()
Gets the utilization model that defines how the cloudlet will use the VM's RAM.- Returns:
- the utilization model of ram
-
getUtilizationOfCpu
double getUtilizationOfCpu()
Gets the utilization of CPU at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theCPU utilizaton model
.- Returns:
- the utilization value
- See Also:
getUtilizationModelCpu()
-
getUtilizationOfCpu
double getUtilizationOfCpu(double time)
Gets the utilization of CPU at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelCpu()
.- Parameters:
time
- the time to get the utilization- Returns:
- the utilization value
- See Also:
getUtilizationModelCpu()
-
getUtilizationOfRam
double getUtilizationOfRam()
Gets the utilization of RAM at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theRAM utilizaton model
.- Returns:
- the utilization value
- See Also:
getUtilizationModelRam()
-
getUtilizationOfRam
double getUtilizationOfRam(double time)
Gets the utilization of RAM at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelRam()
()}.- Parameters:
time
- the time to get the utilization- Returns:
- the utilization value
- See Also:
()
-
getUtilizationOfBw
double getUtilizationOfBw()
Gets the utilization of Bandwidth at the current simulation time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
set for theBW utilizaton model
.- Returns:
- the utilization value
- See Also:
getUtilizationModelCpu()
-
getUtilizationOfBw
double getUtilizationOfBw(double time)
Gets the utilization of Bandwidth at a given time, that is defined in percentage (in scale from [0 to 1]) or absolute values, depending of theUtilizationModel.getUnit()
defined for thegetUtilizationModelBw()
()}.- Parameters:
time
- the time to get the utilization- Returns:
- the utilization value
- See Also:
()
-
getVm
Vm getVm()
Gets the id of Vm that is planned to execute the cloudlet.- Returns:
- the VM, or
NOT_ASSIGNED
if the Cloudlet was not assigned to a VM yet
-
isBindToVm
boolean isBindToVm()
Indicates if the Cloudlet is bounded to a specific Vm, meaning that theDatacenterBroker
doesn't have to select a VM for it. In this case, the Cloudlet was already bounded to a specific VM and must run on it.- Returns:
- true if the Cloudlet is bounded to a specific VM, false otherwise
-
getWaitingTime
double getWaitingTime()
Gets the time the cloudlet had to wait before start executing on a resource.- Returns:
- the waiting time when the cloudlet waited to execute; or 0 if there wasn't any waiting time or the cloudlet hasn't started to execute.
-
getWallClockTimeInLastExecutedDatacenter
double getWallClockTimeInLastExecutedDatacenter()
Gets the time of this Cloudlet resides in the latest Datacenter (from arrival time until departure time).- Returns:
- the wall-clock time in the latest Datacenter or 0 if the Cloudlet has never been executed
- See Also:
- Elapsed real time (wall-clock time)
-
getWallClockTime
double getWallClockTime(Datacenter datacenter)
Gets the time of this Cloudlet resides in a given Datacenter (from arrival time until departure time).- Parameters:
datacenter
- a Datacenter entity- Returns:
- the wall-clock time or 0 if the Cloudlet has never been executed there
- See Also:
- Elapsed real time (wall-clock time)
-
isFinished
boolean isFinished()
Checks whether this Cloudlet has finished executing or not.- Returns:
- true if this Cloudlet has finished execution, false otherwise
-
setFileSize
Cloudlet setFileSize(long fileSize)
Sets the input file size of this Cloudlet before execution (in bytes). This size has to be considered the program + input data sizes.- Parameters:
fileSize
- the size to set (in bytes)- Returns:
- Throws:
IllegalArgumentException
- when the given size is lower or equal to zero
-
setOutputSize
Cloudlet setOutputSize(long outputSize)
Sets the output file size of this Cloudlet after execution (in bytes). It is the data produced as result of cloudlet execution that needs to be transferred thought the network to simulate sending response data to the user.- Parameters:
outputSize
- the output size to set (in bytes)- Returns:
- Throws:
IllegalArgumentException
- when the given size is lower or equal to zero
-
setStatus
boolean setStatus(Cloudlet.Status newStatus)
Sets the status of this Cloudlet.WARNING: This method is just used internally by classes such as
CloudletScheduler
to update Cloudlet status. Calling it directly might not get the expected result. You have to use the CloudletScheduler that controls the execution of the Cloudlet to change the Cloudlets status. The method is public due to a design issue.- Parameters:
newStatus
- the status of this Cloudlet- Returns:
- true if the cloudlet status was changed, i.e, if the newStatus is different from the current status; false otherwise
-
setNetServiceLevel
boolean setNetServiceLevel(int netServiceLevel)
Sets the Type of Service (ToS) for sending this cloudlet over a network.- Parameters:
netServiceLevel
- the new type of service (ToS) of this cloudlet- Returns:
true
if the netServiceLevel is valid, false otherwise.
-
setNumberOfPes
Cloudlet setNumberOfPes(long numberOfPes)
Sets the number of PEs required to run this Cloudlet.
NOTE: The Cloudlet length is computed only for 1 PE for simplicity.
For example, consider a Cloudlet that has a length of 500 MI and requires 2 PEs. This means each PE will execute 500 MI of this Cloudlet.- Parameters:
numberOfPes
- number of PEs- Returns:
-
setUtilizationModel
Cloudlet setUtilizationModel(UtilizationModel utilizationModel)
Sets the same utilization model for defining the usage of Bandwidth, CPU and RAM. To set different utilization models for each one of these resources, use the respective setters.- Parameters:
utilizationModel
- the new utilization model for BW, CPU and RAM- Returns:
- See Also:
setUtilizationModelBw(UtilizationModel)
,setUtilizationModelCpu(UtilizationModel)
,setUtilizationModelRam(UtilizationModel)
-
setUtilizationModelBw
Cloudlet setUtilizationModelBw(UtilizationModel utilizationModelBw)
Sets theutilization model of bw
.- Parameters:
utilizationModelBw
- the new utilization model of bw
-
setUtilizationModelCpu
Cloudlet setUtilizationModelCpu(UtilizationModel utilizationModelCpu)
Sets theutilization model of cpu
.- Parameters:
utilizationModelCpu
- the new utilization model of cpu
-
setUtilizationModelRam
Cloudlet setUtilizationModelRam(UtilizationModel utilizationModelRam)
Sets theutilization model of ram
.- Parameters:
utilizationModelRam
- the new utilization model of ram
-
setVm
Cloudlet setVm(Vm vm)
Sets the id ofVm
that is planned to execute the cloudlet.- Parameters:
vm
- the id of vm to run the cloudlet
-
getLength
long getLength()
Gets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.In case the length is a negative value, it means the Cloudlet doesn't have a defined length, this way, it keeps running until a
CloudSimTags.CLOUDLET_FINISH
message is sent to theDatacenterBroker
.According to this length and the power of the VM processor (in Million Instruction Per Second - MIPS) where the cloudlet will be run, the cloudlet will take a given time to finish processing. For instance, for a cloudlet of 10000 MI running on a processor of 2000 MIPS, the cloudlet will spend 5 seconds using the processor in order to be completed (that may be uninterrupted or not, depending on the scheduling policy).
- Returns:
- the length of this Cloudlet
- See Also:
getTotalLength()
,getNumberOfPes()
-
setLength
Cloudlet setLength(long length)
Sets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.In case the length is a negative value, it means the Cloudlet doesn't have a defined length, this way, it keeps running until a
CloudSimTags.CLOUDLET_FINISH
message is sent to theDatacenterBroker
.According to this length and the power of the VM processor (in Million Instruction Per Second - MIPS) where the cloudlet will be run, the cloudlet will take a given time to finish processing. For instance, for a cloudlet of 10000 MI running on a processor of 2000 MIPS, the cloudlet will spend 5 seconds using the processor in order to be completed (that may be uninterrupted or not, depending on the scheduling policy).
- Parameters:
length
- the length (in MI) of this Cloudlet to be executed in a Vm- Returns:
- Throws:
IllegalArgumentException
- when the given length is lower or equal to zero- See Also:
getLength()
,getTotalLength()
-
getTotalLength
long getTotalLength()
Gets the total length (across all PEs) of this Cloudlet (in MI). It considers thegetLength()
of the cloudlet will be executed in each Pe defined bygetNumberOfPes()
.For example, setting the cloudletLenght as 10000 MI and
getNumberOfPes()
to 4, each Pe will execute 10000 MI. Thus, the entire Cloudlet has a total length of 40000 MI.- Returns:
- the total length of this Cloudlet (in MI)
- See Also:
getNumberOfPes()
,getLength()
-
getFinishedLengthSoFar
long getFinishedLengthSoFar()
Gets the length of this Cloudlet that has been executed so far from the latest Datacenter (in MI). This method is useful when trying to move this Cloudlet into different Datacenter or to cancel it.- Returns:
- the length of a partially executed Cloudlet, or the full Cloudlet length if it is completed
-
getFinishedLengthSoFar
long getFinishedLengthSoFar(Datacenter datacenter)
Gets the length of this Cloudlet that has been executed so far (in MI), according to thegetLength()
. This method is useful when trying to move this Cloudlet into different Datacenters or to cancel it.- Parameters:
datacenter
- the Datacenter entity- Returns:
- the length of a partially executed Cloudlet; the full Cloudlet length if it is completed; or 0 if the Cloudlet has never been executed in the given Datacenter
-
addFinishedLengthSoFar
boolean addFinishedLengthSoFar(long partialFinishedMI)
Adds the partial length of this Cloudlet that has executed so far (in MI).- Parameters:
partialFinishedMI
- the partial executed length of this Cloudlet (in MI) from the last time span (the last time the Cloudlet execution was updated)- Returns:
- true if the length is valid and the cloudlet already has assigned to a Datacenter, false otherwise
- See Also:
CloudletExecution
-
setWallClockTime
boolean setWallClockTime(double wallTime, double actualCpuTime)
Sets the wall clock time the cloudlet spent executing on the current Datacenter. The wall clock time is the total time the Cloudlet resides in a Datacenter (from arrival time until departure time, that may include waiting time). This value is set by the Datacenter before departure or sending back to the original Cloudlet's owner.- Parameters:
wallTime
- the time of this Cloudlet resides in a Datacenter (from arrival time until departure time).actualCpuTime
- the total execution time of this Cloudlet in a Datacenter.- Returns:
- true if the submission time is valid and the cloudlet has already being assigned to a Datacenter for execution
-
setExecStartTime
void setExecStartTime(double clockTime)
Sets thelatest execution start time
of this Cloudlet.
NOTE: With new functionalities, such as being able to cancel, pause or resume this Cloudlet, the execution start time only holds the latest one. Meaning all previous execution start times are ignored.- Parameters:
clockTime
- the latest execution start time
-
addOnStartListener
Cloudlet addOnStartListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified when the Cloudlet starts executing in someVm
.- Parameters:
listener
- the listener to add
-
removeOnStartListener
boolean removeOnStartListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onStartListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
addOnUpdateProcessingListener
Cloudlet addOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified every time the processing of the Cloudlet is updated in itsVm
.- Parameters:
listener
- the listener to add- See Also:
getFinishedLengthSoFar()
-
removeOnUpdateProcessingListener
boolean removeOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onUpdateCloudletProcessingListener List.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
-
addOnFinishListener
Cloudlet addOnFinishListener(EventListener<CloudletVmEventInfo> listener)
Adds a Listener object that will be notified when a cloudlet finishes its execution at a givenVm
.- Parameters:
listener
- the listener to add- Returns:
-
removeOnFinishListener
boolean removeOnFinishListener(EventListener<CloudletVmEventInfo> listener)
Removes a listener from the onCloudletFinishEventListener List- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed, false otherwise
- See Also:
addOnFinishListener(EventListener)
-
notifyOnUpdateProcessingListeners
void notifyOnUpdateProcessingListeners(double time)
Notifies all registered listeners about the update on Cloudlet processing.This method is used just internally and must not be called directly.
- Parameters:
time
- the time the event happened
-
getBroker
DatacenterBroker getBroker()
Gets theDatacenterBroker
that represents the owner of this Cloudlet.- Specified by:
getBroker
in interfaceCustomerEntity
- Returns:
- the broker or
DatacenterBroker.NULL
if a broker has not been set yet
-
setBroker
void setBroker(DatacenterBroker broker)
Sets aDatacenterBroker
that represents the owner of this Cloudlet.- Specified by:
setBroker
in interfaceCustomerEntity
- Parameters:
broker
- theDatacenterBroker
to set
-
-