public class UtilizationModelStochastic extends UtilizationModelAbstract
UtilizationModel.Unit
ALMOST_ZERO
NULL
Constructor and Description |
---|
UtilizationModelStochastic()
Instantiates a new utilization model stochastic
that defines the resource utilization in percentage.
|
UtilizationModelStochastic(ContinuousDistribution prng)
Instantiates a new utilization model stochastic based on a given Pseudo Random Number Generator (PRNG)
It defines the resource utilization in percentage.
|
UtilizationModelStochastic(UtilizationModel.Unit unit)
Instantiates a new utilization model stochastic
where the resource utilization is defined in the given unit.
|
UtilizationModelStochastic(UtilizationModel.Unit unit,
ContinuousDistribution prng)
Instantiates a new utilization model stochastic based on a given Pseudo Random Number Generator (PRNG).
|
UtilizationModelStochastic(UtilizationModel.Unit unit,
long seed)
Instantiates a new utilization model stochastic
where the resource utilization is defined in the given unit.
|
Modifier and Type | Method and Description |
---|---|
UtilizationModelStochastic |
disableHistory()
Disables the resource utilization history,
so that utilization values is NOT stored along all the simulation execution.
|
UtilizationModelStochastic |
enableHistory()
Enables the resource utilization history,
so that utilization values is stored along all the simulation execution.
|
ContinuousDistribution |
getRandomGenerator()
Gets the random number generator.
|
double |
getUtilization(double time)
Gets the expected utilization of resource at a given simulation time.
|
protected Double |
getUtilizationHistory(double time)
Gets the utilization percentage for a given time from the internal
historyMap . |
boolean |
isAlwaysGenerateNewRandomUtilization()
Checks if every time the
UtilizationModelAbstract.getUtilization() or getUtilization(double) methods
are called, a new randomly generated utilization will be returned or not. |
boolean |
isHistoryEnabled()
Checks if the history of resource utilization along simulation time
is to be kept or not.
|
void |
loadHistory(String filename)
Load an utilization history from a file.
|
void |
saveHistory(String filename)
Save the utilization history to a file.
|
UtilizationModelStochastic |
setAlwaysGenerateNewRandomUtilization(boolean alwaysGenerateNewRandomUtilization)
Enables or disables the resource utilization history,
so that utilization values is stored along all the simulation execution.
|
UtilizationModelStochastic |
setHistoryEnabled(boolean enableHistory)
Enables or disables the resource utilization history,
so that utilization values is stored along all the simulation execution.
|
void |
setRandomGenerator(ContinuousDistribution randomGenerator)
Sets the random number generator.
|
getSimulation, getUnit, getUtilization, setSimulation, setUnit, validateUtilizationField, validateUtilizationField
public UtilizationModelStochastic()
#setUnit(Unit)
,
enableHistory()
,
isAlwaysGenerateNewRandomUtilization()
public UtilizationModelStochastic(UtilizationModel.Unit unit)
unit
- the Unit
that determines how the resource is used (for instance, if
resource usage is defined in percentage of the Vm resource or in absolute values)enableHistory()
,
isAlwaysGenerateNewRandomUtilization()
public UtilizationModelStochastic(UtilizationModel.Unit unit, long seed)
unit
- the Unit
that determines how the resource is used (for instance, if
resource usage is defined in percentage of the Vm resource or in absolute values)seed
- the seed to initialize the random number generator.
If -1 is passed, the current time will be used.enableHistory()
,
isAlwaysGenerateNewRandomUtilization()
public UtilizationModelStochastic(ContinuousDistribution prng)
prng
- the Pseudo Random Number Generator (PRNG) to generate utilization values#setUnit(Unit)
,
enableHistory()
,
isAlwaysGenerateNewRandomUtilization()
public UtilizationModelStochastic(UtilizationModel.Unit unit, ContinuousDistribution prng)
unit
- the Unit
that determines how the resource is used (for instance, if
resource usage is defined in percentage of the Vm resource or in absolute values)prng
- the Pseudo Random Number Generator (PRNG) to generate utilization valuesenableHistory()
,
isAlwaysGenerateNewRandomUtilization()
public double getUtilization(double time)
UtilizationModel.getUnit()
.
It is an expected usage value because the actual Cloudlet
resource usage
depends on the available Vm
resource.
The method may return different utilization values
for the same requested time.
For performance reasons, this behaviour is dependent of the isHistoryEnabled()
and isAlwaysGenerateNewRandomUtilization()
.
time
- the time to get the resource usage.protected Double getUtilizationHistory(double time)
historyMap
.time
- the time to get the utilization history forpublic void saveHistory(String filename)
filename
- the filenameUncheckedIOException
- when the file cannot be accessedpublic void loadHistory(String filename)
filename
- the filenameUncheckedIOException
- when the file cannot be accessedpublic ContinuousDistribution getRandomGenerator()
public final void setRandomGenerator(ContinuousDistribution randomGenerator)
randomGenerator
- the new random number generatorpublic boolean isHistoryEnabled()
enableHistory()
,
disableHistory()
public UtilizationModelStochastic setHistoryEnabled(boolean enableHistory)
enableHistory
- true to enable the utilization history, false to disableenableHistory()
,
disableHistory()
public UtilizationModelStochastic enableHistory()
public UtilizationModelStochastic disableHistory()
public boolean isAlwaysGenerateNewRandomUtilization()
UtilizationModelAbstract.getUtilization()
or getUtilization(double)
methods
are called, a new randomly generated utilization will be returned or not.
This attribute is false by default, meaning that consecutive utilization requests
for the same time may return the same previous generated utilization value.
Check the documentation in the return section at the end for details.
Using one instance of this utilization model for every Cloudlet in a large simulation scenario may be very expensive in terms of simulation time and memory consumption. This way, the researcher may want to use a single utilization model instance for every Cloudlet. The side effect is that, if this attribute is false (the default), it will usually return the same utilization value for the same requested time for distinct Cloudlets. That commonly is not what the researcher wants. He/she usually wants that every Cloudlet has an independent resource utilization.
To reduce simulation time and memory consumption, you can use a single utilization model instance for a given Cloudlet resource (such as CPU) and set this attribute to false. This way, it will always generate different utilization values for every time an utilization is requested (even if the same previous time is given).
history is enabled
.setAlwaysGenerateNewRandomUtilization(boolean)
public UtilizationModelStochastic setAlwaysGenerateNewRandomUtilization(boolean alwaysGenerateNewRandomUtilization)
alwaysGenerateNewRandomUtilization
- true to enable the utilization history, false to disableisAlwaysGenerateNewRandomUtilization()
Copyright © 2015–2019 Systems, Security and Image Communication Lab - Instituto de Telecomunica����es (IT) - Universidade da Beira Interior (UBI) - Instituto Federal de Educa����o Ci��ncia e Tecnologia do Tocantins (IFTO). All rights reserved.