Class UtilizationModelAbstract
- All Implemented Interfaces:
UtilizationModel
- Direct Known Subclasses:
UtilizationModelDynamic
,UtilizationModelFull
,UtilizationModelPlanetLab
,UtilizationModelStochastic
UtilizationModel
.- Since:
- CloudSim Plus 1.2
- Author:
- Manoel Campos da Silva Filho
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.utilizationmodels.UtilizationModel
UtilizationModel.Unit
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
Indicates that values lower or equal to this will be considered as zero.Fields inherited from interface org.cloudbus.cloudsim.utilizationmodels.UtilizationModel
NULL
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionGets the simulation that this UtilizationModel belongs to.getUnit()
Gets theUtilizationModel.Unit
in which the resource utilization is defined.final double
Gets the expected utilization of resource at the current simulation time.final double
getUtilization
(double time) Gets the expected utilization of resource at a given simulation time.protected abstract double
getUtilizationInternal
(double time) boolean
Checks if the resource utilization requested by a Cloudlet is allowed to exceed 100% or not.setOverCapacityRequestAllowed
(boolean allow) Allow the resource utilization requested by a Cloudlet to exceed 100% or not.setSimulation
(Simulation simulation) Sets the simulation that this UtilizationModel belongs to.protected final UtilizationModel
setUnit
(UtilizationModel.Unit unit) Sets theUtilizationModel.Unit
in which the resource utilization is defined.protected void
validateUtilizationField
(String fieldName, double fieldValue) Checks if a given field has a valid value, considering that the minimum value is zero.protected void
validateUtilizationField
(String fieldName, double fieldValue, double minValue)
-
Field Details
-
ALMOST_ZERO
public static final double ALMOST_ZEROIndicates that values lower or equal to this will be considered as zero.- See Also:
-
-
Constructor Details
-
UtilizationModelAbstract
public UtilizationModelAbstract() -
UtilizationModelAbstract
-
-
Method Details
-
getSimulation
Description copied from interface:UtilizationModel
Gets the simulation that this UtilizationModel belongs to.- Specified by:
getSimulation
in interfaceUtilizationModel
- Returns:
-
getUnit
Description copied from interface:UtilizationModel
Gets theUtilizationModel.Unit
in which the resource utilization is defined.- Specified by:
getUnit
in interfaceUtilizationModel
- Returns:
-
setUnit
Sets theUtilizationModel.Unit
in which the resource utilization is defined.- Parameters:
unit
-UtilizationModel.Unit
to set- Returns:
-
setSimulation
Description copied from interface:UtilizationModel
Sets the simulation that this UtilizationModel belongs to.- Specified by:
setSimulation
in interfaceUtilizationModel
- Parameters:
simulation
- the Simulation instance to set- Returns:
-
getUtilization
public final double getUtilization()Description copied from interface:UtilizationModel
Gets the expected utilization of resource at the current simulation time. Such a value can be a percentage in scale from 0..1 or an absolute value, depending on theUtilizationModel.getUnit()
.It is an expected usage value because the actual
Cloudlet
resource usage depends on the availableVm
resource.- Specified by:
getUtilization
in interfaceUtilizationModel
- Returns:
- the current resource utilization
- See Also:
-
getUtilization
public final double getUtilization(double time) Description copied from interface:UtilizationModel
Gets the expected utilization of resource at a given simulation time. Such a value can be a percentage in scale from 0..1 or an absolute value, depending on theUtilizationModel.getUnit()
.It is an expected usage value because the actual
Cloudlet
resource usage depends on the availableVm
resource.- Specified by:
getUtilization
in interfaceUtilizationModel
- Parameters:
time
- the time to get the resource usage.- Returns:
- the resource utilization at the given time
- See Also:
-
getUtilizationInternal
protected abstract double getUtilizationInternal(double time) -
validateUtilizationField
Checks if a given field has a valid value, considering that the minimum value is zero.- Parameters:
fieldName
- the name of the field to display at the Exception when the value is invalidfieldValue
- the current value of the field
-
validateUtilizationField
-
isOverCapacityRequestAllowed
public boolean isOverCapacityRequestAllowed()Description copied from interface:UtilizationModel
Checks if the resource utilization requested by a Cloudlet is allowed to exceed 100% or not.WARNING: This attribute is just considered when the
UtilizationModel.getUnit()
is defined asUtilizationModel.Unit.PERCENTAGE
.- Specified by:
isOverCapacityRequestAllowed
in interfaceUtilizationModel
- Returns:
- true if Cloudlets can request more than 100% of a resource, false otherwise
- See Also:
-
setOverCapacityRequestAllowed
Description copied from interface:UtilizationModel
Allow the resource utilization requested by a Cloudlet to exceed 100% or not.The VM's
CloudletScheduler
won't allocate more resources than there is available, showing a warning if such a request is received. While requesting more than 100% of a resource may be useful to try simulating an overloading scenario, in other ones it may not be desired. You may want your Cloudlets to request the maximum of 100% of a given resource. In such a case, you can disable this attribute and theUtilizationModel.getUtilization(double)
method will only return values strictly between the closed range [0..1]. If a value greater than 1 is generated, it's returned 1.For specific implementations such as the
UtilizationModelPlanetLab
(which reads data from a trace file that may be manipulated) andUtilizationModelStochastic
(which generates utilization values randomly), the model may return values greater than 1 (100%). In such cases, you may consider disabling this attribute if you don't want such a behaviour.WARNING: This attribute is just considered when the
UtilizationModel.getUnit()
is defined asUtilizationModel.Unit.PERCENTAGE
.- Specified by:
setOverCapacityRequestAllowed
in interfaceUtilizationModel
- Parameters:
allow
- true to allow requesting more than 100% of a resource, false to disallow that- Returns:
-