Package org.cloudbus.cloudsim.vms
Class VmUtilizationHistory
- java.lang.Object
-
- org.cloudbus.cloudsim.vms.VmUtilizationHistory
-
- All Implemented Interfaces:
UtilizationHistory
public class VmUtilizationHistory extends Object implements UtilizationHistory
Stores resource utilization data for a specificVm
.- Since:
- CloudSim Plus 1.4
- Author:
- Anton Beloglazov, Manoel Campos da Silva Filho
-
-
Field Summary
-
Fields inherited from interface org.cloudbus.cloudsim.vms.UtilizationHistory
NULL
-
-
Constructor Summary
Constructors Constructor Description VmUtilizationHistory(Vm vm)
VmUtilizationHistory(Vm vm, boolean enabled)
Instantiates the class to store resource utilization history for a specificVm
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUtilizationHistory(double time)
Adds a CPU utilization percentage history value related to the current simulation time, to the beginning of the History List.void
disable()
Disables the history to avoid utilization data to be added to it.void
enable()
Enables the history so that utilization data can be added to it.SortedMap<Double,Double>
getHistory()
Gets a read-only CPU utilization percentage history map where each key is the time the utilization was collected and each value is the utilization percentage (between [0 and 1]).int
getMaxHistoryEntries()
Gets the maximum number of entries to store in the history.double
getUtilizationMad()
Gets the utilization Median Absolute Deviation (MAD) in MIPS.double
getUtilizationMean()
Gets the utilization mean in MIPS.double
getUtilizationVariance()
Gets the utilization variance in MIPS.Vm
getVm()
boolean
isEnabled()
Checks if the object is enabled to add data to the history.void
setMaxHistoryEntries(int maxHistoryEntries)
Sets the maximum number of entries to store in the history.
-
-
-
Constructor Detail
-
VmUtilizationHistory
public VmUtilizationHistory(Vm vm, boolean enabled)
Instantiates the class to store resource utilization history for a specificVm
.- Parameters:
vm
- the vm to instantiates the object to store utilization historyenabled
- true if the history must be enabled by default, enabling usage history to be collected and stored; false if it must be disabled to avoid storing any history, in order to reduce memory usage
-
VmUtilizationHistory
public VmUtilizationHistory(Vm vm)
-
-
Method Detail
-
getUtilizationMad
public double getUtilizationMad()
Description copied from interface:UtilizationHistory
Gets the utilization Median Absolute Deviation (MAD) in MIPS.- Specified by:
getUtilizationMad
in interfaceUtilizationHistory
- Returns:
-
getUtilizationMean
public double getUtilizationMean()
Description copied from interface:UtilizationHistory
Gets the utilization mean in MIPS.- Specified by:
getUtilizationMean
in interfaceUtilizationHistory
- Returns:
-
getUtilizationVariance
public double getUtilizationVariance()
Description copied from interface:UtilizationHistory
Gets the utilization variance in MIPS.- Specified by:
getUtilizationVariance
in interfaceUtilizationHistory
- Returns:
- the utilization variance in MIPS
-
addUtilizationHistory
public void addUtilizationHistory(double time)
Description copied from interface:UtilizationHistory
Adds a CPU utilization percentage history value related to the current simulation time, to the beginning of the History List. The value is added only if the utilization historyUtilizationHistory.isEnabled()
.- Specified by:
addUtilizationHistory
in interfaceUtilizationHistory
- Parameters:
time
- the current simulation time
-
getHistory
public SortedMap<Double,Double> getHistory()
Description copied from interface:UtilizationHistory
Gets a read-only CPU utilization percentage history map where each key is the time the utilization was collected and each value is the utilization percentage (between [0 and 1]). There will be at least one entry for each time multiple of theDatacenter.getSchedulingInterval()
. This way, it's required to set a Datacenter scheduling interval with the desired value.- Specified by:
getHistory
in interfaceUtilizationHistory
- Returns:
-
isEnabled
public boolean isEnabled()
Description copied from interface:UtilizationHistory
Checks if the object is enabled to add data to the history.- Specified by:
isEnabled
in interfaceUtilizationHistory
- Returns:
-
enable
public void enable()
Description copied from interface:UtilizationHistory
Enables the history so that utilization data can be added to it.- Specified by:
enable
in interfaceUtilizationHistory
-
disable
public void disable()
Description copied from interface:UtilizationHistory
Disables the history to avoid utilization data to be added to it. That allows to reduce memory usage since no utilization data will be collected.- Specified by:
disable
in interfaceUtilizationHistory
-
getMaxHistoryEntries
public int getMaxHistoryEntries()
Description copied from interface:UtilizationHistory
Gets the maximum number of entries to store in the history.- Specified by:
getMaxHistoryEntries
in interfaceUtilizationHistory
- Returns:
-
setMaxHistoryEntries
public void setMaxHistoryEntries(int maxHistoryEntries)
Description copied from interface:UtilizationHistory
Sets the maximum number of entries to store in the history.- Specified by:
setMaxHistoryEntries
in interfaceUtilizationHistory
- Parameters:
maxHistoryEntries
- the value to set
-
getVm
public Vm getVm()
- Specified by:
getVm
in interfaceUtilizationHistory
-
-