Class CloudletAbstract
- All Implemented Interfaces:
Comparable<Cloudlet>
,Cloudlet
,ChangeableId
,CustomerEntity
,Delayable
,Identifiable
,UniquelyIdentifiable
- Direct Known Subclasses:
CloudletSimple
Cloudlet
implementations.- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.cloudlets.Cloudlet
Cloudlet.Status
-
Field Summary
Fields inherited from interface org.cloudbus.cloudsim.cloudlets.Cloudlet
NOT_ASSIGNED, NULL
-
Constructor Summary
ConstructorDescriptionCloudletAbstract
(long length, int pesNumber) Creates a Cloudlet with no priority or id.CloudletAbstract
(long length, int pesNumber, UtilizationModel utilizationModel) Creates a Cloudlet with no priority or id.CloudletAbstract
(long length, long pesNumber) Creates a Cloudlet with no priority or id.CloudletAbstract
(long id, long length, long pesNumber) Creates a Cloudlet with no priority, file size and output size equal to 1. -
Method Summary
Modifier and TypeMethodDescriptionprotected long
Gets the absolute value of the length (without the signal).boolean
addFinishedLengthSoFar
(long partialFinishedMI) Adds the partial length of this Cloudlet that has executed so far (in MI).addOnFinishListener
(EventListener<CloudletVmEventInfo> listener) Adds a Listener object that will be notified when a cloudlet finishes its execution at a givenVm
.addOnStartListener
(EventListener<CloudletVmEventInfo> listener) Adds a Listener object that will be notified when the Cloudlet starts executing in someVm
.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
The total bandwidth (bw) cost ($) for transferring the cloudlet by the network, according to theCloudlet.getFileSize()
.double
Returns the total execution time of the Cloudlet in seconds.protected 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 (in seconds).double
Gets the cost ($) of each byte of bandwidth (bw) consumed.double
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
Gets the latest execution start time of this Cloudlet (in seconds).long
Gets the input file size of this Cloudlet before execution (in bytes).long
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 theCloudlet.getLength()
.double
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.double
Gets the arrival time of this Cloudlet from the latest Datacenter where it has executed (in seconds).protected int
long
Gets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.int
Gets the Type of Service (ToS) of IPv4 for sending Cloudlet over the network.long
Gets the number of Processing Elements (PEs) from the VM, that is required to execute this cloudlet.long
Gets the output file size of this Cloudlet after execution (in bytes).int
Gets the priority of this Cloudlet for scheduling inside a Vm.Gets the list of required files to be used by the cloudlet (if any).Gets the execution status of this Cloudlet.double
Gets the time (in seconds) that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object.double
Gets the total cost ($) of executing this Cloudlet.long
Gets the total length (across all PEs) of this Cloudlet (in MI).getUtilizationModel
(Class<? extends ResourceManageable> resourceClass) Gets the utilization model for a given resourceGets the utilization model that defines how the cloudlet will use the VM's bandwidth (bw).Gets the utilization model that defines how the cloudlet will use the VM's CPU.Gets the utilization model that defines how the cloudlet will use the VM's RAM.double
Gets the utilization of Bandwidth at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on 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 (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelBw()
.double
Gets the utilization of CPU at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on 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 (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelCpu()
.double
Gets the utilization of RAM at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on 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 (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelRam()
.getVm()
Gets the Vm that is planned to execute the cloudlet.double
Gets the time (in seconds) the cloudlet had to wait before start executing on a resource.protected double
getWallClockTime
(Datacenter datacenter) Gets the time of this Cloudlet resides in a given Datacenter (from arrival time until departure time).boolean
Checks whether this cloudlet requires any files or not.boolean
Indicates if the Cloudlet is bounded to a specific Vm, meaning that theDatacenterBroker
doesn't have to select a VM for it.boolean
Checks if this object has a submission delay or notboolean
Checks whether this Cloudlet has finished executing or not.boolean
Checks if the Cloudlet has finished and returned to the broker, so that the broker is aware about the end of execution of the Cloudlet.void
notifyOnUpdateProcessingListeners
(double time) Notifies all registered listeners about the update on Cloudlet processing.double
Register the arrival time of this Cloudlet into a Datacenter to the current simulation time and returns this time.boolean
Removes a listener from the onCloudletFinishEventListener Listboolean
Removes a listener from the onStartListener List.boolean
Removes a listener from the onUpdateCloudletProcessingListener List.final Cloudlet
reset()
Resets the state of the Cloudlet.protected final void
setAccumulatedBwCost
(double accumulatedBwCost) Sets theaccumulated bw cost ($)
.protected final void
setCostPerBw
(double costPerBw) Setsthe cost ($) of each byte of bandwidth (bw)
consumed.void
setExecStartTime
(double clockTime) Sets thelatest execution start time
of this Cloudlet.final Cloudlet
setFileSize
(long fileSize) Sets the input file size of this Cloudlet before execution (in bytes).protected final void
setFinishTime
(double finishTime) Sets thefinish time
of this cloudlet in the latest Datacenter.final void
setJobId
(long jobId) Sets the id of the job that this Cloudlet belongs to, if any.protected void
setLastExecutedDatacenterIdx
(int lastExecutedDatacenterIdx) final Cloudlet
setLength
(long length) Sets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each defined PE.void
setNetServiceLevel
(int netServiceLevel) Sets the Type of Service (ToS) for sending this cloudlet over a network.final Cloudlet
setNumberOfPes
(long numberOfPes) Sets the number of PEs required to run this Cloudlet.final Cloudlet
setOutputSize
(long outputSize) Sets the output file size of this Cloudlet after execution (in bytes).setPriority
(int priority) Sets thepriority
of this Cloudlet for scheduling inside a Vm.final void
setRequiredFiles
(List<String> requiredFiles) Sets the list ofrequired files
.setSizes
(long size) Sets the input and output file sizes of this Cloudlet to the same value (in bytes).boolean
setStatus
(Cloudlet.Status newStatus) Sets the status of this Cloudlet.final void
setSubmissionDelay
(double submissionDelay) Sets a relative time (in seconds), from current simulation time, that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object.setUtilizationModel
(UtilizationModel utilizationModel) Sets the same utilization model for defining the usage of Bandwidth, CPU and RAM.final Cloudlet
setUtilizationModelBw
(UtilizationModel utilizationModelBw) Sets theutilization model of bw
.final Cloudlet
setUtilizationModelCpu
(UtilizationModel utilizationModelCpu) Sets theutilization model of cpu
.final Cloudlet
setUtilizationModelRam
(UtilizationModel utilizationModelRam) Sets theutilization model of ram
.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 class org.cloudbus.cloudsim.core.CustomerEntityAbstract
equals, getArrivedTime, getBroker, getCreationTime, getId, getLastTriedDatacenter, getSimulation, getUid, getWaitTime, hashCode, setArrivedTime, setBroker, setCreationTime, setCreationTime, setId, setLastTriedDatacenter
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
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
getArrivedTime, getCreationTime, getLastTriedDatacenter, getSimulation, getWaitTime, setArrivedTime, setLastTriedDatacenter
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
Methods inherited from interface org.cloudbus.cloudsim.core.UniquelyIdentifiable
getUid
-
Constructor Details
-
CloudletAbstract
Creates a Cloudlet with no priority or id. The id is defined when the Cloudlet is submitted to aDatacenterBroker
. The file size and output size is defined as 1.- Parameters:
length
- the length or size (in MI) of this cloudlet to be executed in a VM (check outsetLength(long)
)pesNumber
- number of PEs that Cloudlet will requireutilizationModel
- aUtilizationModel
to define how the Cloudlet uses CPU, RAM and BW. To define an independent utilization model for each resource, call the respective setters.- See Also:
-
CloudletAbstract
public CloudletAbstract(long length, int pesNumber) Creates a Cloudlet with no priority or id. The id is defined when the Cloudlet is submitted to aDatacenterBroker
. The file size and output size is defined as 1.NOTE: By default, the Cloudlet will use a
UtilizationModelFull
to define CPU utilization and aUtilizationModel.NULL
for RAM and BW. To change the default values, use the respective setters.- Parameters:
length
- the length or size (in MI) of this cloudlet to be executed in a VM (check outsetLength(long)
)pesNumber
- number of PEs that Cloudlet will require
-
CloudletAbstract
public CloudletAbstract(long length, long pesNumber) Creates a Cloudlet with no priority or id. The id is defined when the Cloudlet is submitted to aDatacenterBroker
. The file size and output size is defined as 1.NOTE: By default, the Cloudlet will use a
UtilizationModelFull
to define CPU utilization and aUtilizationModel.NULL
for RAM and BW. To change the default values, use the respective setters.- Parameters:
length
- the length or size (in MI) of this cloudlet to be executed in a VM (check outsetLength(long)
)pesNumber
- number of PEs that Cloudlet will require
-
CloudletAbstract
public CloudletAbstract(long id, long length, long pesNumber) Creates a Cloudlet with no priority, file size and output size equal to 1.NOTE: By default, the Cloudlet will use a
UtilizationModelFull
to define CPU utilization and aUtilizationModel.NULL
for RAM and BW. To change the default values, use the respective setters.- Parameters:
id
- id of the Cloudletlength
- the length or size (in MI) of this cloudlet to be executed in a VM (check outsetLength(long)
)pesNumber
- number of PEs that Cloudlet will require
-
-
Method Details
-
reset
Description copied from interface:Cloudlet
Resets the state of the Cloudlet. -
getLastExecutedDatacenterIdx
protected int getLastExecutedDatacenterIdx() -
setLastExecutedDatacenterIdx
protected void setLastExecutedDatacenterIdx(int lastExecutedDatacenterIdx) -
setUtilizationModel
Description copied from interface:Cloudlet
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.- Specified by:
setUtilizationModel
in interfaceCloudlet
- Parameters:
utilizationModel
- the new utilization model for BW, CPU and RAM- Returns:
- See Also:
-
addOnUpdateProcessingListener
Description copied from interface:Cloudlet
Adds a Listener object that will be notified every time the processing of the Cloudlet is updated in itsVm
.- Specified by:
addOnUpdateProcessingListener
in interfaceCloudlet
- Parameters:
listener
- the listener to add- See Also:
-
removeOnUpdateProcessingListener
Description copied from interface:Cloudlet
Removes a listener from the onUpdateCloudletProcessingListener List.- Specified by:
removeOnUpdateProcessingListener
in interfaceCloudlet
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed; false otherwise
-
addOnStartListener
Description copied from interface:Cloudlet
Adds a Listener object that will be notified when the Cloudlet starts executing in someVm
.- Specified by:
addOnStartListener
in interfaceCloudlet
- Parameters:
listener
- the listener to add
-
removeOnStartListener
Description copied from interface:Cloudlet
Removes a listener from the onStartListener List.- Specified by:
removeOnStartListener
in interfaceCloudlet
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed; false otherwise
-
addOnFinishListener
Description copied from interface:Cloudlet
Adds a Listener object that will be notified when a cloudlet finishes its execution at a givenVm
.- Specified by:
addOnFinishListener
in interfaceCloudlet
- Parameters:
listener
- the listener to add- Returns:
-
removeOnFinishListener
Description copied from interface:Cloudlet
Removes a listener from the onCloudletFinishEventListener List- Specified by:
removeOnFinishListener
in interfaceCloudlet
- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was found and removed; false otherwise
- See Also:
-
notifyOnUpdateProcessingListeners
public void notifyOnUpdateProcessingListeners(double time) Description copied from interface:Cloudlet
Notifies all registered listeners about the update on Cloudlet processing.This method is used just internally and must not be called directly.
- Specified by:
notifyOnUpdateProcessingListeners
in interfaceCloudlet
- Parameters:
time
- the time the event happened
-
setLength
Description copied from interface:Cloudlet
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
CloudSimTag.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).
-
setNetServiceLevel
public void setNetServiceLevel(int netServiceLevel) Description copied from interface:Cloudlet
Sets the Type of Service (ToS) for sending this cloudlet over a network.- Specified by:
setNetServiceLevel
in interfaceCloudlet
- Parameters:
netServiceLevel
- the new type of service (ToS) of this cloudlet
-
getNetServiceLevel
public int getNetServiceLevel()Description copied from interface:Cloudlet
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).- Specified by:
getNetServiceLevel
in interfaceCloudlet
- Returns:
- the network service level
-
getWaitingTime
public double getWaitingTime()Description copied from interface:Cloudlet
Gets the time (in seconds) the cloudlet had to wait before start executing on a resource.- Specified by:
getWaitingTime
in interfaceCloudlet
- Returns:
- the waiting time (in seconds) when the cloudlet waited to execute; or 0 if there wasn't any waiting time or the cloudlet hasn't started to execute.
-
getPriority
public int getPriority()Description copied from interface:Cloudlet
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.- Specified by:
getPriority
in interfaceCloudlet
- Returns:
- priority of this cloudlet
-
setPriority
Description copied from interface:Cloudlet
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.WARNING: How the priority is interpreted and what is the range of values it accepts depends on the
CloudletScheduler
that is being used by the Vm running the Cloudlet.- Specified by:
setPriority
in interfaceCloudlet
- Parameters:
priority
- the priority to set- Returns:
-
setNumberOfPes
Description copied from interface:Cloudlet
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.- Specified by:
setNumberOfPes
in interfaceCloudlet
- Parameters:
numberOfPes
- number of PEs- Returns:
-
getNumberOfPes
public long getNumberOfPes()Description copied from interface:Cloudlet
Gets the number of Processing Elements (PEs) from the VM, that is required to execute this cloudlet.- Specified by:
getNumberOfPes
in interfaceCloudlet
- Returns:
- number of PEs
- See Also:
-
getFinishedLengthSoFar
Description copied from interface:Cloudlet
Gets the length of this Cloudlet that has been executed so far (in MI), according to theCloudlet.getLength()
. This method is useful when trying to move this Cloudlet into different Datacenters or to cancel it.- Specified by:
getFinishedLengthSoFar
in interfaceCloudlet
- 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
-
getFinishedLengthSoFar
public long getFinishedLengthSoFar()Description copied from interface:Cloudlet
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.- Specified by:
getFinishedLengthSoFar
in interfaceCloudlet
- Returns:
- the length of a partially executed Cloudlet, or the full Cloudlet length if it is completed (in MI)
-
isFinished
public boolean isFinished()Description copied from interface:Cloudlet
Checks whether this Cloudlet has finished executing or not.- Specified by:
isFinished
in interfaceCloudlet
- Returns:
- true if this Cloudlet has finished execution; false otherwise
-
addFinishedLengthSoFar
public boolean addFinishedLengthSoFar(long partialFinishedMI) Description copied from interface:Cloudlet
Adds the partial length of this Cloudlet that has executed so far (in MI).- Specified by:
addFinishedLengthSoFar
in interfaceCloudlet
- 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:
-
getFileSize
public long getFileSize()Description copied from interface:Cloudlet
Gets the input file size of this Cloudlet before execution (in bytes). This size has to be considered the program + input data sizes.- Specified by:
getFileSize
in interfaceCloudlet
- Returns:
- the input file size of this Cloudlet (in bytes)
-
getOutputSize
public long getOutputSize()Description copied from interface:Cloudlet
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.- Specified by:
getOutputSize
in interfaceCloudlet
- Returns:
- the Cloudlet output file size (in bytes)
-
getExecStartTime
public double getExecStartTime()Description copied from interface:Cloudlet
Gets the latest execution start time of this Cloudlet (in seconds). This attribute only stores the latest execution time. Previous execution time are ignored. This time represents the simulation second when the cloudlet started.- Specified by:
getExecStartTime
in interfaceCloudlet
- Returns:
- the latest execution start time (in seconds)
-
setExecStartTime
public void setExecStartTime(double clockTime) Description copied from interface:Cloudlet
Sets thelatest execution start time
of this Cloudlet.NOTE: The execution start time only holds the latest one. Meaning all previous execution start times are ignored.
- Specified by:
setExecStartTime
in interfaceCloudlet
- Parameters:
clockTime
- the latest execution start time
-
setWallClockTime
public boolean setWallClockTime(double wallTime, double actualCpuTime) Description copied from interface:Cloudlet
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.- Specified by:
setWallClockTime
in interfaceCloudlet
- 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; false otherwise
-
setStatus
Description copied from interface:Cloudlet
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. -
getLength
public long getLength()Description copied from interface:Cloudlet
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
CloudSimTag.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).
-
absLength
protected long absLength()Gets the absolute value of the length (without the signal). Check outgetLength()
for details.- Returns:
-
getTotalLength
public long getTotalLength()Description copied from interface:Cloudlet
Gets the total length (across all PEs) of this Cloudlet (in MI). It considers theCloudlet.getLength()
of the cloudlet will be executed in each Pe defined byCloudlet.getNumberOfPes()
.For example, setting the cloudletLength as 10000 MI and
Cloudlet.getNumberOfPes()
to 4, each Pe will execute 10000 MI. Thus, the entire Cloudlet has a total length of 40000 MI.- Specified by:
getTotalLength
in interfaceCloudlet
- Returns:
- the total length of this Cloudlet (in MI)
- See Also:
-
getCostPerSec
public double getCostPerSec()Description copied from interface:Cloudlet
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.- Specified by:
getCostPerSec
in interfaceCloudlet
- Returns:
- the cost ($) associated with running this Cloudlet; or 0.0 if was not assigned to any Datacenter yet
- See Also:
-
getCostPerSec
Description copied from interface:Cloudlet
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.- Specified by:
getCostPerSec
in interfaceCloudlet
- 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:
-
getActualCpuTime
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
public double getActualCpuTime()Description copied from interface:Cloudlet
Returns the total execution time of the Cloudlet in seconds.- Specified by:
getActualCpuTime
in interfaceCloudlet
- Returns:
- time in which the Cloudlet was running;
or
Cloudlet.NOT_ASSIGNED
if it hasn't finished yet
-
getArrivalTime
Description copied from interface:Cloudlet
Gets the arrival time of this Cloudlet in the given Datacenter (in seconds).- Specified by:
getArrivalTime
in interfaceCloudlet
- Parameters:
datacenter
- the Datacenter entity- Returns:
- the arrival time (in seconds);
or
Cloudlet.NOT_ASSIGNED
if the cloudlet has never been assigned to a Datacenter
-
getWallClockTime
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:
-
getFinishTime
public double getFinishTime()Description copied from interface:Cloudlet
Gets the time when this Cloudlet has completed executing in the latest Datacenter. This time represents the simulation second when the cloudlet finished.- Specified by:
getFinishTime
in interfaceCloudlet
- Returns:
- the finish or completion time of this Cloudlet (in seconds);
or
Cloudlet.NOT_ASSIGNED
if not finished yet.
-
setFinishTime
protected final void setFinishTime(double finishTime) Sets thefinish time
of this cloudlet in the latest Datacenter.- Parameters:
finishTime
- the finish time
-
getStatus
Description copied from interface:Cloudlet
Gets the execution status of this Cloudlet. -
isReturnedToBroker
public boolean isReturnedToBroker()Description copied from interface:Cloudlet
Checks if the Cloudlet has finished and returned to the broker, so that the broker is aware about the end of execution of the Cloudlet.- Specified by:
isReturnedToBroker
in interfaceCloudlet
- Returns:
-
getJobId
public long getJobId()Description copied from interface:Cloudlet
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.- Specified by:
getJobId
in interfaceCloudlet
- Returns:
- the job id;
or
Cloudlet.NOT_ASSIGNED
if the Cloudlet doesn't belong to a job
-
setJobId
public final void setJobId(long jobId) Description copied from interface:Cloudlet
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. -
getVm
Description copied from interface:Cloudlet
Gets the Vm that is planned to execute the cloudlet. -
setVm
Description copied from interface:Cloudlet
Sets the id ofVm
that is planned to execute the cloudlet. -
getTotalCost
public double getTotalCost()Description copied from interface:Cloudlet
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.- Specified by:
getTotalCost
in interfaceCloudlet
- Returns:
- the total cost ($) of executing the Cloudlet
- See Also:
-
getRequiredFiles
Description copied from interface:Cloudlet
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- Specified by:
getRequiredFiles
in interfaceCloudlet
- Returns:
- the required files
-
setRequiredFiles
Sets the list ofrequired files
.- Parameters:
requiredFiles
- the new list of required files
-
addRequiredFile
Description copied from interface:Cloudlet
Adds a file to the list or required files.- Specified by:
addRequiredFile
in interfaceCloudlet
- 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
Description copied from interface:Cloudlet
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.- Specified by:
addRequiredFiles
in interfaceCloudlet
- Parameters:
fileNames
- the list of files to be added- Returns:
- true if at least 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
Description copied from interface:Cloudlet
Deletes the given filename from the list.- Specified by:
deleteRequiredFile
in interfaceCloudlet
- Parameters:
filename
- the given filename to be deleted- Returns:
- true if the file was found and removed, false if not found
-
hasRequiresFiles
public boolean hasRequiresFiles()Description copied from interface:Cloudlet
Checks whether this cloudlet requires any files or not.- Specified by:
hasRequiresFiles
in interfaceCloudlet
- Returns:
- true if required, false otherwise
-
getUtilizationModelCpu
Description copied from interface:Cloudlet
Gets the utilization model that defines how the cloudlet will use the VM's CPU.- Specified by:
getUtilizationModelCpu
in interfaceCloudlet
- Returns:
-
setUtilizationModelCpu
Description copied from interface:Cloudlet
Sets theutilization model of cpu
.- Specified by:
setUtilizationModelCpu
in interfaceCloudlet
- Parameters:
utilizationModelCpu
- the new utilization model of cpu
-
getUtilizationModelRam
Description copied from interface:Cloudlet
Gets the utilization model that defines how the cloudlet will use the VM's RAM.- Specified by:
getUtilizationModelRam
in interfaceCloudlet
- Returns:
-
setUtilizationModelRam
Description copied from interface:Cloudlet
Sets theutilization model of ram
.- Specified by:
setUtilizationModelRam
in interfaceCloudlet
- Parameters:
utilizationModelRam
- the new utilization model of ram
-
getUtilizationModelBw
Description copied from interface:Cloudlet
Gets the utilization model that defines how the cloudlet will use the VM's bandwidth (bw).- Specified by:
getUtilizationModelBw
in interfaceCloudlet
- Returns:
-
setUtilizationModelBw
Description copied from interface:Cloudlet
Sets theutilization model of bw
.- Specified by:
setUtilizationModelBw
in interfaceCloudlet
- Parameters:
utilizationModelBw
- the new utilization model of bw
-
getUtilizationModel
Description copied from interface:Cloudlet
Gets the utilization model for a given resource- Specified by:
getUtilizationModel
in interfaceCloudlet
- Parameters:
resourceClass
- the kind of resource to get itsUtilizationModel
- Returns:
-
getUtilizationOfCpu
public double getUtilizationOfCpu()Description copied from interface:Cloudlet
Gets the utilization of CPU at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
set for theCPU utilizaton model
.- Specified by:
getUtilizationOfCpu
in interfaceCloudlet
- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getUtilizationOfCpu
public double getUtilizationOfCpu(double time) Description copied from interface:Cloudlet
Gets the utilization of CPU at a given time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelCpu()
.- Specified by:
getUtilizationOfCpu
in interfaceCloudlet
- Parameters:
time
- the time to get the utilization- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getUtilizationOfBw
public double getUtilizationOfBw()Description copied from interface:Cloudlet
Gets the utilization of Bandwidth at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
set for theBW utilizaton model
.- Specified by:
getUtilizationOfBw
in interfaceCloudlet
- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getUtilizationOfBw
public double getUtilizationOfBw(double time) Description copied from interface:Cloudlet
Gets the utilization of Bandwidth at a given time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelBw()
.- Specified by:
getUtilizationOfBw
in interfaceCloudlet
- Parameters:
time
- the time to get the utilization- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getUtilizationOfRam
public double getUtilizationOfRam()Description copied from interface:Cloudlet
Gets the utilization of RAM at the current simulation time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
set for theRAM utilizaton model
.- Specified by:
getUtilizationOfRam
in interfaceCloudlet
- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getUtilizationOfRam
public double getUtilizationOfRam(double time) Description copied from interface:Cloudlet
Gets the utilization of RAM at a given time, that is defined in percentage (from [0 to 1]) or absolute values, depending on theUtilizationModel.getUnit()
defined for theCloudlet.getUtilizationModelRam()
.- Specified by:
getUtilizationOfRam
in interfaceCloudlet
- Parameters:
time
- the time to get the utilization- Returns:
- the utilization % (from [0 to 1])
- See Also:
-
getCostPerBw
public double getCostPerBw()Description copied from interface:Cloudlet
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.- Specified by:
getCostPerBw
in interfaceCloudlet
- Returns:
- the cost ($) per bw
- See Also:
-
setCostPerBw
protected final void setCostPerBw(double costPerBw) Setsthe cost ($) of each byte of bandwidth (bw)
consumed.- Parameters:
costPerBw
- the new cost per bw to set
-
getAccumulatedBwCost
public double getAccumulatedBwCost()Description copied from interface:Cloudlet
The total bandwidth (bw) cost ($) for transferring the cloudlet by the network, according to theCloudlet.getFileSize()
.- Specified by:
getAccumulatedBwCost
in interfaceCloudlet
- Returns:
- the accumulated bw cost ($)
-
setAccumulatedBwCost
protected final void setAccumulatedBwCost(double accumulatedBwCost) Sets theaccumulated bw cost ($)
.- Parameters:
accumulatedBwCost
- the accumulated bw cost ($) to set
-
getSubmissionDelay
public double getSubmissionDelay()Description copied from interface:Cloudlet
Gets the time (in seconds) that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object. This is a relative time from the current simulation time.If the VM where the Cloudlet will run is submitted with some delay, the
DatacenterBroker
waits the VM creation. Only after the VM is created, the Cloudlet creation is requested with the delay specified here.- Specified by:
getSubmissionDelay
in interfaceCloudlet
- Specified by:
getSubmissionDelay
in interfaceDelayable
- Returns:
- the submission delay (in seconds)
-
setSubmissionDelay
public final void setSubmissionDelay(double submissionDelay) Description copied from interface:Delayable
Sets a relative time (in seconds), from current simulation time, that aDatacenterBroker
will wait to submit the entity to a Datacenter, in order to request the creation of the object. This is a relative time from the current simulation time.- Specified by:
setSubmissionDelay
in interfaceDelayable
- Parameters:
submissionDelay
- the amount of seconds from the current simulation time that the object will wait to be submitted
-
isDelayed
public boolean isDelayed()Description copied from interface:Delayable
Checks if this object has a submission delay or not -
isBoundToVm
public boolean isBoundToVm()Description copied from interface:Cloudlet
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.- Specified by:
isBoundToVm
in interfaceCloudlet
- Returns:
- true if the Cloudlet is bounded to a specific VM, false otherwise
-
setFileSize
Description copied from interface:Cloudlet
Sets the input file size of this Cloudlet before execution (in bytes). This size has to be considered the program + input data sizes.- Specified by:
setFileSize
in interfaceCloudlet
- Parameters:
fileSize
- the size to set (in bytes)- Returns:
- See Also:
-
setOutputSize
Description copied from interface:Cloudlet
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.- Specified by:
setOutputSize
in interfaceCloudlet
- Parameters:
outputSize
- the output size to set (in bytes)- Returns:
- See Also:
-
setSizes
Description copied from interface:Cloudlet
Sets the input and output file sizes of this Cloudlet to the same value (in bytes). -
assignToDatacenter
Description copied from interface:Cloudlet
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.- Specified by:
assignToDatacenter
in interfaceCloudlet
- Parameters:
datacenter
- the Datacenter where the cloudlet will be executed
-
registerArrivalInDatacenter
public double registerArrivalInDatacenter()Description copied from interface:Cloudlet
Register the arrival time of this Cloudlet into a Datacenter to the current simulation time and returns this time.- Specified by:
registerArrivalInDatacenter
in interfaceCloudlet
- Returns:
- the arrived time set;
or
Cloudlet.NOT_ASSIGNED
if the cloudlet is not assigned to a Datacenter
-
getLastDatacenterArrivalTime
public double getLastDatacenterArrivalTime()Description copied from interface:Cloudlet
Gets the arrival time of this Cloudlet from the latest Datacenter where it has executed (in seconds).- Specified by:
getLastDatacenterArrivalTime
in interfaceCloudlet
- Returns:
- the arrival time (in seconds);
or
Cloudlet.NOT_ASSIGNED
if the cloudlet has never been assigned to a Datacenter
-