Upload
lydung
View
261
Download
9
Embed Size (px)
Citation preview
CloudSim Plus DocumentationRelease 1.0.0
Manoel C. Silva Filho, Raysa L. Oliveira, Claudio C. Monteiro, Pedro R. M. Inácio, Mário M. Freire
May 22, 2018
Contents:
1 JavaDocs 1
2 Frequent Asked Questions (FAQ) 513
3 Publications 519
4 Syncing your fork or clone with the latest version from CloudSim Plus repository 521
5 Indices and tables 523
i
ii
CHAPTER 1
JavaDocs
1.1 org.cloudbus.cloudsim.allocationpolicies
Provides classes that implement policies for a org.cloudbus.cloudsim.datacenters.Datacenter toselect a Host to place or migrate a VM, based on some criteria defined by each class. Different policies can followapproaches such as best-fit, worst-fit and so on.
Each Datacenter must have its own instance of a . The most basic implementation is provided bythe class org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicySimple.Only classes that implement the org.cloudbus.cloudsim.allocationpolicies.migration.VmAllocationPolicyMigration interface are able to perform VM migration.
author Manoel Campos da Silva Filho
1.1.1 VmAllocationPolicy
public interface VmAllocationPolicyAn interface to be implemented by each class that represents a policy used by a Datacenter to choose aHost to place or migrate a given Vm.
The VmAllocationPolicy uses Java 8 Functional Programming to enable changing, at runtime, the policy usedto select a Host for a given VM.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See also: .setFindHostForVmFunction(BiFunction)
Fields
NULL
VmAllocationPolicy NULLA property that implements the Null Object Design Pattern for VmAllocationPolicy objects.
1
CloudSim Plus Documentation, Release 1.0.0
Methods
allocateHostForVm
boolean allocateHostForVm(Vm vm)Allocates a host for a given VM.
Parameters
• vm – the VM to allocate a host to
Returns $true if the host could be allocated; $false otherwise
allocateHostForVm
boolean allocateHostForVm(Vm vm, Host host)Allocates a specified host for a given VM.
Parameters
• vm – the VM to allocate a host to
• host – the host to allocate to the given VM
Returns $true if the host could be allocated; $false otherwise
deallocateHostForVm
void deallocateHostForVm(Vm vm)Releases the host used by a VM.
Parameters
• vm – the vm to get its host released
findHostForVm
Optional<Host> findHostForVm(Vm vm)Finds a host that has enough resources to place a given VM. Classes must implement this method to definehow to select a Host for a given VM. They just have to provide a default implementation. However, thisimplementation can be dynamically changed by calling setFindHostForVmFunction(BiFunction).
Parameters
• vm – the vm to find a host for it
Returns an Optional containing a suitable Host to place the VM or an empty Optional if nosuitable Host was found
getDatacenter
Datacenter getDatacenter()Gets the Datacenter associated to the Allocation Policy.
2 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getHostList
<T extends Host> List<T> getHostList()Gets the list of Hosts available in a Datacenter, that will be used by the Allocation Policy to place VMs.
Parameters
• <T> – The generic type
Returns the host list
getOptimizedAllocationMap
Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)Gets a map of optimized allocation for VMs according to current utilization and Hosts under and overloadedconditions. The conditions that will make a new VM placement map to be proposed and returned is defined byeach implementing class.
Parameters
• vmList – the list of VMs to be reallocated
Returns the new vm placement map, where each key is a VM and each value is the host where sucha Vm has to be placed
scaleVmVertically
boolean scaleVmVertically(VerticalVmScaling scaling)Try to scale some Vm’s resource vertically up or down, respectively if:
• the Vm is overloaded and the Host where the Vm is placed has enough capacity
• the Vm is underloaded
The resource to be scaled is defined by the given VerticalVmScaling object.
Parameters
• scaling – the VerticalVmScaling object with information of which resource is be-ing requested to be scaled
Returns true if the requested resource was scaled, false otherwise
setDatacenter
void setDatacenter(Datacenter datacenter)Sets the Datacenter associated to the Allocation Policy
Parameters
• datacenter – the Datacenter to set
setFindHostForVmFunction
void setFindHostForVmFunction(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> findHost-ForVmFunction)
Sets a BiFunction that selects a Host for a given Vm. This Function receives the current VmAllocationPolicy
1.1. org.cloudbus.cloudsim.allocationpolicies 3
CloudSim Plus Documentation, Release 1.0.0
and the Vm requesting to be place. It then returns an Optional that may contain a suitable Host for that Vmor not.
If not Function is set, the default VM selection method provided by implementing classes will be used.
Parameters
• findHostForVmFunction – the BiFunction to set
1.1.2 VmAllocationPolicyAbstract
public abstract class VmAllocationPolicyAbstract implements VmAllocationPolicyAn abstract class that represents the policy used by a Datacenter to choose a Host to place or migrate agiven Vm. It supports two-stage commit of reservation of hosts: first, we reserve the Host and, once committedby the customer, the VM is effectively allocated to that Host.
Each Datacenter must to have its own instance of a VmAllocationPolicy .
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmAllocationPolicyAbstract
public VmAllocationPolicyAbstract()Creates a new VmAllocationPolicy.
VmAllocationPolicyAbstract
public VmAllocationPolicyAbstract(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> find-HostForVmFunction)
Creates a new VmAllocationPolicy, changing the BiFunction to select a Host for a Vm.
Parameters
• findHostForVmFunction – a BiFunction to select a Host for a given Vm.
See also: VmAllocationPolicy.setFindHostForVmFunction(BiFunction)
Methods
addUsedPes
protected void addUsedPes(Vm vm)Adds number used PEs for a Vm to the map between each VM and the number of PEs used.
Parameters
• vm – the VM to add the number of used PEs to the map
4 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
allocateHostForVm
public boolean allocateHostForVm(Vm vm)Allocates the host with less PEs in use for a given VM.
Parameters
• vm – @inheritDoc
Returns @inheritDoc
allocateHostForVm
public boolean allocateHostForVm(Vm vm, Host host)
deallocateHostForVm
public void deallocateHostForVm(Vm vm)
getDatacenter
public Datacenter getDatacenter()
getHostFreePesMap
protected final Map<Host, Long> getHostFreePesMap()Gets a map with the number of free PEs for each host from getHostList().
Returns a Map where each key is a host and each value is the number of free PEs of that host.
getHostList
public final <T extends Host> List<T> getHostList()
removeUsedPes
protected long removeUsedPes(Vm vm)Removes the used PEs for a Vm from the map between each VM and the number of PEs used.
Parameters
• vm –
Returns the used PEs number
scaleVmVertically
public boolean scaleVmVertically(VerticalVmScaling scaling)
1.1. org.cloudbus.cloudsim.allocationpolicies 5
CloudSim Plus Documentation, Release 1.0.0
setDatacenter
public final void setDatacenter(Datacenter datacenter)Sets the Datacenter associated to the Allocation Policy
Parameters
• datacenter – the Datacenter to set
setFindHostForVmFunction
public final void setFindHostForVmFunction(BiFunction<VmAllocationPolicy, Vm, Optional<Host>>findHostForVmFunction)
@inheritDoc The default implementation of such a Function is provided by the methodfindHostForVm(Vm).
Parameters
• findHostForVmFunction – @inheritDoc. Passing null makes the Function to be setas the default findHostForVm(Vm).
setHostFreePesMap
protected final VmAllocationPolicy setHostFreePesMap(Map<Host, Long> hostFreePesMap)Sets the Host free PEs Map.
Parameters
• hostFreePesMap – the new Host free PEs map
setUsedPes
protected final void setUsedPes(Map<Vm, Long> usedPes)Sets the used pes.
Parameters
• usedPes – the used pes
1.1.3 VmAllocationPolicyFirstFit
public class VmAllocationPolicyFirstFit extends VmAllocationPolicyAbstract implements VmAllocationPolicyAn First Fit VM allocation policy which finds the first Host having suitable resources to place a given VM.
NOTE: This policy doesn’t perform optimization of VM allocation (placement) by means of VM migration.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov, Manoel Campos da Silva Filho
6 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
findHostForVm
public Optional<Host> findHostForVm(Vm vm)
getOptimizedAllocationMap
public Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)This implementation doesn’t perform any VM placement optimization and, in fact, has no effect.
Parameters
• vmList – the list of VMs
Returns an empty map to indicate that it never performs optimization
1.1.4 VmAllocationPolicyNull
final class VmAllocationPolicyNull implements VmAllocationPolicyA class that implements the Null Object Design Pattern for the VmAllocationPolicy class.
Author Manoel Campos da Silva Filho
See also: VmAllocationPolicy.NULL
Methods
allocateHostForVm
public boolean allocateHostForVm(Vm vm)
allocateHostForVm
public boolean allocateHostForVm(Vm vm, Host host)
deallocateHostForVm
public void deallocateHostForVm(Vm vm)
findHostForVm
public Optional<Host> findHostForVm(Vm vm)
getDatacenter
public Datacenter getDatacenter()
1.1. org.cloudbus.cloudsim.allocationpolicies 7
CloudSim Plus Documentation, Release 1.0.0
getHostList
public List<Host> getHostList()
getOptimizedAllocationMap
public Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)
scaleVmVertically
public boolean scaleVmVertically(VerticalVmScaling scaling)
setDatacenter
public void setDatacenter(Datacenter datacenter)
setFindHostForVmFunction
public void setFindHostForVmFunction(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> find-HostForVmFunction)
1.1.5 VmAllocationPolicySimple
public class VmAllocationPolicySimple extends VmAllocationPolicyAbstractA VmAllocationPolicy implementation that chooses, as the host for a VM, that one with fewer PEs in use. It istherefore a Worst Fit policy, allocating VMs into the host with most available PEs.
NOTE: This policy doesn’t perform optimization of VM allocation (placement) by means of VM migration.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmAllocationPolicySimple
public VmAllocationPolicySimple()Creates a new VmAllocationPolicySimple object.
VmAllocationPolicySimple
public VmAllocationPolicySimple(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> findHost-ForVmFunction)
Creates a new VmAllocationPolicy, changing the Function to select a Host for a Vm.
Parameters
• findHostForVmFunction – a Function to select a Host for a given Vm.
See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
8 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
allocateHostForVm
public boolean allocateHostForVm(Vm vm, Host host)
deallocateHostForVm
public void deallocateHostForVm(Vm vm)
findHostForVm
public Optional<Host> findHostForVm(Vm vm)Gets the first suitable host from the getHostList() that has fewer used PEs (i.e, higher free PEs).
Returns an Optional containing a suitable Host to place the VM or an empty Optional if notfound
getOptimizedAllocationMap
public Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)This implementation doesn’t perform any VM placement optimization and, in fact, has no effect.
Parameters
• vmList – the list of VMs
Returns an empty map to indicate that it never performs optimization
1.2 org.cloudbus.cloudsim.allocationpolicies.migration
Provides org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicy implementationsthat enables VM migration. For more general information, see the package org.cloudbus.cloudsim.allocationpolicies at the upper level.
author Manoel Campos da Silva Filho
1.2.1 VmAllocationPolicyMigration
public interface VmAllocationPolicyMigration extends VmAllocationPolicyAn interface to be implemented by a VM allocation policy that detects Host under and over CPU utilization.
Author Anton Beloglazov, Manoel Campos da Silva Filho
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 9
CloudSim Plus Documentation, Release 1.0.0
Fields
NULL
VmAllocationPolicyMigration NULLAn attribute that implements the Null Object Design Pattern for VmAllocationPolicyMigration ob-jects.
Methods
getMetricHistory
Map<Host, List<Double>> getMetricHistory()Gets a read-only map of metric history.
Returns the metric history
getOverUtilizationThreshold
double getOverUtilizationThreshold(Host host)Gets the host CPU utilization threshold to detect over utilization. It is a percentage value from 0 to 1. Whetherit is a static or dynamically defined threshold depends on each implementing class.
Parameters
• host – the host to get the over utilization threshold
Returns the over utilization threshold
getTimeHistory
Map<Host, List<Double>> getTimeHistory()Gets a read-only map of times when entries in each history list was added for each Host. All history lists areupdated at the same time.
Returns the time history
getUnderUtilizationThreshold
double getUnderUtilizationThreshold()Gets the percentage of total CPU utilization to indicate that a host is under used and its VMs have to be migrated.
Returns the under utilization threshold (in scale is from 0 to 1, where 1 is 100%)
getUtilizationHistory
Map<Host, List<Double>> getUtilizationHistory()Gets a read-only map of the utilization history for each Host.
Returns the utilization history
10 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isHostOverloaded
boolean isHostOverloaded(Host host)Checks if host is over utilized.
Parameters
• host – the host to check
Returns true, if the host is over utilized; false otherwise
isHostUnderloaded
boolean isHostUnderloaded(Host host)Checks if host is under utilized.
Parameters
• host – the host
Returns true, if the host is under utilized; false otherwise
setUnderUtilizationThreshold
void setUnderUtilizationThreshold(double underUtilizationThreshold)Sets the percentage of total CPU utilization to indicate that a host is under used and its VMs have to be migrated.
Parameters
• underUtilizationThreshold – the under utilization threshold (in scale is from 0 to1, where 1 is 100%)
1.2.2 VmAllocationPolicyMigrationAbstract
public abstract class VmAllocationPolicyMigrationAbstract extends VmAllocationPolicyAbstract implements VmAllocationPolicyMigrationAn abstract VM allocation policy that dynamically optimizes the VM allocation (placement) using migration.It’s a Best Fit policy which selects the Host with most efficient power usage to place a given VM. Such abehaviour can be overridden by sub-classes.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmAllocationPolicyMigrationAbstract
public VmAllocationPolicyMigrationAbstract(PowerVmSelectionPolicy vmSelectionPolicy)Creates a VmAllocationPolicyMigrationAbstract.
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 11
CloudSim Plus Documentation, Release 1.0.0
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationAbstract
public VmAllocationPolicyMigrationAbstract(PowerVmSelectionPolicy vmSelectionPolicy,BiFunction<VmAllocationPolicy, Vm, Op-tional<Host>> findHostForVmFunction)
Creates a new VmAllocationPolicy, changing the Function to select a Host for a Vm.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• findHostForVmFunction – a Function to select a Host for a given Vm. Passingnull makes the Function to be set as the default findHostForVm(Vm).
See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
Methods
addHistoryEntryIfAbsent
protected void addHistoryEntryIfAbsent(Host host, double metric)Adds an entry for each history map of a host if it doesn’t contain an entry for the current simulation time.
Parameters
• host – the host to add metric history entries
• metric – the metric to be added to the metric history map
findHostForVm
public Optional<Host> findHostForVm(Vm vm)
findHostForVm
public Optional<Host> findHostForVm(Vm vm, Set<? extends Host> excludedHosts)Finds a Host that has enough resources to place a given VM and that will not be overloaded after the placement.The selected Host will be that one with most efficient power usage for the given VM.
This method performs the basic filtering and delegates additional ones and the final selection of the Host to othermethod.
Parameters
• vm – the VM
• excludedHosts – the excluded hosts
Returns an Optional containing a suitable Host to place the VM or an empty Optional if notfound
See also: .findHostForVmInternal(Vm,Stream)
12 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
findHostForVm
public Optional<Host> findHostForVm(Vm vm, Set<? extends Host> excludedHosts, Predicate<Host>predicate)
Finds a Host that has enough resources to place a given VM and that will not be overloaded after the placement.The selected Host will be that one with most efficient power usage for the given VM.
This method performs the basic filtering and delegates additional ones and the final selection of the Host to othermethod.
Parameters
• vm – the VM
• excludedHosts – the excluded hosts
• predicate – an additional Predicate to be used to filter the Host to place the VM
Returns an Optional containing a suitable Host to place the VM or an empty Optional if notfound
See also: .findHostForVmInternal(Vm,Stream)
findHostForVmInternal
protected Optional<Host> findHostForVmInternal(Vm vm, Stream<Host> hostStream)Applies additional filters to the Hosts Stream and performs the actual Host selection. This method is a Stream’sfinal operation, that it, it closes the Stream and returns an Optional value.
This method can be overridden by sub-classes to change the method used to select the Host for the given VM.
Parameters
• vm – the VM to find a Host to be placed into
• hostStream – a Stream containing the Hosts after passing the basic filtering
Returns an Optional containing a suitable Host to place the VM or an empty Optional if notfound
See also: .findHostForVm(Vm,Set), .additionalHostFilters(Vm,Stream)
getMaxUtilizationAfterAllocation
protected double getMaxUtilizationAfterAllocation(Host host, Vm vm)Gets the max power consumption of a host after placement of a candidate VM. The VM is not in fact placed atthe host. We assume that load is balanced between PEs. The only restriction is: VM’s max MIPS < PE’s MIPS
Parameters
• host – the host
• vm – the vm
Returns the power after allocation
getMetricHistory
public Map<Host, List<Double>> getMetricHistory()
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 13
CloudSim Plus Documentation, Release 1.0.0
getOptimizedAllocationMap
public Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)
getOverloadedHosts
protected Set<Host> getOverloadedHosts()Gets the List of overloaded hosts. If a Host is overloaded but it has VMs migrating out, then it’s not includedin the returned List because the VMs to be migrated to move the Host from the overload state already are inmigration.
Returns the over utilized hosts
getPowerAfterAllocation
protected double getPowerAfterAllocation(Host host, Vm vm)Gets the power consumption of a host after the supposed placement of a candidate VM. The VM is not in factplaced at the host.
Parameters
• host – the host to check the power consumption
• vm – the candidate vm
Returns the host power consumption after the supposed VM placement or 0 if the power consump-tion could not be determined
getPowerAfterAllocationDifference
protected double getPowerAfterAllocationDifference(Host host, Vm vm)Gets the power consumption different after the supposed placement of a VM into a given Host and the originalHost power consumption.
Parameters
• host – the host to check the power consumption
• vm – the candidate vm
Returns the host power consumption different after the supposed VM placement or 0 if the powerconsumption could not be determined
getSwitchedOffHosts
protected List<Host> getSwitchedOffHosts()Gets the switched off hosts.
Returns the switched off hosts
getTimeHistory
public Map<Host, List<Double>> getTimeHistory()
14 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getUnderUtilizationThreshold
public double getUnderUtilizationThreshold()
getUtilizationHistory
public Map<Host, List<Double>> getUtilizationHistory()
getUtilizationOfCpuMips
protected double getUtilizationOfCpuMips(Host host)Gets the utilization of the CPU in MIPS for the current potentially allocated VMs.
Parameters
• host – the host
Returns the utilization of the CPU in MIPS
getVmSelectionPolicy
protected PowerVmSelectionPolicy getVmSelectionPolicy()Gets the vm selection policy.
Returns the vm selection policy
getVmsToMigrateFromUnderUtilizedHost
protected List<? extends Vm> getVmsToMigrateFromUnderUtilizedHost(Host host)Gets the VMs to migrate from under utilized host.
Parameters
• host – the host
Returns the vms to migrate from under utilized host
isHostOverloaded
public boolean isHostOverloaded(Host host)@inheritDoc It’s based on current CPU usage.
Parameters
• host – @inheritDoc
Returns @inheritDoc
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 15
CloudSim Plus Documentation, Release 1.0.0
isHostUnderloaded
public boolean isHostUnderloaded(Host host)Checks if a host is under utilized, based on current CPU usage.
Parameters
• host – the host
Returns true, if the host is under utilized; false otherwise
isNotAllVmsMigratingOut
protected boolean isNotAllVmsMigratingOut(Host host)Checks if all VMs of a Host are NOT migrating out. In this case, the given Host will not be selected as anunderloaded Host at the current moment.
Parameters
• host – the host to check
isNotHostOverloadedAfterAllocation
protected boolean isNotHostOverloadedAfterAllocation(Host host, Vm vm)Checks if a host will be over utilized after placing of a candidate VM.
Parameters
• host – the host to verify
• vm – the candidate vm
Returns true, if the host will be over utilized after VM placement; false otherwise
setUnderUtilizationThreshold
public void setUnderUtilizationThreshold(double underUtilizationThreshold)
setVmSelectionPolicy
protected final void setVmSelectionPolicy(PowerVmSelectionPolicy vmSelectionPolicy)Sets the vm selection policy.
Parameters
• vmSelectionPolicy – the new vm selection policy
1.2.3 VmAllocationPolicyMigrationBestFitStaticThreshold
public class VmAllocationPolicyMigrationBestFitStaticThreshold extends VmAllocationPolicyMigrationStaticThresholdA VmAllocationPolicy that uses a Static CPU utilization Threshold (THR) to detect host under andgetOverUtilizationThreshold(Host) over utilization.
It’s a Worst Fit policy which selects the Host having the least used amount of CPU MIPS to place a given VM,disregarding energy consumption.
16 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmAllocationPolicyMigrationBestFitStaticThreshold
public VmAllocationPolicyMigrationBestFitStaticThreshold(PowerVmSelectionPolicyvmSelectionPolicy, doubleoverUtilizationThreshold)
VmAllocationPolicyMigrationBestFitStaticThreshold
public VmAllocationPolicyMigrationBestFitStaticThreshold(PowerVmSelectionPolicyvmSelectionPolicy, dou-ble overUtilization-Threshold, BiFunc-tion<VmAllocationPolicy,Vm, Optional<Host>>findHostForVmFunction)
Creates a new VmAllocationPolicy, changing the Function to select a Host for a Vm.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• overUtilizationThreshold – the over utilization threshold
• findHostForVmFunction – a Function to select a Host for a given Vm. Passingnull makes the Function to be set as the default findHostForVm(Vm).
See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
Methods
findHostForVmInternal
protected Optional<Host> findHostForVmInternal(Vm vm, Stream<Host> hostStream)Gets the Host having the least available MIPS capacity (max used MIPS).
This method is ignoring the additional filtering performed by the super class. This way, Host selection isperformed ignoring energy consumption. However, all the basic filters defined in the super class are ensured,since this method is called just after they are applied.
Parameters
• vm – @inheritDoc
• hostStream – @inheritDoc
Returns @inheritDoc
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 17
CloudSim Plus Documentation, Release 1.0.0
1.2.4 VmAllocationPolicyMigrationDynamicUpperThreshold
public interface VmAllocationPolicyMigrationDynamicUpperThreshold extends VmAllocationPolicyMigrationAn interface to be implemented by VM allocation policies that use a dynamic over utilization threshold com-puted using some statistical method such as Median absolute deviation (MAD), InterQuartileRange (IRQ), LocalRegression, etc, depending on the implementing class.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Methods
computeHostUtilizationMeasure
double computeHostUtilizationMeasure(Host host)Computes the measure used to generate the dynamic host over utilization threshold using some statistical method(such as the Median absolute deviation - MAD, InterQuartileRange - IRQ, Local Regression, etc), dependingon the implementing class. The method uses Host utilization history to compute such a metric.
Parameters
• host – the host to get the current utilization
Throws
• IllegalArgumentException – when the measure could not be computed (for in-stance, because the Host doesn’t have enought history to use)
See also: .getOverUtilizationThreshold(Host)
getFallbackVmAllocationPolicy
VmAllocationPolicyMigration getFallbackVmAllocationPolicy()Gets the fallback VM allocation policy to be used when the over utilization host detection doesn’t have data tobe computed.
Returns the fallback vm allocation policy
getSafetyParameter
double getSafetyParameter()Gets the safety parameter for the over utilization threshold in percentage, at scale from 0 to 1. For instance, avalue 1 means 100% while 1.5 means 150%. It is a tuning parameter used by the allocation policy to definewhen a host is overloaded. The overload detection is based on a dynamic defined host utilization threshold.
Such a threshold is computed based on the host’s usage history using different statistical methods (such asMedian absolute deviation - MAD, that is similar to the Standard Deviation) depending on the implementingclass, as defined by the method computeHostUtilizationMeasure(Host).
This safety parameter is used to increase or decrease the utilization threshold. As the safety parameter increases,the threshold decreases, what may lead to less SLA violations. So, as higher is that parameter, safer the algorithmwill be when defining a host as overloaded. A value equal to 0 indicates that the safery parameter doesn’t affectthe computed CPU utilization threshold.
Let’s take an example of a class that uses the MAD to compute the over utilization threshold. Considering ahost’s resource usage mean of 0.6 (60%) and a MAD of 0.2, meaning the usage may vary from 0.4 to 0.8. Nowtake a safety parameter of 0.5 (50%). To compute the usage threshold, the MAD is increased by 50%, being
18 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
equals to 0.3. Finally, the threshold will be 1 - 0.3 = 0.7. Thus, only when the host utilization threshold exceeds70%, the host is considered overloaded.
Here, safer doesn’t mean a more accurate overload detection but that the algorithm will use a lower host utiliza-tion threshold that may lead to lower SLA violations but higher resource wastage. Thus this parameter has to betuned in order to trade-off between SLA violation and resource wastage.
setFallbackVmAllocationPolicy
void setFallbackVmAllocationPolicy(VmAllocationPolicyMigration fallbackPolicy)Sets the fallback VM allocation policy to be used when the over utilization host detection doesn’t have data tobe computed.
Parameters
• fallbackPolicy – the new fallback vm allocation policy
1.2.5 VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit
public abstract class VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit extends VmAllocationPolicyMigrationAbstract implements VmAllocationPolicyMigrationDynamicUpperThresholdAn abstract class that is the base for implementation of VM allocation policies which use a dynamic overutilization threshold. It’s a Best Fit policy which selects the Host with most efficient power usage to place agiven VM. Such a behaviour can be overridden by sub-classes.
Author Manoel Campos da Silva Filho
Constructors
VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit
public VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit(PowerVmSelectionPolicyvmSelectionPol-icy)
Creates a VmAllocationPolicyMigrationDynamicUpperThreshold with a safety parameter equals to 0and no fallback policy .
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit
public VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit(PowerVmSelectionPolicyvmSelectionPol-icy, doublesafetyParameter,VmAllocation-PolicyMigrationfallbackVmAlloca-tionPolicy)
Creates a VmAllocationPolicyMigrationDynamicUpperThreshold.
Parameters
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 19
CloudSim Plus Documentation, Release 1.0.0
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• safetyParameter – the safety parameter
• fallbackVmAllocationPolicy – the fallback VM allocation policy to be used whenthe over utilization host detection doesn’t have data to be computed
Methods
getFallbackVmAllocationPolicy
public VmAllocationPolicyMigration getFallbackVmAllocationPolicy()
getOverUtilizationThreshold
public double getOverUtilizationThreshold(Host host)Gets a dynamically computed Host over utilization threshold based on the Host CPU utilization history.
Parameters
• host – @inheritDoc
Returns @inheritDoc or Double.MAX_VALUE if the threshold could not be computed (for in-stance, because the Host doesn’t have enought history to use)
See also: VmAllocationPolicyMigrationDynamicUpperThreshold.computeHostUtilizationMeasure(Host)
getSafetyParameter
public double getSafetyParameter()
isHostOverloaded
public boolean isHostOverloaded(Host host)Checks if a host is over utilized based on the CPU over utilization threshold computed using the statisticalmethod defined in computeHostUtilizationMeasure(Host).
Parameters
• host – @inheritDoc
Returns @inheritDoc
setFallbackVmAllocationPolicy
public final void setFallbackVmAllocationPolicy(VmAllocationPolicyMigration fallbackPolicy)
20 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setSafetyParameter
protected final void setSafetyParameter(double safetyParameter)Sets the safety parameter.
Parameters
• safetyParameter – the new safety parameter
1.2.6 VmAllocationPolicyMigrationInterQuartileRange
public class VmAllocationPolicyMigrationInterQuartileRange extends VmAllocationPolicyMigrationDynamicUpperThresholdFirstFitA VM allocation policy that uses Inter Quartile Range (IQR) to compute a dynamic threshold in order to detecthost over utilization. It’s a Best Fit policy which selects the Host with most efficient power usage to place agiven VM.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Constructors
VmAllocationPolicyMigrationInterQuartileRange
public VmAllocationPolicyMigrationInterQuartileRange(PowerVmSelectionPolicy vmSelec-tionPolicy)
Creates a VmAllocationPolicyMigrationInterQuartileRange with a safety parameter equals to 0 and nofallback policy .
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationInterQuartileRange
public VmAllocationPolicyMigrationInterQuartileRange(PowerVmSelectionPolicy vmSelec-tionPolicy, double safetyParame-ter, VmAllocationPolicyMigrationfallbackPolicy)
Creates a VmAllocationPolicyMigrationInterQuartileRange.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• safetyParameter – the safety parameter
• fallbackPolicy – the fallback VM allocation policy to be used when the over utiliza-tion host detection doesn’t have data to be computed
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 21
CloudSim Plus Documentation, Release 1.0.0
Methods
computeHostUtilizationMeasure
public double computeHostUtilizationMeasure(Host host)Computes the host utilization IRQ used for generating the host over utilization threshold.
Parameters
• host – the host
Returns the host CPU utilization percentage IQR
1.2.7 VmAllocationPolicyMigrationLocalRegression
public class VmAllocationPolicyMigrationLocalRegression extends VmAllocationPolicyMigrationDynamicUpperThresholdFirstFitA VM allocation policy that uses Local Regression (LR) to predict host utilization (load) and define if a host isoverloaded or not. It’s a Best Fit policy which selects the Host with most efficient power usage to place agiven VM. Such a behaviour can be overridden by sub-classes.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Constructors
VmAllocationPolicyMigrationLocalRegression
public VmAllocationPolicyMigrationLocalRegression(PowerVmSelectionPolicy vmSelection-Policy)
Creates a VmAllocationPolicyMigrationLocalRegression with a safety parameter equals to 0 and nofallback policy .
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationLocalRegression
public VmAllocationPolicyMigrationLocalRegression(PowerVmSelectionPolicy vmSelection-Policy, double safetyParameter, VmAl-locationPolicyMigration fallbackVmAl-locationPolicy)
Creates a VmAllocationPolicyMigrationLocalRegression.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• safetyParameter – the safety parameter
22 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• fallbackVmAllocationPolicy – the fallback VM allocation policy to be used whenthe over utilization host detection doesn’t have data to be computed
Methods
computeHostUtilizationMeasure
public double computeHostUtilizationMeasure(Host host)Computes a Local Regression of the host utilization history to estimate the current host utilization. Such a valueis used to generate the host over utilization threshold.
Parameters
• host – the host
Throws
• @inheritDoc –
Returns the host utilization Local Regression
getMaximumVmMigrationTime
protected double getMaximumVmMigrationTime(Host host)Gets the maximum vm migration time.
Parameters
• host – the host
Returns the maximum vm migration time
getOverUtilizationThreshold
public double getOverUtilizationThreshold(Host host)@inheritDoc. In this case, this is a predicted value based on Local Regression of the utilization history.
Parameters
• host – the host to get the over utilization threshold prediction
Returns @inheritDoc or Double.MAX_VALUE if the threshold could not be computed
getParameterEstimates
protected double[] getParameterEstimates(double... utilizationHistoryReversed)Gets utilization estimates.
Parameters
• utilizationHistoryReversed – the utilization history in reverse order
Returns the utilization estimates
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 23
CloudSim Plus Documentation, Release 1.0.0
getSchedulingInterval
public double getSchedulingInterval()Gets the scheduling interval that defines the periodicity of VM migrations.
Returns the scheduling interval
isHostOverloaded
public boolean isHostOverloaded(Host host)Checks if a host is over utilized based on estimation of CPU over utilization threshold computed using LocalRegression.
Parameters
• host – the host
Returns true, if is host over utilized; false otherwise
setSchedulingInterval
public final VmAllocationPolicyMigrationLocalRegression setSchedulingInterval(double scheduling-Interval)
Sets the scheduling interval that defines the periodicity of VM migrations.
Parameters
• schedulingInterval – the new scheduling interval
1.2.8 VmAllocationPolicyMigrationLocalRegressionRobust
public class VmAllocationPolicyMigrationLocalRegressionRobust extends VmAllocationPolicyMigrationLocalRegressionA VM allocation policy that uses Local Regression Robust (LRR) to predict host utilization (load) and define ifa host is overloaded or not. It’s a Best Fit policy which selects the Host with most efficient power usage toplace a given VM.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Constructors
VmAllocationPolicyMigrationLocalRegressionRobust
public VmAllocationPolicyMigrationLocalRegressionRobust(PowerVmSelectionPolicy vmS-electionPolicy)
Creates a VmAllocationPolicyMigrationLocalRegressionRobust with a safety parameter equals to 0 andno fallback policy .
24 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationLocalRegressionRobust
public VmAllocationPolicyMigrationLocalRegressionRobust(PowerVmSelectionPolicy vmS-electionPolicy, double safety-Parameter, VmAllocationPol-icyMigration fallbackVmAllo-cationPolicy)
Creates a VmAllocationPolicyMigrationLocalRegressionRobust.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• safetyParameter – the safety parameter
• fallbackVmAllocationPolicy – the fallback VM allocation policy to be used whenthe over utilization host detection doesn’t have data to be computed
Methods
getParameterEstimates
protected double[] getParameterEstimates(double[] reversedUsageHistory)Gets the utilization estimates.
Parameters
• reversedUsageHistory – the utilization history in reverse order
Returns the utilization estimates
1.2.9 VmAllocationPolicyMigrationMedianAbsoluteDeviation
public class VmAllocationPolicyMigrationMedianAbsoluteDeviation extends VmAllocationPolicyMigrationDynamicUpperThresholdFirstFitA VM allocation policy that uses Median Absolute Deviation (MAD) to compute a dynamic threshold in orderto detect host over utilization. It’s a Best Fit policy which selects the Host with most efficient power usageto place a given VM.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 25
CloudSim Plus Documentation, Release 1.0.0
Constructors
VmAllocationPolicyMigrationMedianAbsoluteDeviation
public VmAllocationPolicyMigrationMedianAbsoluteDeviation(PowerVmSelectionPolicyvmSelectionPolicy)
Creates a VmAllocationPolicyMigrationMedianAbsoluteDeviation with a safety parameter equals to 0and no fallback policy .
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
VmAllocationPolicyMigrationMedianAbsoluteDeviation
public VmAllocationPolicyMigrationMedianAbsoluteDeviation(PowerVmSelectionPolicyvmSelectionPolicy, doublesafetyParameter, VmAl-locationPolicyMigrationfallbackPolicy)
Creates a VmAllocationPolicyMigrationMedianAbsoluteDeviation.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• safetyParameter – the safety parameter
• fallbackPolicy – the fallback VM allocation policy to be used when the over utiliza-tion host detection doesn’t have data to be computed
Methods
computeHostUtilizationMeasure
public double computeHostUtilizationMeasure(Host host)Computes the host utilization MAD used for generating the host over utilization threshold.
Parameters
• host – the host
Throws
• @inheritDoc –
Returns the host utilization MAD
1.2.10 VmAllocationPolicyMigrationNull
final class VmAllocationPolicyMigrationNull implements VmAllocationPolicyMigrationA class that implements the Null Object Design Pattern for VmAllocationPolicyMigration class.
Author Manoel Campos da Silva Filho
See also: VmAllocationPolicyMigration.NULL
26 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
allocateHostForVm
public boolean allocateHostForVm(Vm vm)
allocateHostForVm
public boolean allocateHostForVm(Vm vm, Host host)
deallocateHostForVm
public void deallocateHostForVm(Vm vm)
findHostForVm
public Optional<Host> findHostForVm(Vm vm)
getDatacenter
public Datacenter getDatacenter()
getHostList
public <T extends Host> List<T> getHostList()
getMetricHistory
public Map<Host, List<Double>> getMetricHistory()
getOptimizedAllocationMap
public Map<Vm, Host> getOptimizedAllocationMap(List<? extends Vm> vmList)
getOverUtilizationThreshold
public double getOverUtilizationThreshold(Host host)
getTimeHistory
public Map<Host, List<Double>> getTimeHistory()
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 27
CloudSim Plus Documentation, Release 1.0.0
getUnderUtilizationThreshold
public double getUnderUtilizationThreshold()
getUtilizationHistory
public Map<Host, List<Double>> getUtilizationHistory()
isHostOverloaded
public boolean isHostOverloaded(Host host)
isHostUnderloaded
public boolean isHostUnderloaded(Host host)
scaleVmVertically
public boolean scaleVmVertically(VerticalVmScaling scaling)
setDatacenter
public void setDatacenter(Datacenter datacenter)
setFindHostForVmFunction
public void setFindHostForVmFunction(BiFunction<VmAllocationPolicy, Vm, Optional<Host>> find-HostForVmFunction)
setUnderUtilizationThreshold
public void setUnderUtilizationThreshold(double underUtilizationThreshold)
1.2.11 VmAllocationPolicyMigrationStaticThreshold
public class VmAllocationPolicyMigrationStaticThreshold extends VmAllocationPolicyMigrationAbstractA VM allocation policy that uses a static CPU utilization threshold to detect host over utilization. It’s a FirstFit policy which selects the first found Host with most efficient power usage to place a given VM.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
28 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Author Anton Beloglazov
Constructors
VmAllocationPolicyMigrationStaticThreshold
public VmAllocationPolicyMigrationStaticThreshold(PowerVmSelectionPolicy vmSelection-Policy, double overUtilizationThresh-old)
Creates a VmAllocationPolicyMigrationStaticThreshold.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• overUtilizationThreshold – the over utilization threshold
VmAllocationPolicyMigrationStaticThreshold
public VmAllocationPolicyMigrationStaticThreshold(PowerVmSelectionPolicy vmSelection-Policy, double overUtilizationThresh-old, BiFunction<VmAllocationPolicy,Vm, Optional<Host>> findHostForVm-Function)
Creates a new VmAllocationPolicy, changing the Function to select a Host for a Vm.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• overUtilizationThreshold – the over utilization threshold
• findHostForVmFunction – a Function to select a Host for a given Vm. Passingnull makes the Function to be set as the default findHostForVm(Vm).
See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
Methods
getOverUtilizationThreshold
public double getOverUtilizationThreshold(Host host)Gets the static host CPU utilization threshold to detect over utilization. It is a percentage value from 0 to 1 thatcan be changed when creating an instance of the class.
This method always return the same over utilization threshold for any given host
Parameters
• host – @inheritDoc
Returns @inheritDoc (that is the same for any given host)
1.2. org.cloudbus.cloudsim.allocationpolicies.migration 29
CloudSim Plus Documentation, Release 1.0.0
setOverUtilizationThreshold
public final void setOverUtilizationThreshold(double overUtilizationThreshold)Sets the static host CPU utilization threshold to detect over utilization.
Parameters
• overUtilizationThreshold – the overUtilizationThreshold to set
1.2.12 VmAllocationPolicyMigrationWorstFitStaticThreshold
public class VmAllocationPolicyMigrationWorstFitStaticThreshold extends VmAllocationPolicyMigrationStaticThresholdA VmAllocationPolicy that uses a Static CPU utilization Threshold (THR) to detect host under andgetOverUtilizationThreshold(Host) over utilization.
It’s a Worst Fit policy which selects the Host having the least used amount of CPU MIPS to place a given VM,disregarding energy consumption.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmAllocationPolicyMigrationWorstFitStaticThreshold
public VmAllocationPolicyMigrationWorstFitStaticThreshold(PowerVmSelectionPolicyvmSelectionPolicy, doubleoverUtilizationThreshold)
VmAllocationPolicyMigrationWorstFitStaticThreshold
public VmAllocationPolicyMigrationWorstFitStaticThreshold(PowerVmSelectionPolicyvmSelectionPolicy,double overUtiliza-tionThreshold, BiFunc-tion<VmAllocationPolicy,Vm, Optional<Host>>findHostForVmFunction)
Creates a new VmAllocationPolicy, changing the Function to select a Host for a Vm.
Parameters
• vmSelectionPolicy – the policy that defines how VMs are selected for migration
• overUtilizationThreshold – the over utilization threshold
• findHostForVmFunction – a Function to select a Host for a given Vm. Passingnull makes the Function to be set as the default findHostForVm(Vm).
See also: VmAllocationPolicy.setFindHostForVmFunction(java.util.function.BiFunction)
30 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
findHostForVmInternal
protected Optional<Host> findHostForVmInternal(Vm vm, Stream<Host> hostStream)Gets the Host having the most available MIPS capacity (min used MIPS).
This method is ignoring the additional filtering performed by the super class. This way, Host selection isperformed ignoring energy consumption. However, all the basic filters defined in the super class are ensured,since this method is called just after they are applied.
Parameters
• vm – @inheritDoc
• hostStream – @inheritDoc
Returns @inheritDoc
1.3 org.cloudbus.cloudsim.brokers
Provides org.cloudbus.cloudsim.brokers.DatacenterBroker classes that act on behalf of a cloudcustomer, attending his/her requests for creation and destruction of Cloudlets and VMs, assigning such Cloudletsto specific VMs. These brokers can implement decision making algorithms to prioritize submission of Cloudlets tothe cloud, to define how a VM is selected to run a given Cloudlets, etc.
The most basic implementation is the org.cloudbus.cloudsim.brokers.DatacenterBrokerSimplethat uses a Round-robin algorithm to select a VM from a list to place a submitted Cloudlet, which iscalled a Cloudlet to VM mapping. Other class such as the org.cloudbus.cloudsim.brokers.DatacenterBrokerHeuristic allows setting a org.cloudsimplus.heuristics.Heuristic to findan sub-optimal mapping.
author Manoel Campos da Silva Filho
1.3.1 DatacenterBroker
public interface DatacenterBroker extends SimEntityRepresents a broker acting on behalf of a cloud customer. It hides VM management such as vm creation,submission of cloudlets to VMs and destruction of VMs.
A broker implements the policies for selecting a VM to run a Cloudlet and a Datacenter to run the submittedVMs.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
DEFAULT_VM_DESTRUCTION_DELAY
double DEFAULT_VM_DESTRUCTION_DELAYA default delay value to indicate that no VM should be immediately destroyed after it becomes idle.
This is used as the default value returned by the getVmDestructionDelayFunction() if a Functionis not set.
See also: .setVmDestructionDelayFunction(Function)
1.3. org.cloudbus.cloudsim.brokers 31
CloudSim Plus Documentation, Release 1.0.0
NULL
DatacenterBroker NULLAn attribute that implements the Null Object Design Pattern for DatacenterBroker objects.
Methods
addOnVmsCreatedListener
DatacenterBroker addOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> listener)Adds an EventListener that will be notified every time VMs in the waiting list are all created.
Events are fired according to the following conditions:
• if all VMs are submitted before the simulation start and all those VMs are created after starting, then theevent will be fired just once, during all simulation execution, for every registered Listener;
• if all VMs submitted at a given time cannot be created due to lack of suitable Hosts, the event will not befired for that submission;
• if new VMs are submitted during simulation execution, the event may be fired multiple times. For instance,consider new VMs are submitted during simulation execution at times 10 and 20. If for every submissiontime, all VMs could be created, then every Listener will be notified 2 times (one for VMs submitted attime 10 and other for those at time 20).
Parameters
• listener – the Listener that will be notified
See also: .getVmWaitingList(), .addOneTimeOnVmsCreatedListener(EventListener)
addOneTimeOnVmsCreatedListener
DatacenterBroker addOneTimeOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo>listener)
Adds an EventListener that will be notified just once when VMs in the waiting list are all created. Afterthe first notification, the Listener is removed from the registered Listeners and no further notifications will besent to that specific Listener.
Even if VMs were submitted at different simulation times and all of them are created successfully (which meansnotifications are expected at different times), this Listener will be notified just when the first list of VMs iscreated and no subsequent notifications will be sent when other List of VMs is created.
For instance, consider new VMs are submitted during simulation execution at times 10 and 20. If for everysubmission time, all VMs could be created, then this specific Listener is expected to be notified 2 times (onefor VMs submitted at time 10 and other for those at time 20). However, after VMs submitted at time 10 are allcreated, the Listener is notified and unregistered, so that it will get no next notifications.
Parameters
• listener – the Listener that will be notified
See also: .getVmWaitingList(), .addOnVmsCreatedListener(EventListener)
32 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
bindCloudletToVm
boolean bindCloudletToVm(Cloudlet cloudlet, Vm vm)Specifies that an already submitted cloudlet, which is in the waiting list, must run in a specific virtualmachine.
Parameters
• cloudlet – the cloudlet to be bind to a given Vm
• vm – the vm to bind the Cloudlet to
Returns true if the Cloudlet was found in the waiting list and was bind to the given Vm, false itthe Cloudlet was not found in such a list (that may mean it wasn’t submitted yet or was alreadycreated)
getCloudletCreatedList
Set<Cloudlet> getCloudletCreatedList()Gets a read-only list of cloudlets created inside some Vm.
Returns the list of created Cloudlets
getCloudletFinishedList
<T extends Cloudlet> List<T> getCloudletFinishedList()Gets a copy of the list of cloudlets that have finished executing, to avoid the original list to be changed.
Parameters
• <T> – the class of Cloudlets inside the list
Returns the list of finished cloudlets
getCloudletWaitingList
<T extends Cloudlet> List<T> getCloudletWaitingList()Gets the list of cloudlets submitted to the broker that are waiting to be created inside some Vm yet.
Parameters
• <T> – the class of Cloudlets inside the list
Returns the cloudlet waiting list
getVmCreatedList
<T extends Vm> List<T> getVmCreatedList()Gets the list of all VMs created so far, independently if they are running yet or were already destroyed. This canbe used at the end of the simulation to know which VMs have executed.
Parameters
• <T> – the class of VMs inside the list
Returns the list of created VMs
1.3. org.cloudbus.cloudsim.brokers 33
CloudSim Plus Documentation, Release 1.0.0
See also: .getVmExecList()
getVmDestructionDelayFunction
Function<Vm, Double> getVmDestructionDelayFunction()Gets a Function which defines when an idle VM should be destroyed. The Function receives a Vm and returnsthe delay to wait (in seconds), after the VM becomes idle, to destroy it.
See also: .DEFAULT_VM_DESTRUCTION_DELAY, Vm.getIdleInterval()
getVmExecList
<T extends Vm> List<T> getVmExecList()Gets the list of VMs in execution, if they are running Cloudlets or not. These VMs can receive new submittedCloudlets.
Parameters
• <T> – the class of VMs inside the list
Returns the list of running VMs
See also: .getVmCreatedList()
getVmWaitingList
<T extends Vm> List<T> getVmWaitingList()Gets a List of VMs submitted to the broker that are waiting to be created inside some Datacenter yet.
Parameters
• <T> – the class of VMs inside the list
Returns the list of waiting VMs
getWaitingVm
Vm getWaitingVm(int index)
isThereWaitingCloudlets
boolean isThereWaitingCloudlets()Indicates if there are more cloudlets waiting to be executed yet.
Returns true if there are waiting cloudlets, false otherwise
setCloudletComparator
void setCloudletComparator(Comparator<Cloudlet> comparator)Sets a Comparator that will be used to sort every list of submitted Cloudlets before mapping each Cloudletto a Vm. After sorting, the Cloudlet mapping will follow the order of the sorted Cloudlet list.
Parameters
34 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• comparator – the Cloudlet Comparator to set
setDatacenterSupplier
void setDatacenterSupplier(Supplier<Datacenter> datacenterSupplier)Sets the Supplier that selects and returns a Datacenter to place submitted VMs.
The supplier defines the policy to select a Datacenter to host a VM that is waiting to be created.
Parameters
• datacenterSupplier – the datacenterSupplier to set
setFallbackDatacenterSupplier
void setFallbackDatacenterSupplier(Supplier<Datacenter> fallbackDatacenterSupplier)Sets the Supplier that selects and returns a fallback Datacenter to place submitted VMs when the Datacenterselected by the Datacenter Supplier failed to create all requested VMs.
The supplier defines the policy to select a Datacenter to host a VM when all VM creation requests were receivedbut not all VMs could be created. In this case, a different Datacenter has to be selected to request the creationof the remaining VMs in the waiting list.
Parameters
• fallbackDatacenterSupplier – the fallbackDatacenterSupplier to set
setVmComparator
void setVmComparator(Comparator<Vm> comparator)Sets a Comparator that will be used to sort every list of submitted VMs before requesting the creation of suchVMs in some Datacenter. After sorting, the VM creation requests will be sent in the order of the sorted VM list.
Parameters
• comparator – the VM Comparator to set
setVmDestructionDelayFunction
DatacenterBroker setVmDestructionDelayFunction(Function<Vm, Double> function)Sets a Function to define when an idle VM should be destroyed. The Function receives a Vm and returns thedelay to wait (in seconds), after the VM becomes idle, to destroy it.
Parameters
• function – the Function to set (if null is given, it sets the default Function)
See also: .DEFAULT_VM_DESTRUCTION_DELAY, Vm.getIdleInterval()
setVmMapper
void setVmMapper(Function<Cloudlet, Vm> vmMapper)Sets a Function that maps a given Cloudlet to a Vm. It defines the policy used to select a Vm to host aCloudlet that is waiting to be created.
1.3. org.cloudbus.cloudsim.brokers 35
CloudSim Plus Documentation, Release 1.0.0
Parameters
• vmMapper – the Vm mapper Function to set. Such a Function must receive a Cloudlet andreturn the Vm where it will be placed into. If the Function is unable to find a VM for aCloudlet, it should return Vm.NULL.
submitCloudlet
void submitCloudlet(Cloudlet cloudlet)Submits a single Cloudlet to the broker.
Parameters
• cloudlet – the Cloudlet to be submitted
submitCloudletList
void submitCloudletList(List<? extends Cloudlet> list)Sends a list of cloudlets to the broker so that it requests their creation inside some VM, following the submissiondelay specified in each cloudlet (if any). All cloudlets will be added to the getCloudletWaitingList().
Parameters
• list – the list of Cloudlets to request the creation
See also: .submitCloudletList(java.util.List,double)
submitCloudletList
void submitCloudletList(List<? extends Cloudlet> list, double submissionDelay)Sends a list of cloudlets to the broker so that it requests their creation inside some VM just after a given delay.Just the Cloudlets that don’t have a delay already assigned will have its submission delay changed. All cloudletswill be added to the getCloudletWaitingList(), setting their submission delay to the specified value.
Parameters
• list – the list of Cloudlets to request the creation
• submissionDelay – the delay the broker has to include when requesting the creation ofCloudlets
See also: .submitCloudletList(java.util.List), Cloudlet.getSubmissionDelay()
submitCloudletList
void submitCloudletList(List<? extends Cloudlet> list, Vm vm)Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM, fol-lowing the submission delay specified in each cloudlet (if any). All cloudlets will be added to thegetCloudletWaitingList().
Parameters
• list – the list of Cloudlets to request the creation
• vm – the VM to which all Cloudlets will be bound to
See also: .submitCloudletList(java.util.List,double)
36 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
submitCloudletList
void submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM just after a givendelay. Just the Cloudlets that don’t have a delay already assigned will have its submission delay changed. Allcloudlets will be added to the getCloudletWaitingList(), setting their submission delay to the specifiedvalue.
Parameters
• list – the list of Cloudlets to request the creation
• vm – the VM to which all Cloudlets will be bound to
• submissionDelay – the delay the broker has to include when requesting the creation ofCloudlets
See also: .submitCloudletList(java.util.List), Cloudlet.getSubmissionDelay()
submitVm
void submitVm(Vm vm)Submits a single Vm to the broker.
Parameters
• vm – the Vm to be submitted
submitVmList
void submitVmList(List<? extends Vm> list)Sends to the broker a list with VMs that their creation inside a Host will be requested tosome Datacenter. The Datacenter that will be chosen to place a VM is determined by thesetDatacenterSupplier(Supplier).
Parameters
• list – the list of VMs to request the creation
submitVmList
void submitVmList(List<? extends Vm> list, double submissionDelay)Sends a list of VMs for the broker so that their creation inside some Host will be requested just after a givendelay. Just the VMs that don’t have a delay already assigned will have its submission delay changed. All VMswill be added to the getVmWaitingList(), setting their submission delay to the specified value.
Parameters
• list – the list of VMs to request the creation
• submissionDelay – the delay the broker has to include when requesting the creation ofVMs
See also: .submitVmList(java.util.List), Vm.getSubmissionDelay()
1.3. org.cloudbus.cloudsim.brokers 37
CloudSim Plus Documentation, Release 1.0.0
1.3.2 DatacenterBrokerAbstract
public abstract class DatacenterBrokerAbstract extends CloudSimEntity implements DatacenterBrokerAn abstract class to be used as base for implementing a DatacenterBroker.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
DatacenterBrokerAbstract
public DatacenterBrokerAbstract(CloudSim simulation)Creates a DatacenterBroker object.
Parameters
• simulation – the CloudSim instance that represents the simulation the Entity is relatedto
Methods
addOnVmsCreatedListener
public DatacenterBroker addOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> lis-tener)
addOneTimeOnCreationOfWaitingVmsFinishListener
public DatacenterBroker addOneTimeOnCreationOfWaitingVmsFinishListener(EventListener<DatacenterBrokerEventInfo>listener,Boolean one-TimeListener)
addOneTimeOnVmsCreatedListener
public DatacenterBroker addOneTimeOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo>listener)
bindCloudletToVm
public boolean bindCloudletToVm(Cloudlet cloudlet, Vm vm)
getCloudletCreatedList
public Set<Cloudlet> getCloudletCreatedList()
getCloudletFinishedList
public <T extends Cloudlet> List<T> getCloudletFinishedList()
38 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCloudletWaitingList
public <T extends Cloudlet> List<T> getCloudletWaitingList()
getDatacenterList
protected List<Datacenter> getDatacenterList()Gets the list of available datacenters.
Returns the dc list
getDatacenterRequestedList
protected Set<Datacenter> getDatacenterRequestedList()Gets the list of datacenters where was requested to place VMs.
getLastSelectedVm
protected Vm getLastSelectedVm()
Returns latest VM selected to run a cloudlet.
getVmCreatedList
public <T extends Vm> List<T> getVmCreatedList()
getVmCreationAcks
protected int getVmCreationAcks()Gets the number of acknowledges (ACKs) received from Datacenters in response to requests to create VMs.The number of acks doesn’t mean the number of created VMs, once Datacenters can respond informing that aVm could not be created.
Returns the number vm creation acks
getVmCreationRequests
protected int getVmCreationRequests()Gets the number of VM creation requests.
Returns the number of VM creation requests
getVmDatacenter
protected Datacenter getVmDatacenter(Vm vm)Gets the Datacenter where a VM is placed.
Parameters
• vm – the VM to get its Datacenter
1.3. org.cloudbus.cloudsim.brokers 39
CloudSim Plus Documentation, Release 1.0.0
getVmDestructionDelayFunction
public Function<Vm, Double> getVmDestructionDelayFunction()
getVmExecList
public <T extends Vm> List<T> getVmExecList()
getVmFromCreatedList
protected Vm getVmFromCreatedList(int vmIndex)Gets a Vm at a given index from the list of created VMs.
Parameters
• vmIndex – the index where a VM has to be got from the created VM list
Returns the VM at the given index or Vm.NULL if the index is invalid
getVmWaitingList
public <T extends Vm> List<T> getVmWaitingList()
getWaitingVm
public Vm getWaitingVm(int index)
isThereWaitingCloudlets
public boolean isThereWaitingCloudlets()
processCloudletReturn
protected void processCloudletReturn(SimEvent ev)Processes the end of execution of a given cloudlet inside a Vm.
Parameters
• ev – the cloudlet that has just finished to execute and was returned to the broker
processDatacenterListRequest
protected void processDatacenterListRequest(SimEvent ev)Process a request to get the list of all Datacenters registered in the Cloud Information Service (CIS) of thesimulation.
Parameters
• ev – a CloudSimEvent object
40 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processEvent
public void processEvent(SimEvent ev)
processFailedVmCreationInDatacenter
protected void processFailedVmCreationInDatacenter(Vm vm, Datacenter datacenter)Process a response from a Datacenter informing that it was NOT able to create the VM requested by the broker.
Parameters
• vm – id of the Vm that failed to be created inside the Datacenter
• datacenter – id of the Datacenter where the request to create
processSuccessVmCreationInDatacenter
protected void processSuccessVmCreationInDatacenter(Vm vm, Datacenter datacenter)Process a response from a Datacenter informing that it was able to create the VM requested by the broker.
Parameters
• vm – id of the Vm that succeeded to be created inside the Datacenter
• datacenter – id of the Datacenter where the request to create the Vm succeeded
processVmCreateResponseFromDatacenter
protected boolean processVmCreateResponseFromDatacenter(SimEvent ev)Process the ack received from a Datacenter to a broker’s request for creation of a Vm in that Datacenter.
Parameters
• ev – a CloudSimEvent object
Returns true if the VM was created successfully, false otherwise
requestCreationOfWaitingVmsToFallbackDatacenter
protected void requestCreationOfWaitingVmsToFallbackDatacenter()After the response (ack) of all VM creation request were received but not all VMs could be created (what meanssome acks informed about Vm creation failures), try to find another Datacenter to request the creation of theVMs in the waiting list.
requestDatacenterToCreateWaitingVms
protected void requestDatacenterToCreateWaitingVms()Request the creation of VMs in the VM waiting list inside some Datacenter.
See also: .submitVmList(java.util.List)
1.3. org.cloudbus.cloudsim.brokers 41
CloudSim Plus Documentation, Release 1.0.0
requestDatacenterToCreateWaitingVms
protected void requestDatacenterToCreateWaitingVms(Datacenter datacenter)Request a specific Datacenter to create the VM in the VM waiting list.
Parameters
• datacenter – id of the Datacenter to request the VMs creation
See also: .submitVmList(java.util.List)
requestDatacentersToCreateWaitingCloudlets
protected void requestDatacentersToCreateWaitingCloudlets()Request Datacenters to create the Cloudlets in the Cloudlets waiting list. If there aren’t availableVMs to host all cloudlets, the creation of some ones will be postponed.
This method is called after all submitted VMs are created in some Datacenter.
See also: .submitCloudletList(java.util.List)
requestIdleVmsDestruction
protected void requestIdleVmsDestruction(Function<Vm, Double> vmDestructionDelayFunction)Request all idle VMs to be destroyed at the time defined by a delay Function.
Parameters
• vmDestructionDelayFunction – a Function which indicates to time the VM willwait before being destructed
See also: .getVmDestructionDelayFunction()
requestShutDown
protected void requestShutDown()Send an internal event to the broker itself, communicating there is not more events to process (no more VMs tocreate or Cloudlets to execute).
setCloudletComparator
public void setCloudletComparator(Comparator<Cloudlet> comparator)
setDatacenterList
protected final void setDatacenterList(Set<Datacenter> datacenterList)Sets the list of available datacenters.
Parameters
• datacenterList – the new dc list
42 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setDatacenterSupplier
public final void setDatacenterSupplier(Supplier<Datacenter> datacenterSupplier)
setFallbackDatacenterSupplier
public final void setFallbackDatacenterSupplier(Supplier<Datacenter> fallbackDatacenterSup-plier)
setVmComparator
public void setVmComparator(Comparator<Vm> comparator)
setVmDestructionDelayFunction
public DatacenterBroker setVmDestructionDelayFunction(Function<Vm, Double> function)
setVmMapper
public final void setVmMapper(Function<Cloudlet, Vm> vmMapper)
shutdownEntity
public void shutdownEntity()
startEntity
public void startEntity()
submitCloudlet
public void submitCloudlet(Cloudlet cloudlet)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, double submissionDelay)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, Vm vm)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)
1.3. org.cloudbus.cloudsim.brokers 43
CloudSim Plus Documentation, Release 1.0.0
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list)@inheritDoc
If the entity already started (the simulation is running), the creation of previously submitted Cloudlets alreadywas requested by the start() method that is called just once. By this way, this method will immediatelyrequest the creation of these just submitted Cloudlets if all submitted VMs were already created, in order toallow Cloudlet creation after the simulation has started. This avoid the developer to dynamically create brokersjust to create VMs or Cloudlets during simulation execution.
Parameters
• list – @inheritDoc
See also: .submitCloudletList(List,double)
submitVm
public void submitVm(Vm vm)
submitVmList
public void submitVmList(List<? extends Vm> list, double submissionDelay)
submitVmList
public void submitVmList(List<? extends Vm> list)@inheritDoc
If the entity already started (the simulation is running), the creation of previously submitted VMs already wasrequested by the start() method that is called just once. By this way, this method will immediately requestthe creation of these just submitted VMs in order to allow VM creation after the simulation has started. Thisavoid the developer to dynamically create brokers just to create VMs or Cloudlets during simulation execution.
Parameters
• list – @inheritDoc
toString
public String toString()
1.3.3 DatacenterBrokerHeuristic
public class DatacenterBrokerHeuristic extends DatacenterBrokerSimpleA simple implementation of DatacenterBroker that uses some heuristic to get a suboptimal mappingamong submitted cloudlets and Vm’s. Such heuristic can be, for instance, the org.cloudsimplus.heuristics.CloudletToVmMappingSimulatedAnnealing that implements a Simulated Anneal-ing algorithm. The Broker then places the submitted Vm’s at the first Datacenter found. If there isn’t capacityin that one, it will try the other ones.
Author Manoel Campos da Silva Filho
44 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
DatacenterBrokerHeuristic
public DatacenterBrokerHeuristic(CloudSim simulation)Creates a new DatacenterBroker object.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
See also: .setHeuristic(CloudletToVmMappingHeuristic)
Methods
getHeuristic
public Heuristic<CloudletToVmMappingSolution> getHeuristic()
Returns the heuristic used to find a sub-optimal mapping between Cloudlets and Vm’s
requestDatacentersToCreateWaitingCloudlets
protected void requestDatacentersToCreateWaitingCloudlets()
selectVmForWaitingCloudlet
protected Vm selectVmForWaitingCloudlet(Cloudlet cloudlet)
setHeuristic
public DatacenterBrokerHeuristic setHeuristic(CloudletToVmMappingHeuristic heuristic)Sets a heuristic to be used to find a sub-optimal mapping between Cloudlets and Vm’s. The list of Cloudlets andVm’s to be used by the heuristic will be set automatically by the DatacenterBroker. Accordingly, the developerdon’t have to set these lists manually, once they will be overridden.
The time taken to find a suboptimal mapping of Cloudlets to Vm’s depends on the heuristic parameters that haveto be set carefully.
Parameters
• heuristic – the heuristic to be set
Returns the DatacenterBrokerHeuristic instance
1.3.4 DatacenterBrokerNull
final class DatacenterBrokerNull implements DatacenterBrokerA class that implements the Null Object Design Pattern for DatacenterBroker class.
Author Manoel Campos da Silva Filho
See also: DatacenterBroker.NULL
1.3. org.cloudbus.cloudsim.brokers 45
CloudSim Plus Documentation, Release 1.0.0
Methods
addOnVmsCreatedListener
public DatacenterBroker addOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> lis-tener)
addOneTimeOnVmsCreatedListener
public DatacenterBroker addOneTimeOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo>listener)
bindCloudletToVm
public boolean bindCloudletToVm(Cloudlet cloudlet, Vm vm)
compareTo
public int compareTo(SimEntity o)
getCloudletCreatedList
public Set<Cloudlet> getCloudletCreatedList()
getCloudletFinishedList
public <T extends Cloudlet> List<T> getCloudletFinishedList()
getCloudletWaitingList
public <T extends Cloudlet> List<T> getCloudletWaitingList()
getId
public int getId()
getName
public String getName()
getSimulation
public Simulation getSimulation()
46 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getVmCreatedList
public <T extends Vm> List<T> getVmCreatedList()
getVmDestructionDelayFunction
public Function<Vm, Double> getVmDestructionDelayFunction()
getVmExecList
public <T extends Vm> List<T> getVmExecList()
getVmWaitingList
public <T extends Vm> List<T> getVmWaitingList()
getWaitingVm
public Vm getWaitingVm(int index)
isStarted
public boolean isStarted()
isThereWaitingCloudlets
public boolean isThereWaitingCloudlets()
println
public void println(String msg)
processEvent
public void processEvent(SimEvent ev)
run
public void run()
schedule
public void schedule(SimEntity dest, double delay, int tag)
1.3. org.cloudbus.cloudsim.brokers 47
CloudSim Plus Documentation, Release 1.0.0
setCloudletComparator
public void setCloudletComparator(Comparator<Cloudlet> comparator)
setDatacenterSupplier
public void setDatacenterSupplier(Supplier<Datacenter> datacenterSupplier)
setFallbackDatacenterSupplier
public void setFallbackDatacenterSupplier(Supplier<Datacenter> fallbackDatacenterSupplier)
setLog
public void setLog(boolean log)
setName
public SimEntity setName(String newName)
setSimulation
public SimEntity setSimulation(Simulation simulation)
setState
public SimEntity setState(State state)
setVmComparator
public void setVmComparator(Comparator<Vm> comparator)
setVmDestructionDelayFunction
public DatacenterBroker setVmDestructionDelayFunction(Function<Vm, Double> function)
setVmMapper
public void setVmMapper(Function<Cloudlet, Vm> vmMapper)
shutdownEntity
public void shutdownEntity()
48 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
start
public void start()
submitCloudlet
public void submitCloudlet(Cloudlet cloudlet)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, double submissionDelay)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, Vm vm)
submitCloudletList
public void submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)
submitVm
public void submitVm(Vm vm)
submitVmList
public void submitVmList(List<? extends Vm> list)
submitVmList
public void submitVmList(List<? extends Vm> list, double submissionDelay)
1.3.5 DatacenterBrokerSimple
public class DatacenterBrokerSimple extends DatacenterBrokerAbstractA simple implementation of DatacenterBroker that try to host customer’s VMs at the first Datacenterfound. If there isn’t capacity in that one, it will try the other ones.
The selection of VMs for each cloudlet is based on a Round-Robin policy, cyclically selecting the next VM fromthe broker VM list for each requesting cloudlet.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
1.3. org.cloudbus.cloudsim.brokers 49
CloudSim Plus Documentation, Release 1.0.0
Constructors
DatacenterBrokerSimple
public DatacenterBrokerSimple(CloudSim simulation)Creates a new DatacenterBroker object.
Parameters
• simulation – name to be associated with this entity
Methods
selectDatacenterForWaitingVms
protected Datacenter selectDatacenterForWaitingVms()Defines the policy to select a Datacenter to Host a VM. It always selects the first Datacenter from the Datacenterlist.
Returns the Datacenter selected to request the creating of waiting VMs or Datacenter.NULL ifno suitable Datacenter was found
selectFallbackDatacenterForWaitingVms
protected Datacenter selectFallbackDatacenterForWaitingVms()Defines the policy to select a fallback Datacenter to Host a VM when a previous selected Datacenter failed tocreate the requested VMs.
It gets the first Datacenter that has not been tried yet.
Returns the Datacenter selected to try creating the remaining VMs or Datacenter.NULL if nosuitable Datacenter was found
selectVmForWaitingCloudlet
protected Vm selectVmForWaitingCloudlet(Cloudlet cloudlet)Defines the policy used to select a Vm to host a Cloudlet that is waiting to be created. It applies a Round-Robinpolicy to cyclically select the next Vm from the list of waiting VMs.
Parameters
• cloudlet – the cloudlet that needs a VM to be placed into
Returns the selected Vm for the cloudlet or Vm.NULL if no suitable VM was found
1.4 org.cloudbus.cloudsim.cloudlets
Provides org.cloudbus.cloudsim.cloudlets.Cloudlet implementations, that represent an applica-tion that will run inside a org.cloudbus.cloudsim.vms.Vm. Each Cloudlet is abstractly defined interms of its characteristics, such as the number of Million Instructions (MI) to execute, the number of requiredorg.cloudbus.cloudsim.resources.Pe and a org.cloudbus.cloudsim.utilizationmodels.UtilizationModel for CPU, RAM and bandwidth.
50 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Each utilization model defines how a given resource will be used by the Cloudlet along the time. Some basic utiliza-tion models implementations are provided, such as the org.cloudbus.cloudsim.utilizationmodels.UtilizationModelFull, which indicates that a given available resource will be used 100% all the time.
Specific Cloudlet implementations can be, for instance, network-aware, enabling the simulation of network communi-cation. For more information see org.cloudbus.cloudsim.datacenters package documentation.
author Manoel Campos da Silva Filho
1.4.1 Cloudlet
public interface Cloudlet extends UniquelyIdentificable, Comparable<Cloudlet>, CustomerEntityAn interface to be implemented by each class that provides basic cloudlet features. The interface implements theNull Object Design Pattern in order to start avoiding NullPointerExceptionwhen using the Cloudlet.NULL object instead of attributing null to Cloudlet variables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NOT_ASSIGNED
int NOT_ASSIGNEDValue to indicate that the cloudlet was not assigned to a Datacenter yet.
NULL
Cloudlet NULLAn attribute that implements the Null Object Design Pattern for Cloudlet objects.
Methods
addOnFinishListener
Cloudlet addOnFinishListener(EventListener<CloudletVmEventInfo> listener)Adds a Listener object that will be notified when a cloudlet finishes its execution at a given Vm.
Parameters
• listener – the listener to add
addOnUpdateProcessingListener
Cloudlet addOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)Adds a Listener object that will be notified every time the processing of the Cloudlet is updated in its Vm.
Parameters
• listener – the listener to add
See also: .getFinishedLengthSoFar()
1.4. org.cloudbus.cloudsim.cloudlets 51
CloudSim Plus Documentation, Release 1.0.0
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 (itdid 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 beadded.
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 filesalready exist in the current required list)
assignToDatacenter
void assignToDatacenter(Datacenter datacenter)Sets the parameters of the Datacenter where the Cloudlet is going to be executed. From the second time thismethod 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
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
getAccumulatedBwCost
double getAccumulatedBwCost()The total bandwidth (bw) cost for transferring the cloudlet by the network, according to the getFileSize().
Returns the accumulated bw cost
52 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
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 notexecuted 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
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
getBroker
DatacenterBroker getBroker()Gets the DatacenterBroker that represents the owner of this Cloudlet.
Returns the broker or if a broker has not been set yet
getCostPerBw
double getCostPerBw()Gets the cost of each byte of bandwidth (bw) consumed.
Returns the cost per bw
getCostPerSec
double getCostPerSec()Gets the cost/sec of running the Cloudlet in the latest Datacenter.
Returns the cost associated with running this Cloudlet or 0.0 if was not assigned to any Datacenteryet
1.4. org.cloudbus.cloudsim.cloudlets 53
CloudSim Plus Documentation, Release 1.0.0
getCostPerSec
double getCostPerSec(Datacenter datacenter)Gets the cost running this Cloudlet in a given Datacenter.
Parameters
• datacenter – the Datacenter entity
Returns the cost associated with running this Cloudlet in the given Datacenter or 0 if the Cloudletwas not executed there not found
getExecStartTime
double getExecStartTime()Gets the latest execution start time of this Cloudlet. With new functionalities, such as CANCEL, PAUSED andRESUMED, this attribute only stores the latest execution time. Previous execution time are ignored. This timerepresents the simulation second when the cloudlet started.
Returns the latest execution start time
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)
getFinishTime
double getFinishTime()Gets the time when this Cloudlet has completed executing in the latest Datacenter. This time represents thesimulation second when the cloudlet finished.
Returns the finish or completion time of this Cloudlet; or NOT_ASSIGNED if not finished yet.
getFinishedLengthSoFar
long getFinishedLengthSoFar()Gets the length of this Cloudlet that has been executed so far from the latest Datacenter (in MI). This method isuseful 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 the getLength(). Thismethod is useful when trying to move this Cloudlet into different Datacenters or to cancel it.
Parameters
54 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• datacenter – the Datacenter entity
Returns the length of a partially executed Cloudlet; the full Cloudlet length if it is completed; or 0if the Cloudlet has never been executed in the given Datacenter
getLastDatacenter
Datacenter getLastDatacenter()Gets the latest Datacenter where the Cloudlet was processed.
Returns the Datacenter or if the Cloudlet has not being processed 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
getLength
long getLength()Gets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each definedPE.
According to this length and the power of the VM processor (in Million Instruction Per Second - MIPS) wherethe cloudlet will be run, the cloudlet will take a given time to finish processing. For instance, for a cloudlet of10000 MI running on a processor of 2000 MIPS, the cloudlet will spend 5 seconds using the processor in orderto be completed (that may be uninterrupted or not, depending on the scheduling policy).
Returns the length of this Cloudlet
See also: .getTotalLength(), .getNumberOfPes()
getNetServiceLevel
int getNetServiceLevel()Gets the Type of Service (ToS) of IPv4 for sending Cloudlet over the network. It is the ToS this cloudlet receivesin the network (applicable to selected PacketScheduler 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()
1.4. org.cloudbus.cloudsim.cloudlets 55
CloudSim Plus Documentation, Release 1.0.0
getOutputSize
long getOutputSize()Gets the output file size of this Cloudlet after execution (in bytes). It is the data produced as result of cloudletexecution that needs to be transferred thought the network to simulate sending response data to the user.
Returns the Cloudlet output file size (in bytes)
getPriority
int getPriority()Gets the priority of this Cloudlet for scheduling inside a Vm. Each CloudletScheduler implementationcan define if it will use this attribute to impose execution priorities or not. How the priority is interpreted andwhat is the range of values it accepts depends on the CloudletScheduler that is being used by the Vmrunning the Cloudlet.
Returns priority of this cloudlet
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 networkis considered when placing the cloudlet inside a given VM
Returns the required files
getSimulation
Simulation getSimulation()Gets the CloudSim instance that represents the simulation the Entity is related to.
getStatus
Status getStatus()Gets the execution status of this Cloudlet.
Returns the Cloudlet status
getTotalCost
double getTotalCost()Gets the total cost of executing this Cloudlet. Total Cost = input data transfer +processing cost + output transfer cost .
Returns the total cost of executing the Cloudlet
56 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getTotalLength
long getTotalLength()Gets the total length (across all PEs) of this Cloudlet (in MI). It considers the getLength() of the cloudletwill be executed in each Pe defined by getNumberOfPes().
For example, setting the cloudletLenght as 10000 MI and getNumberOfPes() to 4, each Pe will execute10000 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()
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
getUtilizationOfBw
double getUtilizationOfBw()Gets the utilization of Bandwidth at the current simulation time, that is defined in percentage or absolute values,depending of the UtilizationModel.getUnit() set for the BW 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 or absolute values, depending ofthe UtilizationModel.getUnit() defined for the getUtilizationModelBw() ().
Parameters
• time – the time to get the utilization
1.4. org.cloudbus.cloudsim.cloudlets 57
CloudSim Plus Documentation, Release 1.0.0
Returns the utilization value
See also: .getUtilizationModelBw()()
getUtilizationOfCpu
double getUtilizationOfCpu()Gets the utilization of CPU at the current simulation time, that is defined in percentage or absolute values,depending of the UtilizationModel.getUnit() set for the CPU 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 or absolute values, depending of theUtilizationModel.getUnit() defined for the getUtilizationModelCpu().
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 or absolute values,depending of the UtilizationModel.getUnit() set for the RAM 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 or absolute values, depending of theUtilizationModel.getUnit() defined for the getUtilizationModelRam() ().
Parameters
• time – the time to get the utilization
Returns the utilization value
See also: .getUtilizationModelRam()()
58 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
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
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 timeor the cloudlet hasn’t started to execute.
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 time of this Cloudlet resides in the Datacenter or 0 if the Cloudlet has never beenexecuted there
getWallClockTimeInLastExecutedDatacenter
double getWallClockTimeInLastExecutedDatacenter()Gets the time of this Cloudlet resides in the latest Datacenter (from arrival time until departure time).
Returns the time of this Cloudlet resides in the latest Datacenter
isAssignedToDatacenter
boolean isAssignedToDatacenter()
Returns true if the cloudlet has even been assigned to a Datacenter in order to run, false otherwise.
isBindToVm
boolean isBindToVm()Indicates if the Cloudlet is bounded to a specific Vm, meaning that the DatacenterBroker doesn’t have toselect 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
1.4. org.cloudbus.cloudsim.cloudlets 59
CloudSim Plus Documentation, Release 1.0.0
isFinished
boolean isFinished()Checks whether this Cloudlet has finished executing or not.
Returns true if this Cloudlet has finished execution, false otherwise
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
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
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)
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
requiresFiles
boolean requiresFiles()Checks whether this cloudlet requires any files or not.
Returns true if required, false otherwise
60 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setBroker
Cloudlet setBroker(DatacenterBroker broker)Sets a DatacenterBroker that represents the owner of this Cloudlet.
Parameters
• broker – the DatacenterBroker to set
setExecStartTime
void setExecStartTime(double clockTime)Sets the latest execution start time of this Cloudlet. NOTE: With new functionalities, such asbeing able to cancel / to pause / to resume this Cloudlet, the execution start time only holds the latest one.Meaning, all previous execution start time are ignored.
Parameters
• clockTime – the latest execution start time
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)
Throws
• IllegalArgumentException – when the given size is lower or equal to zero
setFinishedLengthSoFar
boolean setFinishedLengthSoFar(long length)Sets the length of this Cloudlet that has been executed so far (in MI), according to the getLength().
Parameters
• length – executed length of this Cloudlet (in MI)
Returns true if the length is valid and the cloudlet already has assigned to a Datacenter, false other-wise
See also: CloudletExecution
setLength
Cloudlet setLength(long length)Sets the execution length of this Cloudlet (in Million Instructions (MI)) that will be executed in each definedPE.
Parameters
• length – the length (in MI) of this Cloudlet to be executed in a Vm
1.4. org.cloudbus.cloudsim.cloudlets 61
CloudSim Plus Documentation, Release 1.0.0
Throws
• IllegalArgumentException – when the given length is lower or equal to zero
See also: .getLength(), .getTotalLength()
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 forsimplicity. For example, consider a Cloudlet that has a length of 500 MI and requires 2 PEs. This means eachPE will execute 500 MI of this Cloudlet.
Parameters
• numberOfPes – number of PEs
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 cloudletexecution 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)
Throws
• IllegalArgumentException – when the given size is lower or equal to zero
setPriority
void setPriority(int priority)Sets the priority of this Cloudlet for scheduling inside a Vm. Each CloudletScheduler implementa-tion can define if it will use this attribute to impose execution priorities or not. How the priority is interpretedand what is the range of values it accepts depends on the CloudletScheduler that is being used by the Vmrunning the Cloudlet.
Parameters
• priority – priority of this Cloudlet
62 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setStatus
boolean setStatus(Status newStatus)Sets the status of this Cloudlet.
WARNING: This method is just used internally by classes such as CloudletScheduler to update Cloudletstatus. Calling it directly might not get the expected result. You have to use the CloudletScheduler that controlsthe 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 currentstatus; false otherwise
setUtilizationModel
Cloudlet setUtilizationModel(UtilizationModel utilizationModel)Sets the same utilization model for defining the usage of Bandwidth, CPU and RAM. To set different utilizationmodels for each one of these resources, use the respective setters.
Parameters
• utilizationModel – the new utilization model for BW, CPU and RAM
See also: .setUtilizationModelBw(UtilizationModel), .setUtilizationModelCpu(UtilizationModel), .setUtilizationModelRam(UtilizationModel)
setUtilizationModelBw
Cloudlet setUtilizationModelBw(UtilizationModel utilizationModelBw)Sets the utilization model of bw .
Parameters
• utilizationModelBw – the new utilization model of bw
setUtilizationModelCpu
Cloudlet setUtilizationModelCpu(UtilizationModel utilizationModelCpu)Sets the utilization model of cpu.
Parameters
• utilizationModelCpu – the new utilization model of cpu
setUtilizationModelRam
Cloudlet setUtilizationModelRam(UtilizationModel utilizationModelRam)Sets the utilization model of ram.
Parameters
• utilizationModelRam – the new utilization model of ram
1.4. org.cloudbus.cloudsim.cloudlets 63
CloudSim Plus Documentation, Release 1.0.0
setVm
Cloudlet setVm(Vm vm)Sets the id of Vm that is planned to execute the cloudlet.
Parameters
• vm – the id of vm to run the cloudlet
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 totaltime 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 de-parture 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 Data-center for execution
1.4.2 Cloudlet.Status
enum StatusStatus of Cloudlets
Enum Constants
CANCELED
public static final Cloudlet.Status CANCELEDThe Cloudlet has been canceled.
FAILED
public static final Cloudlet.Status FAILEDThe Cloudlet has failed.
FAILED_RESOURCE_UNAVAILABLE
public static final Cloudlet.Status FAILED_RESOURCE_UNAVAILABLEThe cloudlet has failed due to a resource failure.
64 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
INEXEC
public static final Cloudlet.Status INEXECThe Cloudlet is in execution in a Vm.
INSTANTIATED
public static final Cloudlet.Status INSTANTIATEDThe Cloudlet has been just instantiated but not assigned to a Datacenter yet.
PAUSED
public static final Cloudlet.Status PAUSEDThe Cloudlet has been paused. It can be resumed by changing the status into RESUMED.
QUEUED
public static final Cloudlet.Status QUEUEDThe Cloudlet has moved to a Vm.
READY
public static final Cloudlet.Status READYThe Cloudlet has been assigned to a Datacenter to be executed as planned.
RESUMED
public static final Cloudlet.Status RESUMEDThe Cloudlet has been resumed from PAUSED state.
SUCCESS
public static final Cloudlet.Status SUCCESSThe Cloudlet has been executed successfully.
1.4.3 CloudletAbstract
public abstract class CloudletAbstract implements CloudletA base class for Cloudlet implementations.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
1.4. org.cloudbus.cloudsim.cloudlets 65
CloudSim Plus Documentation, Release 1.0.0
Constructors
CloudletAbstract
public CloudletAbstract(int cloudletId, long length, long pesNumber)Creates a Cloudlet with no priority and file size and output size equal to 1.
Parameters
• cloudletId – id of the Cloudlet
• length – the length or size (in MI) of this cloudlet to be executed in a VM
• pesNumber – number of PEs that Cloudlet will require
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.
Parameters
• length – the length or size (in MI) of this cloudlet to be executed in a VM
• 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.
Parameters
• length – the length or size (in MI) of this cloudlet to be executed in a VM
• pesNumber – number of PEs that Cloudlet will require
Methods
addOnFinishListener
public Cloudlet addOnFinishListener(EventListener<CloudletVmEventInfo> listener)
addOnUpdateProcessingListener
public Cloudlet addOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> listener)
addRequiredFile
public boolean addRequiredFile(String fileName)
66 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addRequiredFiles
public boolean addRequiredFiles(List<String> fileNames)
assignToDatacenter
public void assignToDatacenter(Datacenter datacenter)
deleteRequiredFile
public boolean deleteRequiredFile(String filename)
equals
public boolean equals(Object o)
getAccumulatedBwCost
public double getAccumulatedBwCost()
getActualCpuTime
public double getActualCpuTime(Datacenter datacenter)
getActualCpuTime
public double getActualCpuTime()
getArrivalTime
public double getArrivalTime(Datacenter datacenter)
getBroker
public DatacenterBroker getBroker()
getCostPerBw
public double getCostPerBw()
getCostPerSec
public double getCostPerSec()
1.4. org.cloudbus.cloudsim.cloudlets 67
CloudSim Plus Documentation, Release 1.0.0
getCostPerSec
public double getCostPerSec(Datacenter datacenter)
getExecStartTime
public double getExecStartTime()
getFileSize
public long getFileSize()
getFinishTime
public double getFinishTime()
getFinishedLengthSoFar
public long getFinishedLengthSoFar(Datacenter datacenter)
getFinishedLengthSoFar
public long getFinishedLengthSoFar()
getId
public int getId()
getLastDatacenter
public Datacenter getLastDatacenter()
getLastDatacenterArrivalTime
public double getLastDatacenterArrivalTime()
getLastExecutedDatacenterIdx
protected int getLastExecutedDatacenterIdx()
getLength
public long getLength()
68 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNetServiceLevel
public int getNetServiceLevel()
getNumberOfPes
public long getNumberOfPes()
getOutputSize
public long getOutputSize()
getPriority
public int getPriority()
getRequiredFiles
public List<String> getRequiredFiles()
getSimulation
public Simulation getSimulation()
getStatus
public Status getStatus()
getSubmissionDelay
public double getSubmissionDelay()
getTotalCost
public double getTotalCost()
getTotalLength
public long getTotalLength()
getUid
public String getUid()
1.4. org.cloudbus.cloudsim.cloudlets 69
CloudSim Plus Documentation, Release 1.0.0
getUtilizationModelBw
public UtilizationModel getUtilizationModelBw()
getUtilizationModelCpu
public UtilizationModel getUtilizationModelCpu()
getUtilizationModelRam
public UtilizationModel getUtilizationModelRam()
getUtilizationOfBw
public double getUtilizationOfBw()
getUtilizationOfBw
public double getUtilizationOfBw(double time)
getUtilizationOfCpu
public double getUtilizationOfCpu()
getUtilizationOfCpu
public double getUtilizationOfCpu(double time)
getUtilizationOfRam
public double getUtilizationOfRam()
getUtilizationOfRam
public double getUtilizationOfRam(double time)
getVm
public Vm getVm()
getWaitingTime
public double getWaitingTime()
70 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getWallClockTime
public double getWallClockTime(Datacenter datacenter)
getWallClockTimeInLastExecutedDatacenter
public double getWallClockTimeInLastExecutedDatacenter()
hashCode
public int hashCode()
isAssignedToDatacenter
public boolean isAssignedToDatacenter()
isBindToVm
public boolean isBindToVm()
isFinished
public boolean isFinished()
notifyOnUpdateProcessingListeners
public void notifyOnUpdateProcessingListeners(double time)
registerArrivalInDatacenter
public double registerArrivalInDatacenter()
removeOnFinishListener
public boolean removeOnFinishListener(EventListener<CloudletVmEventInfo> listener)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> lis-tener)
requiresFiles
public boolean requiresFiles()
1.4. org.cloudbus.cloudsim.cloudlets 71
CloudSim Plus Documentation, Release 1.0.0
setAccumulatedBwCost
protected final void setAccumulatedBwCost(double accumulatedBwCost)Sets the accumulated bw cost.
Parameters
• accumulatedBwCost – the accumulated bw cost to set
setBroker
public final Cloudlet setBroker(DatacenterBroker broker)
setCostPerBw
protected final void setCostPerBw(double costPerBw)Sets the cost of each byte of bandwidth (bw) consumed.
Parameters
• costPerBw – the new cost per bw to set
setExecStartTime
public void setExecStartTime(double clockTime)
setFileSize
public final Cloudlet setFileSize(long fileSize)
setFinishTime
protected final void setFinishTime(double finishTime)Sets the finish time of this cloudlet in the latest Datacenter.
Parameters
• finishTime – the finish time
setFinishedLengthSoFar
public boolean setFinishedLengthSoFar(long length)
setId
public void setId(int id)
72 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setLastExecutedDatacenterIdx
protected void setLastExecutedDatacenterIdx(int lastExecutedDatacenterIdx)
setLength
public final Cloudlet setLength(long length)
setNetServiceLevel
public boolean setNetServiceLevel(int netServiceLevel)
setNumberOfPes
public final Cloudlet setNumberOfPes(long numberOfPes)
setOutputSize
public final Cloudlet setOutputSize(long outputSize)
setPriority
public void setPriority(int priority)
setRequiredFiles
public final void setRequiredFiles(List<String> requiredFiles)Sets the list of required files.
Parameters
• requiredFiles – the new list of required files
setStatus
public boolean setStatus(Status newStatus)
setSubmissionDelay
public final void setSubmissionDelay(double submissionDelay)
setUtilizationModel
public Cloudlet setUtilizationModel(UtilizationModel utilizationModel)
1.4. org.cloudbus.cloudsim.cloudlets 73
CloudSim Plus Documentation, Release 1.0.0
setUtilizationModelBw
public final Cloudlet setUtilizationModelBw(UtilizationModel utilizationModelBw)
setUtilizationModelCpu
public final Cloudlet setUtilizationModelCpu(UtilizationModel utilizationModelCpu)
setUtilizationModelRam
public final Cloudlet setUtilizationModelRam(UtilizationModel utilizationModelRam)
setVm
public final Cloudlet setVm(Vm vm)
setWallClockTime
public boolean setWallClockTime(double wallTime, double actualCpuTime)
1.4.4 CloudletDatacenterExecution
final class CloudletDatacenterExecutionInternal class that keeps track of Cloudlet’s movement in different Datacenters. Each time acloudlet is run on a given Datacenter, the cloudlet’s execution history on each Datacenter is registered atCloudletAbstract.getLastExecutionInDatacenterInfo()
Fields
NULL
protected static final CloudletDatacenterExecution NULL
Constructors
CloudletDatacenterExecution
CloudletDatacenterExecution()
Methods
getActualCpuTime
double getActualCpuTime()The total time the Cloudlet spent being executed in a Datacenter.
74 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getArrivalTime
double getArrivalTime()Cloudlet’s submission (arrival) time to a Datacenter or Cloudlet.NOT_ASSIGNED if the Cloudlet was notassigned to a Datacenter yet.
getCostPerSec
double getCostPerSec()Cost per second a Datacenter charge to execute this Cloudlet.
getDatacenter
Datacenter getDatacenter()a Datacenter where the Cloudlet will be executed
getFinishedSoFar
long getFinishedSoFar()Cloudlet’s length finished so far (in MI).
getWallClockTime
double getWallClockTime()The time this Cloudlet resides in a Datacenter (from arrival time until departure time, that may include waitingtime).
setActualCpuTime
void setActualCpuTime(double actualCpuTime)
setArrivalTime
void setArrivalTime(double arrivalTime)
setCostPerSec
void setCostPerSec(double costPerSec)
setDatacenter
void setDatacenter(Datacenter datacenter)
1.4. org.cloudbus.cloudsim.cloudlets 75
CloudSim Plus Documentation, Release 1.0.0
setFinishedSoFar
void setFinishedSoFar(long finishedSoFar)
setWallClockTime
void setWallClockTime(double wallClockTime)
1.4.5 CloudletExecution
public class CloudletExecutionStores execution information about a Cloudlet submitted to a specific Datacenter for processing. Thisclass keeps track of the time for all activities in the Datacenter for a specific Cloudlet. Before a Cloudlet exitsthe Datacenter, it is RECOMMENDED to call this method finalizeCloudlet().
It acts as a placeholder for maintaining the amount of resource share allocated at various times for simulatingany scheduling using internal events.
As the VM where the Cloudlet is running might migrate to another Datacenter, each CloudletExecutionInfoobject represents the data about execution of the cloudlet when the Vm was in a given Datacenter.
Author Manzur Murshed, Rajkumar Buyya
Fields
NULL
public static final CloudletExecution NULLA property that implements the Null Object Design Pattern for CloudletExecution objects.
Constructors
CloudletExecution
public CloudletExecution(Cloudlet cloudlet)Instantiates a CloudletExecutionInfo object upon the arrival of a Cloudlet inside a Datacenter. The arriving timeis determined by CloudSim.clock().
Parameters
• cloudlet – the Cloudlet to store execution information from
Methods
addVirtualRuntime
public double addVirtualRuntime(double timeToAdd)Adds a given time to the virtual runtime.
Parameters
• timeToAdd – time to add to the virtual runtime (in seconds)
76 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns the new virtual runtime (in seconds)
equals
public boolean equals(Object obj)
finalizeCloudlet
public void finalizeCloudlet()Finalizes all relevant information before exiting the Datacenter entity. This method sets the final data of:
• wall clock time, i.e. the time of this Cloudlet resides in a Datacenter (from arrival time until departuretime).
• actual CPU time, i.e. the total execution time of this Cloudlet in a Datacenter.
• Cloudlet’s finished time so far
getCloudlet
public Cloudlet getCloudlet()Gets the Cloudlet for which the execution information is related to.
Returns cloudlet for this execution information object
getCloudletArrivalTime
public double getCloudletArrivalTime()Gets the time the cloudlet arrived for execution inside the Datacenter where this execution information is relatedto.
Returns arrival time
getCloudletId
public int getCloudletId()Gets the ID of the Cloudlet this execution info is related to.
getCloudletLength
public long getCloudletLength()Gets the Cloudlet’s length.
Returns Cloudlet’s length
getFileTransferTime
public double getFileTransferTime()Gets the time to transfer the list of files required by the Cloudlet from the Datacenter storage (such as a StorageArea Network) to the Vm of the Cloudlet.
1.4. org.cloudbus.cloudsim.cloudlets 77
CloudSim Plus Documentation, Release 1.0.0
getFinishTime
public double getFinishTime()Gets the time when the Cloudlet has finished completely (not just in a given Datacenter, but finished at all). Ifthe cloudlet wasn’t finished completely yet, the value is equals to Cloudlet.NOT_ASSIGNED.
Returns finish time of a cloudlet or -1.0 if it cannot finish in this hourly slot
getLastProcessingTime
public double getLastProcessingTime()Gets the last time the Cloudlet was processed at the Datacenter where this execution information is related to.
Returns the last time the Cloudlet was processed or zero when it has never been processed yet
getNumberOfPes
public long getNumberOfPes()
getRemainingCloudletLength
public long getRemainingCloudletLength()Gets the remaining cloudlet length (in MI) that has to be execute yet, considering the Cloudlet.getLength().
Returns cloudlet length in MI
getTimeSlice
public double getTimeSlice()Gets the timeslice assigned by a CloudletScheduler for a Cloudlet, which is the amount of time (inseconds) that such a Cloudlet will have to use the PEs of a Vm. Each CloudletScheduler implementation canmake use of this attribute or not. CloudletSchedulers that use it, are in charge to compute the timeslice to assignto each Cloudlet.
Returns Cloudlet timeslice (in seconds)
getVirtualRuntime
public double getVirtualRuntime()Gets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by aCloudletScheduler (in seconds). The default value of this attribute is zero. Each scheduler implementa-tion might set a value to such attribute to use it for context switch, preempting running Cloudlets to enable otherones to start executing. This way, the attribute is just used internally by specific CloudletSchedulers.
hashCode
public int hashCode()
78 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setCloudletStatus
public boolean setCloudletStatus(Cloudlet.Status newStatus)Sets the Cloudlet status.
Parameters
• newStatus – the Cloudlet status
Returns true if the new status has been set, false otherwise
setFileTransferTime
public void setFileTransferTime(double fileTransferTime)Sets the time to transfer the list of files required by the Cloudlet from the Datacenter storage (such as a StorageArea Network) to the Vm of the Cloudlet.
Parameters
• fileTransferTime – the file transfer time to set
setFinishTime
public void setFinishTime(double time)Sets the finish time for this Cloudlet. If time is negative, then it will be ignored.
Parameters
• time – finish time
setLastProcessingTime
public void setLastProcessingTime(double lastProcessingTime)Sets the last time this Cloudlet was processed at a Datacenter.
Parameters
• lastProcessingTime – the last processing time to set
setTimeSlice
public void setTimeSlice(double timeSlice)Sets the timeslice assigned by a CloudletScheduler for a Cloudlet, which is the amount of time (in sec-onds) that such a Cloudlet will have to use the PEs of a Vm. Each CloudletScheduler implementation can makeuse of this attribute or not. CloudletSchedulers that use it, are in charge to compute the timeslice to assign toeach Cloudlet.
Parameters
• timeSlice – the Cloudlet timeslice to set (in seconds)
1.4. org.cloudbus.cloudsim.cloudlets 79
CloudSim Plus Documentation, Release 1.0.0
setVirtualRuntime
public void setVirtualRuntime(double virtualRuntime)Sets the virtual runtime (vruntime) that indicates how long the Cloudlet has been executing by aCloudletScheduler (in seconds). This attribute is used just internally by specific CloudletSchedulers.
Parameters
• virtualRuntime – the value to set (in seconds)
See also: .getVirtualRuntime()
toString
public String toString()
updateProcessing
public void updateProcessing(long executedInstructions)Updates the length of cloudlet that has already been completed.
Parameters
• executedInstructions – amount of instructions just executed, to be added to theinstructionsFinishedSoFar, in Instructions (instead of Million Instructions)
1.4.6 CloudletNull
final class CloudletNull implements CloudletA class that implements the Null Object Design Pattern for Cloudlet class.
Author Manoel Campos da Silva Filho
See also: Cloudlet.NULL
Methods
addOnFinishListener
public Cloudlet addOnFinishListener(EventListener<CloudletVmEventInfo> l)
addOnUpdateProcessingListener
public Cloudlet addOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> l)
addRequiredFile
public boolean addRequiredFile(String fileName)
80 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addRequiredFiles
public boolean addRequiredFiles(List<String> fileNames)
assignToDatacenter
public void assignToDatacenter(Datacenter datacenter)
compareTo
public int compareTo(Cloudlet o)
deleteRequiredFile
public boolean deleteRequiredFile(String filename)
getAccumulatedBwCost
public double getAccumulatedBwCost()
getActualCpuTime
public double getActualCpuTime(Datacenter datacenter)
getActualCpuTime
public double getActualCpuTime()
getArrivalTime
public double getArrivalTime(Datacenter datacenter)
getBroker
public DatacenterBroker getBroker()
getCostPerBw
public double getCostPerBw()
getCostPerSec
public double getCostPerSec()
1.4. org.cloudbus.cloudsim.cloudlets 81
CloudSim Plus Documentation, Release 1.0.0
getCostPerSec
public double getCostPerSec(Datacenter datacenter)
getExecStartTime
public double getExecStartTime()
getFileSize
public long getFileSize()
getFinishTime
public double getFinishTime()
getFinishedLengthSoFar
public long getFinishedLengthSoFar()
getFinishedLengthSoFar
public long getFinishedLengthSoFar(Datacenter datacenter)
getId
public int getId()
getLastDatacenter
public Datacenter getLastDatacenter()
getLastDatacenterArrivalTime
public double getLastDatacenterArrivalTime()
getLength
public long getLength()
getNetServiceLevel
public int getNetServiceLevel()
82 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNumberOfPes
public long getNumberOfPes()
getOutputSize
public long getOutputSize()
getPriority
public int getPriority()
getRequiredFiles
public List<String> getRequiredFiles()
getSimulation
public Simulation getSimulation()
getStatus
public Status getStatus()
getSubmissionDelay
public double getSubmissionDelay()
getTotalCost
public double getTotalCost()
getTotalLength
public long getTotalLength()
getUid
public String getUid()
getUtilizationModelBw
public UtilizationModel getUtilizationModelBw()
1.4. org.cloudbus.cloudsim.cloudlets 83
CloudSim Plus Documentation, Release 1.0.0
getUtilizationModelCpu
public UtilizationModel getUtilizationModelCpu()
getUtilizationModelRam
public UtilizationModel getUtilizationModelRam()
getUtilizationOfBw
public double getUtilizationOfBw()
getUtilizationOfBw
public double getUtilizationOfBw(double time)
getUtilizationOfCpu
public double getUtilizationOfCpu()
getUtilizationOfCpu
public double getUtilizationOfCpu(double time)
getUtilizationOfRam
public double getUtilizationOfRam()
getUtilizationOfRam
public double getUtilizationOfRam(double time)
getVm
public Vm getVm()
getWaitingTime
public double getWaitingTime()
getWallClockTime
public double getWallClockTime(Datacenter datacenter)
84 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getWallClockTimeInLastExecutedDatacenter
public double getWallClockTimeInLastExecutedDatacenter()
isAssignedToDatacenter
public boolean isAssignedToDatacenter()
isBindToVm
public boolean isBindToVm()
isFinished
public boolean isFinished()
notifyOnUpdateProcessingListeners
public void notifyOnUpdateProcessingListeners(double time)
registerArrivalInDatacenter
public double registerArrivalInDatacenter()
removeOnFinishListener
public boolean removeOnFinishListener(EventListener<CloudletVmEventInfo> l)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<CloudletVmEventInfo> l)
requiresFiles
public boolean requiresFiles()
setBroker
public Cloudlet setBroker(DatacenterBroker broker)
setExecStartTime
public void setExecStartTime(double clockTime)
1.4. org.cloudbus.cloudsim.cloudlets 85
CloudSim Plus Documentation, Release 1.0.0
setFileSize
public Cloudlet setFileSize(long fileSize)
setFinishedLengthSoFar
public boolean setFinishedLengthSoFar(long length)
setId
public void setId(int id)
setLength
public Cloudlet setLength(long length)
setNetServiceLevel
public boolean setNetServiceLevel(int netServiceLevel)
setNumberOfPes
public Cloudlet setNumberOfPes(long numberOfPes)
setOutputSize
public Cloudlet setOutputSize(long outputSize)
setPriority
public void setPriority(int priority)
setStatus
public boolean setStatus(Status newStatus)
setSubmissionDelay
public void setSubmissionDelay(double submissionDelay)
setUtilizationModel
public Cloudlet setUtilizationModel(UtilizationModel utilizationModel)
86 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setUtilizationModelBw
public Cloudlet setUtilizationModelBw(UtilizationModel utilizationModelBw)
setUtilizationModelCpu
public Cloudlet setUtilizationModelCpu(UtilizationModel utilizationModelCpu)
setUtilizationModelRam
public Cloudlet setUtilizationModelRam(UtilizationModel utilizationModelRam)
setVm
public Cloudlet setVm(Vm vm)
setWallClockTime
public boolean setWallClockTime(double wallTime, double actualCpuTime)
toString
public String toString()
1.4.7 CloudletSimple
public class CloudletSimple extends CloudletAbstractCloudlet implements the basic features of an application/job/task to be executed by a Vm on behalf of a givenuser. It stores, despite all the information encapsulated in the Cloudlet, the ID of the VM running it.
Author Rodrigo N. Calheiros, Anton Beloglazov
See also: DatacenterBroker
Constructors
CloudletSimple
public CloudletSimple(long cloudletLength, 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.
Parameters
• cloudletLength – the length or size (in MI) of this cloudlet to be executed in a VM
• pesNumber – number of PEs that Cloudlet will require
1.4. org.cloudbus.cloudsim.cloudlets 87
CloudSim Plus Documentation, Release 1.0.0
CloudletSimple
public CloudletSimple(long cloudletLength, 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.
Parameters
• cloudletLength – the length or size (in MI) of this cloudlet to be executed in a VM
• pesNumber – number of PEs that Cloudlet will require
CloudletSimple
public CloudletSimple(int id, long cloudletLength, long pesNumber)Creates a Cloudlet with no priority and file size and output size equal to 1. To change these values, use therespective setters.
Parameters
• id – the unique ID of this cloudlet
• cloudletLength – the length or size (in MI) of this cloudlet to be executed in a VM
• pesNumber – the pes number
CloudletSimple
public CloudletSimple(int id, long cloudletLength, int pesNumber, long cloudletFileSize, longcloudletOutputSize, UtilizationModel utilizationModelCpu, UtilizationModel uti-lizationModelRam, UtilizationModel utilizationModelBw)
Creates a Cloudlet with the given parameters.
Parameters
• id – the unique ID of this cloudlet
• cloudletLength – the length or size (in MI) of this cloudlet to be executed in a VM
• cloudletFileSize – the file size (in bytes) of this cloudlet BEFORE submitting to aDatacenter
• cloudletOutputSize – the file size (in bytes) of this cloudlet AFTER finish executingby a VM
• pesNumber – the pes number
• utilizationModelCpu – the utilization model of CPU
• utilizationModelRam – the utilization model of RAM
• utilizationModelBw – the utilization model of BW
Methods
compareTo
public int compareTo(Cloudlet o)Compare this Cloudlet with another one based on getLength().
88 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• o – the Cloudlet to compare to
Returns @inheritDoc
toString
public String toString()
1.5 org.cloudbus.cloudsim.cloudlets.network
Provides network-enabled org.cloudbus.cloudsim.cloudlets.Cloudlet implementations. For moregeneral information, see the package org.cloudbus.cloudsim.cloudlets at the upper level.
author Manoel Campos da Silva Filho
1.5.1 CloudletExecutionTask
public class CloudletExecutionTask extends CloudletTaskA processing task that can be executed by a NetworkCloudlet in a single org.cloudbus.cloudsim.resources.Pe. The tasks currently just execute in a sequential manner.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
CloudletExecutionTask
public CloudletExecutionTask(int id, long executionLength)Creates a new task.
Parameters
• id – task id
• executionLength – the execution length of the task (in MI)
Methods
getLength
public long getLength()Gets the execution length of the task (in MI).
1.5. org.cloudbus.cloudsim.cloudlets.network 89
CloudSim Plus Documentation, Release 1.0.0
getTotalExecutedLength
public long getTotalExecutedLength()Gets the length of this CloudletTask that has been executed so far (in MI).
process
public boolean process(long executedLengthSoFar)Sets a given number of MI to the total MI executed so far by the cloudlet.
Parameters
• executedLengthSoFar – the total number of MI executed so far
Returns @inheritDoc
setLength
public void setLength(long length)Sets the execution length of the task (in MI).
Parameters
• length – the length to set
1.5.2 CloudletReceiveTask
public class CloudletReceiveTask extends CloudletTaskA task executed by a NetworkCloudlet that receives data from a CloudletSendTask. Each receivertask expects to receive packets from just one VM.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
CloudletReceiveTask
public CloudletReceiveTask(int id, Vm sourceVm)Creates a new task.
Parameters
• id – task id
• sourceVm – the Vm where it is expected to receive packets from
90 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
getNumberOfExpectedPacketsToReceive
public long getNumberOfExpectedPacketsToReceive()The number of packets that are expected to be received. After this number of packets is received, the task ismarked as finished.
getPacketsReceived
public List<VmPacket> getPacketsReceived()Gets the list of packets received.
Returns a read-only received packet list
getSourceVm
public Vm getSourceVm()Gets the Vm where it is expected to receive packets from.
receivePacket
public void receivePacket(VmPacket packet)Receives a packet sent from a CloudletSendTask and add it the the received packet list.
Parameters
• packet – the packet received
setNumberOfExpectedPacketsToReceive
public void setNumberOfExpectedPacketsToReceive(long numberOfExpectedPacketsToReceive)
1.5.3 CloudletSendTask
public class CloudletSendTask extends CloudletTaskRepresents a task executed by a NetworkCloudlet that sends data to a CloudletReceiveTask.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
1.5. org.cloudbus.cloudsim.cloudlets.network 91
CloudSim Plus Documentation, Release 1.0.0
Constructors
CloudletSendTask
public CloudletSendTask(int id)Creates a new task.
Parameters
• id – task id
Methods
addPacket
public VmPacket addPacket(Cloudlet destinationCloudlet, long dataLength)Creates and add a packet to the list of packets to be sent to a Cloudlet that is inside a specific VM.
Parameters
• destinationCloudlet – destination cloudlet to send packets to
• dataLength – the number of data bytes of the packet to create
Throws
• IllegalArgumentException – when the source or destination Cloudlet doesn’t havean assigned VM
• RuntimeException – when a NetworkCloudlet was not assigned to the Task
Returns the created packet
getPacketsToSend
public List<VmPacket> getPacketsToSend()
Returns a read-only list of packets to send
getPacketsToSend
public List<VmPacket> getPacketsToSend(double sendTime)Gets the list of packets to send, updating the send time to the given time and clearing the list of packets, markingthe task as finished.
Parameters
• sendTime – the send time to update all packets in the list
Returns the packet list with the send time updated to the given time
1.5.4 CloudletTask
public abstract class CloudletTask implements IdentificableRepresents one of many tasks that can be executed by a NetworkCloudlet.
Please refer to following publication for more details:
92 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg
Constructors
CloudletTask
public CloudletTask(int id)Creates a new task.
Parameters
• id – task id
Methods
getCloudlet
public NetworkCloudlet getCloudlet()Gets the NetworkCloudlet that the task belongs to.
getExecutionTime
public double getExecutionTime()
Returns the time the task spent executing, or -1 if not finished yet
getFinishTime
public double getFinishTime()
Returns the time the task finished or -1 if not finished yet.
getId
public int getId()Gets the id of the CloudletTask.
getMemory
public long getMemory()Gets the memory amount used by the task.
1.5. org.cloudbus.cloudsim.cloudlets.network 93
CloudSim Plus Documentation, Release 1.0.0
getStartTime
public double getStartTime()
Returns the time the task started executing, or -1 if not started yet.
isActive
public boolean isActive()Indicates if the task is active (it’s not finished).
Returns true if the task is active, false otherwise
See also: .isFinished()
isExecutionTask
public boolean isExecutionTask()
isFinished
public boolean isFinished()Indicates if the task is finished or not.
Returns true if the task has finished, false otherwise
See also: .isActive()
isReceiveTask
public boolean isReceiveTask()
isSendTask
public boolean isSendTask()
setCloudlet
public CloudletTask setCloudlet(NetworkCloudlet cloudlet)
setFinished
protected void setFinished(boolean finished)Sets the task as finished or not
Parameters
• finished – true to set the task as finished, false otherwise
Throws
94 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• RuntimeException – when the task is already finished and you try to set it as unfinished
setId
public CloudletTask setId(int id)Sets the id of the CloudletTask.
Parameters
• id – the ID to set
setMemory
public CloudletTask setMemory(long memory)Sets the memory amount used by the task.
Parameters
• memory – the memory amount to set
setStartTime
public CloudletTask setStartTime(double startTime)Sets the time the task started executing.
Parameters
• startTime – the start time to set
1.5.5 NetworkCloudlet
public class NetworkCloudlet extends CloudletSimpleNetworkCloudlet class extends Cloudlet to support simulation of complex applications. Each NetworkCloudletrepresents a task of the application. Each task consists of several tasks.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
NetworkCloudlet
public NetworkCloudlet(int id, long cloudletLength, int pesNumber)Creates a NetworkCloudlet with no priority and file size and output size equal to 1.
Parameters
• id – the unique ID of this cloudlet
• cloudletLength – the length or size (in MI) of this cloudlet to be executed in a VM
1.5. org.cloudbus.cloudsim.cloudlets.network 95
CloudSim Plus Documentation, Release 1.0.0
• pesNumber – the pes number
Methods
addTask
public NetworkCloudlet addTask(CloudletTask task)Adds a task to the task list and links the task to the NetworkCloudlet.
Parameters
• task – Task to be added
Returns the NetworkCloudlet instance
getCurrentTask
public Optional<CloudletTask> getCurrentTask()Gets an Optional containing the current task or an Optional.empty().
getLength
public long getLength()@inheritDoc
The length of a NetworkCloudlet is the length sum of all its CloudletExecutionTask’s.
Returns the length sum of all CloudletExecutionTask’s
getMemory
public long getMemory()Gets the Cloudlet’s RAM memory.
getNumberOfTasks
public double getNumberOfTasks()
getTasks
public List<CloudletTask> getTasks()
Returns a read-only list of cloudlet’s tasks.
isFinished
public boolean isFinished()
96 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isTasksStarted
public boolean isTasksStarted()Checks if the some Cloudlet Task has started yet.
Returns true if some task has started, false otherwise
setMemory
public NetworkCloudlet setMemory(long memory)Sets the Cloudlet’s RAM memory.
Parameters
• memory – amount of RAM to set
startNextTaskIfCurrentIsFinished
public boolean startNextTaskIfCurrentIsFinished(double nextTaskStartTime)Change the current task to the next one in order to start executing it, if the current task is finished.
Parameters
• nextTaskStartTime – the time that the next task will start
Returns true if the current task finished and the next one was started, false otherwise
1.6 org.cloudbus.cloudsim.core
Provides core classes used just internally by CloudSim Plus, except the org.cloudbus.cloudsim.core.CloudSim class that is the start point and main class used to run simulations.
1.6.1 ChangeableId
public interface ChangeableId extends IdentificableAn interface for objects that have to be identified by an id and that such id can be changed.
Author Manoel Campos da Silva Filho
Methods
setId
void setId(int id)
1.6.2 CloudInformationService
public class CloudInformationService extends CloudSimEntityA Cloud Information Service (CIS) is an entity that provides cloud resource registration, indexing and discoveryservices. The Cloud hostList tell their readiness to process Cloudlets by registering themselves with this entity.
1.6. org.cloudbus.cloudsim.core 97
CloudSim Plus Documentation, Release 1.0.0
Other entities such as the resource broker can contact this class for resource discovery service, which returns alist of registered resource IDs.
In summary, it acts like a yellow page service. This class will be created by CloudSim upon initialisation of thesimulation. Hence, do not need to worry about creating an object of this class.
Author Manzur Murshed, Rajkumar Buyya
Constructors
CloudInformationService
CloudInformationService(CloudSim simulation)Instantiates a new CloudInformationService object.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
Methods
getDatacenterList
public Set<Datacenter> getDatacenterList()Gets the list of all registered Datacenters.
processEvent
public void processEvent(SimEvent ev)
shutdownEntity
public void shutdownEntity()
signalShutdown
protected void signalShutdown(Collection<? extends SimEntity> list)Sends a CloudSimTags.END_OF_SIMULATION signal to all entity IDs mentioned in the given list.
Parameters
• list – List of entities to notify about simulation end
startEntity
protected void startEntity()The method has no effect at the current class.
98 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.6.3 CloudSim
public class CloudSim implements SimulationThe main class of the simulation API, that manages Cloud Computing simulations providing all methods tostart, pause and stop them. It sends and processes all discrete events during the simulation time.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
VERSION
public static final String VERSIONCloudSim Plus current version.
Constructors
CloudSim
public CloudSim()Creates a CloudSim simulation. Internally it creates a CloudInformationService.
See also: CloudInformationService, .CloudSim(double)
CloudSim
public CloudSim(double minTimeBetweenEvents)Creates a CloudSim simulation that tracks events happening in a time interval as little as the minTimeBetween-Events parameter. Internally it creates a CloudInformationService.
Parameters
• minTimeBetweenEvents – the minimal period between events. Events within shorterperiods after the last event are discarded.
See also: CloudInformationService
Methods
abort
public void abort()
addEntity
public void addEntity(CloudSimEntity e)
addOnClockTickListener
public Simulation addOnClockTickListener(EventListener<EventInfo> listener)
1.6. org.cloudbus.cloudsim.core 99
CloudSim Plus Documentation, Release 1.0.0
addOnEventProcessingListener
public final Simulation addOnEventProcessingListener(EventListener<SimEvent> listener)
addOnSimulationPausedListener
public final Simulation addOnSimulationPausedListener(EventListener<EventInfo> listener)
cancel
public SimEvent cancel(SimEntity src, Predicate<SimEvent> p)
cancelAll
public boolean cancelAll(SimEntity src, Predicate<SimEvent> p)
clock
public double clock()
clockInHours
public double clockInHours()
clockInMinutes
public double clockInMinutes()
findFirstDeferred
public SimEvent findFirstDeferred(SimEntity dest, Predicate<SimEvent> p)
getCalendar
public Calendar getCalendar()
getCloudInfoService
public CloudInformationService getCloudInfoService()
getDatacenterList
public Set<Datacenter> getDatacenterList()
100 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getEntityList
public List<SimEntity> getEntityList()
getMinTimeBetweenEvents
public double getMinTimeBetweenEvents()
getNetworkTopology
public NetworkTopology getNetworkTopology()
getNumEntities
public int getNumEntities()
getNumberOfFutureEvents
public long getNumberOfFutureEvents(Predicate<SimEvent> predicate)
holdEntity
public void holdEntity(SimEntity src, long delay)
isPaused
public boolean isPaused()
isRunning
public boolean isRunning()
pause
public boolean pause()
pause
public boolean pause(double time)
pauseEntity
public void pauseEntity(SimEntity src, double delay)
1.6. org.cloudbus.cloudsim.core 101
CloudSim Plus Documentation, Release 1.0.0
removeOnClockTickListener
public boolean removeOnClockTickListener(EventListener<? extends EventInfo> listener)
removeOnEventProcessingListener
public boolean removeOnEventProcessingListener(EventListener<SimEvent> listener)
removeOnSimulationPausedListener
public boolean removeOnSimulationPausedListener(EventListener<EventInfo> listener)
resume
public boolean resume()
select
public SimEvent select(SimEntity dest, Predicate<SimEvent> p)
send
public void send(SimEntity src, SimEntity dest, double delay, int tag, Object data)
sendFirst
public void sendFirst(SimEntity src, SimEntity dest, double delay, int tag, Object data)
sendNow
public void sendNow(SimEntity src, SimEntity dest, int tag, Object data)
setNetworkTopology
public void setNetworkTopology(NetworkTopology networkTopology)
start
public double start()
terminate
public boolean terminate()
102 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
terminateAt
public boolean terminateAt(double time)
wait
public void wait(CloudSimEntity src, Predicate<SimEvent> p)
waiting
public long waiting(SimEntity dest, Predicate<SimEvent> p)
1.6.4 CloudSimEntity
public abstract class CloudSimEntity implements SimEntityRepresents a simulation entity. An entity handles events and can send events to other entities.
Author Marcos Dias de Assuncao
Constructors
CloudSimEntity
public CloudSimEntity(Simulation simulation)Creates a new entity.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
Throws
• IllegalArgumentException – when the entity name is invalid
Methods
cancelEvent
public SimEvent cancelEvent(Predicate<SimEvent> p)Cancels the first event from the future event queue that matches a given predicate and that was submitted by thisentity, then removes it from the queue.
Parameters
• p – the event selection predicate
Returns the removed event or SimEvent.NULL if not found
1.6. org.cloudbus.cloudsim.core 103
CloudSim Plus Documentation, Release 1.0.0
clone
protected final Object clone()Gets a clone of the entity. This is used when independent replications have been specified as an output analysismethod. Clones or backups of the entities are made in the beginning of the simulation in order to reset theentities for each subsequent replication. This method should not be called by the user.
Throws
• CloneNotSupportedException – when the entity doesn’t support cloning
Returns A clone of the entity
compareTo
public int compareTo(SimEntity o)
equals
public boolean equals(Object o)
getId
public int getId()Gets the unique id number assigned to this entity.
Returns The id number
getName
public String getName()Gets the name of this entity.
Returns The entity’s name
getNextEvent
public SimEvent getNextEvent(Predicate<SimEvent> p)Gets the first event matching a predicate from the deferred queue, or if none match, wait for a matching event toarrive.
Parameters
• p – The predicate to match
Returns the simulation event
getNextEvent
public SimEvent getNextEvent()Gets the first event waiting in the entity’s deferred queue, or if there are none, wait for an event to arrive.
104 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns the simulation event
getSimulation
public Simulation getSimulation()
getState
public State getState()Gets the entity state.
Returns the state
hashCode
public int hashCode()
isStarted
public boolean isStarted()
numEventsWaiting
public long numEventsWaiting(Predicate<SimEvent> p)Counts how many events matching a predicate are waiting in the entity’s deferred queue.
Parameters
• p – The event selection predicate
Returns The count of matching events
numEventsWaiting
public long numEventsWaiting()Counts how many events are waiting in the entity’s deferred queue.
Returns The count of events
pause
public void pause(double delay)Sets the entity to be inactive for a time period.
Parameters
• delay – the time period for which the entity will be inactive
1.6. org.cloudbus.cloudsim.core 105
CloudSim Plus Documentation, Release 1.0.0
println
public void println(String msg)
run
public void run()
schedule
public void schedule(SimEntity dest, double delay, int tag, Object data)Sends an event to another entity.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent
• tag – An user-defined number representing the type of event.
• data – The data to be sent with the event.
schedule
public void schedule(SimEntity dest, double delay, int tag)
scheduleFirst
public void scheduleFirst(SimEntity dest, double delay, int tag, Object data)Sends a high priority event to another entity.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent
• tag – An user-defined number representing the type of event.
• data – The data to be sent with the event.
scheduleFirst
public void scheduleFirst(SimEntity dest, double delay, int tag)Sends a high priority event to another entity and with no attached data.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent
• tag – An user-defined number representing the type of event.
106 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
scheduleFirstNow
public void scheduleFirstNow(SimEntity dest, int tag, Object data)Sends a high priority event to another entity with no delay.
Parameters
• dest – the destination entity
• tag – An user-defined number representing the type of event.
• data – The data to be sent with the event.
scheduleFirstNow
public void scheduleFirstNow(SimEntity dest, int tag)Sends a high priority event to another entity with no attached data and no delay.
Parameters
• dest – the destination entity
• tag – An user-defined number representing the type of event.
scheduleNow
public void scheduleNow(SimEntity dest, int tag, Object data)Sends an event to another entity with no delay.
Parameters
• dest – the destination entity
• tag – An user-defined number representing the type of event.
• data – The data to be sent with the event.
scheduleNow
public void scheduleNow(SimEntity dest, int tag)Sends an event to another entity with no attached data and no delay.
Parameters
• dest – the destination entity
• tag – An user-defined number representing the type of event.
selectEvent
public SimEvent selectEvent(Predicate<SimEvent> p)Extracts the first event matching a predicate waiting in the entity’s deferred queue.
Parameters
• p – The event selection predicate
Returns the simulation event
1.6. org.cloudbus.cloudsim.core 107
CloudSim Plus Documentation, Release 1.0.0
send
protected void send(SimEntity dest, double delay, int cloudSimTag, Object data)Sends an event/message to another entity by delaying the simulation time from the current time, with a tagrepresenting the event type.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent. Ifdelay is a negative number, then it will be changed to 0
• cloudSimTag – an user-defined number representing the type of an event/message
• data – A reference to data to be sent with the event
send
protected void send(SimEntity dest, double delay, int cloudSimTag)Sends an event/message to another entity by delaying the simulation time from the current time, with a tagrepresenting the event type.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent. Ifdelay is a negative number, then it will be changed to 0
• cloudSimTag – an user-defined number representing the type of an event/message
sendNow
protected void sendNow(SimEntity dest, int cloudSimTag, Object data)Sends an event/message to another entity, with a tag representing the event type.
Parameters
• dest – the destination entity
• cloudSimTag – an user-defined number representing the type of an event/message
• data – A reference to data to be sent with the event
sendNow
protected void sendNow(SimEntity dest, int cloudSimTag)Sends an event/message to another entity, with a tag representing the event type.
Parameters
• dest – the destination entity
• cloudSimTag – an user-defined number representing the type of an event/message
108 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setEventBuffer
protected void setEventBuffer(SimEvent e)Sets the event buffer.
Parameters
• e – the new event buffer
setId
protected final void setId(int id)Sets the entity id and defines its name based on such ID.
Parameters
• id – the new id
setLog
public void setLog(boolean log)
setName
public SimEntity setName(String name)
setSimulation
public final SimEntity setSimulation(Simulation simulation)
setStarted
protected void setStarted(boolean started)Defines if the entity has already started or not.
Parameters
• started – the start state to set
setState
public SimEntity setState(State state)Sets the entity state.
Parameters
• state – the new state
1.6. org.cloudbus.cloudsim.core 109
CloudSim Plus Documentation, Release 1.0.0
start
public void start()@inheritDoc. It performs general initialization tasks that are common for every entity and executes thespecific entity startup code by calling startEntity().
See also: .startEntity()
startEntity
protected abstract void startEntity()Defines the logic to be performed by the entity when the simulation starts.
waitForEvent
public void waitForEvent(Predicate<SimEvent> p)Waits for an event matching a specific predicate. This method does not check the entity’s deferred queue.
Parameters
• p – The predicate to match
1.6.5 CloudSimTags
public final class CloudSimTagsContains various static command tags that indicate a type of action that needs to be undertaken by CloudSimentities when they receive or send events. NOTE: To avoid conflicts with other tags, CloudSim reserves numberslower than 300 and the number 9600.
Author Manzur Murshed, Rajkumar Buyya, Anthony Sulistio
Fields
CLOUDLET_CANCEL
public static final int CLOUDLET_CANCELCancels a Cloudlet submitted in the Datacenter entity. When an event of this type is sent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_PAUSE
public static final int CLOUDLET_PAUSEPauses a Cloudlet submitted in the Datacenter entity. When an event of this type is sent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_PAUSE_ACK
public static final int CLOUDLET_PAUSE_ACKPauses a Cloudlet submitted in the Datacenter entity with an acknowledgement. When an event of this type issent, the SimEvent.getData() must be a Cloudlet object.
110 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
CLOUDLET_RESUME
public static final int CLOUDLET_RESUMEResumes a Cloudlet submitted in the Datacenter entity. When an event of this type is sent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_RESUME_ACK
public static final int CLOUDLET_RESUME_ACKResumes a Cloudlet submitted in the Datacenter entity with an acknowledgement. When an event of this type issent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_RETURN
public static final int CLOUDLET_RETURNDenotes the return of a finished Cloudlet back to the sender. This tag is normally used by Datacenter entity.When an event of this type is sent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_SUBMIT
public static final int CLOUDLET_SUBMITDenotes the submission of a Cloudlet. This tag is normally used between CloudSim User and Datacenter entity.When an event of this type is sent, the SimEvent.getData() must be a Cloudlet object.
CLOUDLET_SUBMIT_ACK
public static final int CLOUDLET_SUBMIT_ACKDenotes the submission of a Cloudlet with an acknowledgement. This tag is normally used between CloudSimUser and Datacenter entity. When an event of this type is sent, the SimEvent.getData() must be aCloudlet object.
DATACENTER_LIST_REQUEST
public static final int DATACENTER_LIST_REQUESTDenotes a request from a broker to a CloudInformationService to get the list of all Datacenters, includ-ing the ones that can support advanced reservation.
DATACENTER_REGISTRATION_REQUEST
public static final int DATACENTER_REGISTRATION_REQUESTDenotes a request from a Datacenter to register itself. This tag is normally used betweenCloudInformationService and Datacenter entities. When such a SimEvent is sent, the SimEvent.getData() must be a Datacenter object.
1.6. org.cloudbus.cloudsim.core 111
CloudSim Plus Documentation, Release 1.0.0
END_OF_SIMULATION
public static final int END_OF_SIMULATIONDenotes the end of simulation.
FAILURE
public static final int FAILUREDefines the base tag to be used for failure events such as failure of hosts or VMs.
HOST_FAILURE
public static final int HOST_FAILUREDefines the tag that represents a request to generate a host failure.
ICMP_PKT_RETURN
public static final int ICMP_PKT_RETURNThis tag is used to return the ping request back to sender.
ICMP_PKT_SUBMIT
public static final int ICMP_PKT_SUBMITThis tag is used by an entity to send ping requests.
NETWORK_EVENT_DOWN
public static final int NETWORK_EVENT_DOWN
NETWORK_EVENT_HOST
public static final int NETWORK_EVENT_HOST
NETWORK_EVENT_SEND
public static final int NETWORK_EVENT_SEND
NETWORK_EVENT_UP
public static final int NETWORK_EVENT_UP
NETWORK_HOST_REGISTER
public static final int NETWORK_HOST_REGISTER
112 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
REGISTER_REGIONAL_CIS
public static final int REGISTER_REGIONAL_CISDenotes a request to register a CloudInformationService entity as a regional CIS. When such aSimEvent is sent, the SimEvent.getData() must be a CloudInformationService object.
REQUEST_REGIONAL_CIS
public static final int REQUEST_REGIONAL_CISDenotes a request to get a list of other regional CIS entities from the system CIS entity.
VM_CREATE
public static final int VM_CREATEDenotes a request to create a new VM in a Datacenter without requiring and acknowledgement to be sentback to the sender.
VM_CREATE_ACK
public static final int VM_CREATE_ACKDenotes a request to create a new VM in a Datacenter with acknowledgement information sent by theDatacenter, where the SimEvent.getData() of the reply event is a Vm object. To check if the VM was infact created inside the requested Datacenter one has only to call Vm.isCreated().
VM_DESTROY
public static final int VM_DESTROYDenotes a request to destroy a VM in a Datacenter. When an event of this type is sent, the SimEvent.getData() must be a Vm object.
VM_DESTROY_ACK
public static final int VM_DESTROY_ACKDenotes a request to destroy a new VM in a Datacenter with acknowledgement information sent by theDatacener. When an event of this type is sent, the SimEvent.getData() must be a Vm object.
VM_MIGRATE
public static final int VM_MIGRATEDenotes a request to migrate a new VM in a Datacenter. When an event of this type is sent, the SimEvent.getData() must be a Map.Entry<Vm, Host> representing to which Host a VM must be migrated.
VM_MIGRATE_ACK
public static final int VM_MIGRATE_ACKDenotes a request to migrate a new VM in a Datacenter with acknowledgement information sent by the
1.6. org.cloudbus.cloudsim.core 113
CloudSim Plus Documentation, Release 1.0.0
Datacenter. When an event of this type is sent, the SimEvent.getData() must be a Map.Entry<Vm,Host> representing to which Host a VM must be migrated.
VM_UPDATE_CLOUDLET_PROCESSING_EVENT
public static final int VM_UPDATE_CLOUDLET_PROCESSING_EVENTDenotes an internal event generated in a Datacenter to notify itself to update the processing of cloudlets.When an event of this type is sent, the SimEvent.getData() can be a Host object to indicate that justthe Cloudlets running in VMs inside such a Host must be updated. The Host is an optional parameter which ifomitted, means that all Hosts from the Datacenter will have its cloudlets updated.
VM_VERTICAL_SCALING
public static final int VM_VERTICAL_SCALINGDefines the tag to be used to request vertical scaling of VM resources such as Ram, Bandwidth or Pe. When anevent of this type is sent, the SimEvent.getData() must be a VerticalVmScaling object.
1.6.6 CustomerEntity
public interface CustomerEntity extends ChangeableId, DelayableRepresents an object that is owned by a DatacenterBroker, namely Vm and Cloudlet.
Author raysaoliveira
Methods
getBroker
DatacenterBroker getBroker()Gets the DatacenterBroker that represents the owner of this object.
Returns the broker or if a broker has not been set yet
setBroker
CustomerEntity setBroker(DatacenterBroker broker)Sets a DatacenterBroker that represents the owner of this object.
Parameters
• broker – the DatacenterBroker to set
1.6.7 Delayable
public interface DelayableDefines methods for an object that its execution can be delayed by some time when it is submitted to a to aDatacenter by a DatacenterBroker.
Author Manoel Campos da Silva Filho
See also: Vm, Cloudlet
114 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
getSubmissionDelay
double getSubmissionDelay()Gets the delay (in seconds) that a DatacenterBroker has to include when submitting the Cloudlet, in orderthat it will be assigned to a VM only after this delay has expired.
Returns the submission delay
setSubmissionDelay
void setSubmissionDelay(double submissionDelay)Sets the delay (in seconds) that a DatacenterBroker has to include when submitting the Cloudlet, in orderthat it will be assigned to a VM only after this delay has expired. The delay should be greater or equal to zero.
Parameters
• submissionDelay – the amount of seconds from the current simulation time that thecloudlet will wait to be submitted to be created and assigned to a VM
1.6.8 Identificable
public interface IdentificableAn interface for objects that have to be identified by an id.
Author Manoel Campos da Silva Filho
Methods
getId
int getId()
1.6.9 Machine
public interface Machine extends ChangeableId, ResourcefulRepresents either a: (i) Physical Machine (PM) which implements the interface Host; or (ii) Virtual Machine(VM), which implements the interface Vm.
Author Manoel Campos da Silva Filho
Fields
NULL
Machine NULLAn attribute that implements the Null Object Design Pattern for Machine objects.
1.6. org.cloudbus.cloudsim.core 115
CloudSim Plus Documentation, Release 1.0.0
Methods
getBw
Resource getBw()Gets the machine bandwidth (bw) capacity in Megabits/s.
Returns the machine bw capacity
getMips
double getMips()Gets the individual MIPS capacity of any machine’s Pe, considering that all PEs have the same capacity.
Returns the MIPS capacity of a single Pe
getNumberOfPes
long getNumberOfPes()Gets the overall number of Pes the machine has, that include PEs of all statuses, including failed PEs.
Returns the machine’s number of PEs
getRam
Resource getRam()Gets the machine memory resource in Megabytes.
Returns the machine memory
getSimulation
Simulation getSimulation()Gets the CloudSim instance that represents the simulation the Entity is related to.
getStorage
Resource getStorage()Gets the storage device of the machine with capacity in Megabytes.
Returns the machine storage device
getTotalMipsCapacity
double getTotalMipsCapacity()Gets total MIPS capacity of all PEs of the machine.
Returns the total MIPS of all PEs
116 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.6.10 MachineNull
final class MachineNull implements MachineA class that implements the Null Object Design Pattern for Machine objects.
Author Manoel Campos da Silva Filho
See also: Machine.NULL
Methods
getBw
public Resource getBw()
getId
public int getId()
getMips
public double getMips()
getNumberOfPes
public long getNumberOfPes()
getRam
public Resource getRam()
getResources
public List<ResourceManageable> getResources()
getSimulation
public Simulation getSimulation()
getStorage
public Resource getStorage()
getTotalMipsCapacity
public double getTotalMipsCapacity()
1.6. org.cloudbus.cloudsim.core 117
CloudSim Plus Documentation, Release 1.0.0
setId
public void setId(int id)
1.6.11 Nameable
public interface Nameable extends IdentificableAn interface for objects that have to be identified by an id and that also have a name.
Author Manoel Campos da Silva Filho
Methods
getName
String getName()
1.6.12 SimEntity
public interface SimEntity extends Nameable, Cloneable, Runnable, Comparable<SimEntity>An interface that represents a simulation entity. An entity handles events and can send events to other entities.
Author Marcos Dias de Assuncao, Manoel Campos da Silva Filho
See also: CloudSimEntity
Fields
NULL
SimEntity NULLAn attribute that implements the Null Object Design Pattern for SimEntity objects.
Methods
getSimulation
Simulation getSimulation()Gets the CloudSim instance that represents the simulation to each the Entity is related to.
isStarted
boolean isStarted()Checks if the entity already was started or not.
118 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
println
void println(String msg)Prints a given message if the logging is enabled for this entity.
Parameters
• msg – the message to be printed.
println
void println()Prints an empty line if the logging is enabled for this entity.
processEvent
void processEvent(SimEvent ev)Processes events or services that are available for the entity. This method is invoked by the CloudSim classwhenever there is an event in the deferred queue, which needs to be processed by the entity.
Parameters
• ev – information about the event just happened
run
void run()The run loop to process events fired during the simulation. The events that will be processed are defined in theprocessEvent(SimEvent) method.
See also: .processEvent(SimEvent)
schedule
void schedule(SimEntity dest, double delay, int tag)Sends an event to another entity with no attached data.
Parameters
• dest – the destination entity
• delay – How many seconds after the current simulation time the event should be sent
• tag – An user-defined number representing the type of event.
setLog
void setLog(boolean log)Define if log is enabled for this particular entity or not.
Parameters
• log – true to enable logging, false to disable
1.6. org.cloudbus.cloudsim.core 119
CloudSim Plus Documentation, Release 1.0.0
setName
SimEntity setName(String newName)Sets the Entity name.
Parameters
• newName – the new name
Throws
• IllegalArgumentException – when the entity name is null or empty
setSimulation
SimEntity setSimulation(Simulation simulation)Sets the CloudSim instance that represents the simulation the Entity is related to.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
setState
SimEntity setState(State state)
shutdownEntity
void shutdownEntity()Shuts down the entity. This method is invoked by the CloudSim before the simulation finishes. If you want tosave data in log files this is the method in which the corresponding code would be placed.
start
void start()Starts the entity during simulation start. This method is invoked by the CloudSim class when the simulationis started.
1.6.13 SimEntity.State
enum StateDefines the event state.
Enum Constants
FINISHED
public static final SimEntity.State FINISHED
120 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
HOLDING
public static final SimEntity.State HOLDING
RUNNABLE
public static final SimEntity.State RUNNABLE
WAITING
public static final SimEntity.State WAITING
1.6.14 SimEntityNull
final class SimEntityNull implements SimEntityA class that implements the Null Object Design Pattern for SimEntity class.
Author Manoel Campos da Silva Filho
See also: SimEntity.NULL
Methods
compareTo
public int compareTo(SimEntity o)
getId
public int getId()
getName
public String getName()
getSimulation
public Simulation getSimulation()
isStarted
public boolean isStarted()
println
public void println(String msg)
1.6. org.cloudbus.cloudsim.core 121
CloudSim Plus Documentation, Release 1.0.0
processEvent
public void processEvent(SimEvent ev)
run
public void run()
schedule
public void schedule(SimEntity dest, double delay, int tag)
setLog
public void setLog(boolean log)
setName
public SimEntity setName(String newName)
setSimulation
public SimEntity setSimulation(Simulation simulation)
setState
public SimEntity setState(State state)
shutdownEntity
public void shutdownEntity()
start
public void start()
1.6.15 Simulation
public interface SimulationAn interface to be implemented by a class that manages simulation execution, controlling all the simulation lifecycle.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See also: CloudSim
122 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Fields
ANY_EVT
Predicate<SimEvent> ANY_EVTA standard predicate that matches any event.
NULL
Simulation NULLAn attribute that implements the Null Object Design Pattern for Simulation objects.
Methods
abort
void abort()Aborts the simulation without finishing the processing of entities in the entities list, what may giveunexpected results.
Use this method just if you want to abandon the simulation an usually ignore the results.
addEntity
void addEntity(CloudSimEntity e)Adds a new entity to the simulation. Each CloudSimEntity object register itself when it is instantiated.
Parameters
• e – The new entity
addOnClockTickListener
Simulation addOnClockTickListener(EventListener<EventInfo> listener)Adds a EventListener object that will be notified every time when the simulation clock advances. Notifi-cations are sent in a second interval to avoid notification flood. Thus, if the clock changes, for instance, from1.0, to 1.1, 2.0, 2.1, 2.2, 2.5 and then 3.2, notifications will just be sent for the times 1, 2 and 3 that represent theinteger part of the simulation time.
Parameters
• listener – the event listener to add
addOnEventProcessingListener
Simulation addOnEventProcessingListener(EventListener<SimEvent> listener)Adds a EventListener object that will be notified when any event is processed by CloudSim. When thisListener is notified, it will receive the SimEvent that was processed.
Parameters
• listener – the event listener to add
1.6. org.cloudbus.cloudsim.core 123
CloudSim Plus Documentation, Release 1.0.0
addOnSimulationPausedListener
Simulation addOnSimulationPausedListener(EventListener<EventInfo> listener)Adds an EventListener object that will be notified when the simulation is paused. When this Listener isnotified, it will receive an EventInfo informing the time the pause occurred.
This object is just information about the event that happened. In fact, it isn’t generated an actual @limkSimEvent for a pause event because there is not need for that.
Parameters
• listener – the event listener to add
cancel
SimEvent cancel(SimEntity src, Predicate<SimEvent> p)Cancels the first event from the future event queue that matches a given predicate and was sent by a given entity,then removes it from the queue.
Parameters
• src – Id of entity that scheduled the event
• p – the event selection predicate
Returns the removed event or SimEvent.NULL if not found
cancelAll
boolean cancelAll(SimEntity src, Predicate<SimEvent> p)Cancels all events from the future event queue that matches a given predicate and were sent by a given entity,then removes those ones from the queue.
Parameters
• src – Id of entity that scheduled the event
• p – the event selection predicate
Returns true if at least one event has been cancelled; false otherwise
clock
double clock()Gets the current simulation time in seconds.
See also: .isRunning()
clockInHours
double clockInHours()Gets the current simulation time in hours.
See also: .isRunning()
124 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
clockInMinutes
double clockInMinutes()Gets the current simulation time in minutes.
See also: .isRunning()
findFirstDeferred
SimEvent findFirstDeferred(SimEntity dest, Predicate<SimEvent> p)Find first deferred event matching a predicate.
Parameters
• dest – Id of entity that the event has to be sent to
• p – the event selection predicate
Returns the first matched event or SimEvent.NULL if not found
getCalendar
Calendar getCalendar()Gets a new copy of initial simulation Calendar.
Returns a new copy of Calendar object
getCloudInfoService
CloudInformationService getCloudInfoService()Gets the CloudInformationService.
Returns the Entity
getDatacenterList
Set<Datacenter> getDatacenterList()Sends a request to Cloud Information Service (CIS) entity to get the list of all Cloud Datacenter IDs.
Returns a List containing Datacenter IDs
getEntityList
List<SimEntity> getEntityList()Returns a read-only list of entities created for the simulation.
getMinTimeBetweenEvents
double getMinTimeBetweenEvents()Returns the minimum time between events (in seconds). Events within shorter periods after the last event arediscarded.
1.6. org.cloudbus.cloudsim.core 125
CloudSim Plus Documentation, Release 1.0.0
Returns the minimum time between events (in seconds).
getNetworkTopology
NetworkTopology getNetworkTopology()Gets the network topology used for Network simulations.
getNumEntities
int getNumEntities()Get the current number of entities in the simulation.
Returns The number of entities
getNumberOfFutureEvents
long getNumberOfFutureEvents(Predicate<SimEvent> predicate)Gets the number of events in the future queue which match a given predicate.
Parameters
• predicate – the predicate to filter the list of future events.
Returns the number of future events which match the predicate
holdEntity
void holdEntity(SimEntity src, long delay)Holds an entity for some time.
Parameters
• src – id of entity to be held
• delay – How many seconds after the current time the entity has to be held
isPaused
boolean isPaused()Checks if the simulation is paused.
isRunning
boolean isRunning()Check if the simulation is still running. Even if the simulation is paused, the method returns true to indicatethat the simulation is in fact active yet.
This method should be used by entities to check if they should continue executing.
126 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
pause
boolean pause()Requests the simulation to be paused as soon as possible.
Returns true if the simulation was paused, false if it was already paused or has finished
pause
boolean pause(double time)Requests the simulation to be paused at a given time. The method schedules the pause request and then returnsimmediately.
Parameters
• time – the time at which the simulation has to be paused
Returns true if pause request was successfully received (the given time is greater than or equal tothe current simulation time), false otherwise.
pauseEntity
void pauseEntity(SimEntity src, double delay)Pauses an entity for some time.
Parameters
• src – id of entity to be paused
• delay – the time period for which the entity will be inactive
removeOnClockTickListener
boolean removeOnClockTickListener(EventListener<? extends EventInfo> listener)Removes a listener from the onClockTickListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
removeOnEventProcessingListener
boolean removeOnEventProcessingListener(EventListener<SimEvent> listener)Removes a listener from the onEventProcessingListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
1.6. org.cloudbus.cloudsim.core 127
CloudSim Plus Documentation, Release 1.0.0
removeOnSimulationPausedListener
boolean removeOnSimulationPausedListener(EventListener<EventInfo> listener)Removes a listener from the onSimulationPausedListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
resume
boolean resume()This method is called if one wants to resume the simulation that has previously been paused.
Returns true if the simulation has been restarted or false if it wasn’t paused.
select
SimEvent select(SimEntity dest, Predicate<SimEvent> p)Selects the first deferred event that matches a given predicate and removes it from the queue.
Parameters
• dest – entity that the event has to be sent to
• p – the event selection predicate
Returns the removed event or SimEvent.NULL if not found
send
void send(SimEntity src, SimEntity dest, double delay, int tag, Object data)Sends an event from one entity to another.
Parameters
• src – entity that scheduled the event
• dest – entity that the event will be sent to
• delay – How many seconds after the current simulation time the event should be sent
• tag – the tag that classifies the event
• data – the data to be sent inside the event
sendFirst
void sendFirst(SimEntity src, SimEntity dest, double delay, int tag, Object data)Sends an event from one entity to another, adding it to the beginning of the queue in order to give priority to it.
Parameters
• src – entity that scheduled the event
• dest – entity that the event will be sent to
128 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• delay – How many seconds after the current simulation time the event should be sent
• tag – the tag that classifies the event
• data – the data to be sent inside the event
sendNow
void sendNow(SimEntity src, SimEntity dest, int tag, Object data)Sends an event from one entity to another without delaying the message.
Parameters
• src – entity that scheduled the event
• dest – entity that the event will be sent to
• tag – the tag that classifies the event
• data – the data to be sent inside the event
setIdForEntitiesWithoutOne
static <T extends ChangeableId> boolean setIdForEntitiesWithoutOne(List<? extends T> list)Defines IDs for a list of ChangeableId entities that don’t have one already assigned. Such entities can be aCloudlet, Vm or any object that implements ChangeableId.
Parameters
• <T> – the type of entities to define an ID
• list – list of objects to define an ID
Returns true if the List has any Entity, false if it’s empty
setIdForEntitiesWithoutOne
static <T extends ChangeableId> boolean setIdForEntitiesWithoutOne(List<? extends T> list, TlastEntity)
Defines IDs for a list of ChangeableId entities that don’t have one already assigned. Such entities can be aCloudlet, Vm or any object that implements ChangeableId.
Parameters
• <T> – the type of entities to define an ID
• list – list of objects to define an ID
• lastEntity – the last created Entity which its ID will be used as the base for the nextIDs
Returns true if the List has any Entity, false if it’s empty
setNetworkTopology
void setNetworkTopology(NetworkTopology networkTopology)Sets the network topology used for Network simulations.
Parameters
1.6. org.cloudbus.cloudsim.core 129
CloudSim Plus Documentation, Release 1.0.0
• networkTopology – the network topology to set
start
double start()Starts simulation execution and waits for all entities to finish, i.e. until all entities threads reach non-RUNNABLE state or there are no more events in the future event queue.
Note: This method should be called just after all the entities have been setup and added. The method blocksuntil the simulation is ended.
Throws
• UnsupportedOperationException – When the simulation has already run once. Ifyou paused the simulation and wants to resume it, you must use resume() instead ofcalling the current method.
Returns the last clock time
terminate
boolean terminate()Forces the termination of the simulation before it ends.
Returns true if the simulation was running and the termination request was accepted, false if thesimulation was not started yet
terminateAt
boolean terminateAt(double time)Schedules the termination of the simulation for a given time (in seconds).
If a termination time is set, the simulation stays running even if there is no event to process. It keeps waiting fornew dynamic events, such as the creation of Cloudlets and VMs at runtime. If no event happens, the clock isincreased to simulate time passing. The clock increment is defined according to: (i) the lower Datacenter.getSchedulingInterval() between existing Datacenters; or (ii) getMinTimeBetweenEvents()in case no Datacenter has its schedulingInterval set.
Parameters
• time – the time at which the simulation has to be terminated (in seconds)
Returns true if the time given is greater than the current simulation time, false otherwise
wait
void wait(CloudSimEntity src, Predicate<SimEvent> p)Sets the state of an entity to SimEntity.State.WAITING, making it to wait for events that satisfy a givenpredicate. Only such events will be passed to the entity. This is done to avoid unnecessary context Datacenter.
Parameters
• src – entity that scheduled the event
• p – the event selection predicate
130 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
waiting
long waiting(SimEntity dest, Predicate<SimEvent> p)Gets the number of events in the deferred event queue that are targeted to a given entity and match a givenpredicate.
Parameters
• dest – Id of entity that the event has to be sent to
• p – the event selection predicate
1.6.16 SimulationNull
final class SimulationNull implements SimulationA class that implements the Null Object Design Pattern for Simulation class.
Author Manoel Campos da Silva Filho
See also: Simulation.NULL
Methods
abort
public void abort()
addEntity
public void addEntity(CloudSimEntity e)
addOnClockTickListener
public Simulation addOnClockTickListener(EventListener<EventInfo> listener)
addOnEventProcessingListener
public Simulation addOnEventProcessingListener(EventListener<SimEvent> listener)
addOnSimulationPausedListener
public Simulation addOnSimulationPausedListener(EventListener<EventInfo> listener)
cancel
public SimEvent cancel(SimEntity src, Predicate<SimEvent> p)
1.6. org.cloudbus.cloudsim.core 131
CloudSim Plus Documentation, Release 1.0.0
cancelAll
public boolean cancelAll(SimEntity src, Predicate<SimEvent> p)
clock
public double clock()
clockInHours
public double clockInHours()
clockInMinutes
public double clockInMinutes()
findFirstDeferred
public SimEvent findFirstDeferred(SimEntity dest, Predicate<SimEvent> p)
getCalendar
public Calendar getCalendar()
getCloudInfoService
public CloudInformationService getCloudInfoService()
getDatacenterList
public Set<Datacenter> getDatacenterList()
getEntityList
public List<SimEntity> getEntityList()
getMinTimeBetweenEvents
public double getMinTimeBetweenEvents()
getNetworkTopology
public NetworkTopology getNetworkTopology()
132 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNumEntities
public int getNumEntities()
getNumberOfFutureEvents
public long getNumberOfFutureEvents(Predicate<SimEvent> predicate)
holdEntity
public void holdEntity(SimEntity src, long delay)
isPaused
public boolean isPaused()
isRunning
public boolean isRunning()
pause
public boolean pause()
pause
public boolean pause(double time)
pauseEntity
public void pauseEntity(SimEntity src, double delay)
removeOnClockTickListener
public boolean removeOnClockTickListener(EventListener<? extends EventInfo> listener)
removeOnEventProcessingListener
public boolean removeOnEventProcessingListener(EventListener<SimEvent> listener)
removeOnSimulationPausedListener
public boolean removeOnSimulationPausedListener(EventListener<EventInfo> listener)
1.6. org.cloudbus.cloudsim.core 133
CloudSim Plus Documentation, Release 1.0.0
resume
public boolean resume()
select
public SimEvent select(SimEntity dest, Predicate<SimEvent> p)
send
public void send(SimEntity src, SimEntity dest, double delay, int tag, Object data)
sendFirst
public void sendFirst(SimEntity src, SimEntity dest, double delay, int tag, Object data)
sendNow
public void sendNow(SimEntity src, SimEntity dest, int tag, Object data)
setNetworkTopology
public void setNetworkTopology(NetworkTopology networkTopology)
start
public double start()
terminate
public boolean terminate()
terminateAt
public boolean terminateAt(double time)
wait
public void wait(CloudSimEntity src, Predicate<SimEvent> p)
waiting
public long waiting(SimEntity dest, Predicate<SimEvent> p)
134 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.6.17 UniquelyIdentificable
public interface UniquelyIdentificable extends IdentificableAn interface for objects that have an Unique Identifier (UID) that is compounded by a DatacenterBrokerID and the object ID.
Author Manoel Campos da Silva Filho
Methods
getUid
static String getUid(int brokerId, int id)Generates an Unique Identifier (UID).
Parameters
• brokerId – the id of the DatacenterBroker (user)
• id – the object id
Returns the generated UID
getUid
String getUid()Gets the Unique Identifier (UID) for the VM, that is compounded by the id of a DatacenterBroker (repre-senting the User) and the object id.
1.7 org.cloudbus.cloudsim.core.events
Provides classes used by the core message passing mechanisms. CloudSim Plus is an event discrete simulator thatrelies on message transmission to update the progress of the simulation. Such a package provide classes that representcore simulation events and event queues.
author Manoel Campos da Silva Filho
1.7.1 CloudSimEvent
public final class CloudSimEvent implements SimEventThis class represents a simulation event which is passed between the entities in the simulation.
Author Costas Simatos
See also: CloudSim, SimEntity
Constructors
CloudSimEvent
public CloudSimEvent(CloudSim simulation, Type type, double time, SimEntity src, SimEntity dest, int tag,Object data)
Creates a CloudSimEvent.
1.7. org.cloudbus.cloudsim.core.events 135
CloudSim Plus Documentation, Release 1.0.0
Parameters
• src – the event to clone
CloudSimEvent
public CloudSimEvent(CloudSim simulation, Type type, double time, Object data)Creates a CloudSimEvent.
CloudSimEvent
public CloudSimEvent(SimEvent src)Creates a CloudSimEvent cloning another given one.
Parameters
• src – the event to clone
CloudSimEvent
public CloudSimEvent(CloudSim simulation, Type type, double time, SimEntity src)
Methods
compareTo
public int compareTo(SimEvent event)
eventTime
public double eventTime()
getData
public Object getData()
getDestination
public SimEntity getDestination()
getEndWaitingTime
public double getEndWaitingTime()
getListener
public EventListener<? extends EventInfo> getListener()
136 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getSerial
public long getSerial()
getSimulation
public Simulation getSimulation()
getSource
public SimEntity getSource()
getTag
public int getTag()
getTime
public double getTime()
getType
public Type getType()
scheduledBy
public SimEntity scheduledBy()
setDestination
public SimEvent setDestination(SimEntity destination)
setSerial
public void setSerial(long serial)
setSource
public SimEvent setSource(SimEntity source)
toString
public String toString()
1.7. org.cloudbus.cloudsim.core.events 137
CloudSim Plus Documentation, Release 1.0.0
1.7.2 DeferredQueue
public class DeferredQueue implements EventQueueThis class implements the deferred event queue used by CloudSim. The event queue uses a linked list to storethe events.
Author Marcos Dias de Assuncao
See also: CloudSim, SimEvent
Methods
addEvent
public void addEvent(SimEvent newEvent)Adds a new event to the queue. Adding a new event to the queue preserves the temporal order of the events.
Parameters
• newEvent – The event to be added to the queue.
clear
public void clear()Clears the queue.
first
public SimEvent first()
isEmpty
public boolean isEmpty()
iterator
public Iterator<SimEvent> iterator()Returns an iterator to the events in the queue.
Returns the iterator
remove
public boolean remove(SimEvent event)Removes the event from the queue.
Parameters
• event – the event
Returns true, if successful
138 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
size
public int size()Returns the size of this event queue.
Returns the number of events in the queue.
stream
public Stream<SimEvent> stream()Returns a stream to the elements into the queue.
Returns the stream
1.7.3 EventQueue
public interface EventQueueAn interface to be implemented by event queues.
Author Marcos Dias de Assuncao, Manoel Campos da Silva Filho
Methods
addEvent
void addEvent(SimEvent newEvent)Adds a new event to the queue. Adding a new event to the queue preserves the temporal order of the events inthe queue.
Parameters
• newEvent – The event to be put in the queue.
first
SimEvent first()Gets the first element of the queue.
Throws
• NoSuchElementException – when the queue is empty
Returns the first element
isEmpty
boolean isEmpty()Checks if the queue is empty.
Returns true if the queue is empty, false otherwise
1.7. org.cloudbus.cloudsim.core.events 139
CloudSim Plus Documentation, Release 1.0.0
iterator
Iterator<SimEvent> iterator()Returns an iterator to the elements into the queue.
Returns the iterator
size
int size()Returns the size of this event queue.
Returns the size
stream
Stream<SimEvent> stream()Returns a stream to the elements into the queue.
Returns the stream
1.7.4 FutureQueue
public class FutureQueue implements EventQueueThis class implements the future event queue used by CloudSim. The event queue uses a TreeSet in orderto store the events.
Author Marcos Dias de Assuncao
See also: java.util.TreeSet
Methods
addEvent
public void addEvent(SimEvent newEvent)
addEventFirst
public void addEventFirst(SimEvent newEvent)Adds a new event to the head of the queue.
Parameters
• newEvent – The event to be put in the queue.
clear
public void clear()Clears the queue.
140 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
first
public SimEvent first()
isEmpty
public boolean isEmpty()
iterator
public Iterator<SimEvent> iterator()
remove
public boolean remove(SimEvent event)Removes the event from the queue.
Parameters
• event – the event
Returns true, if successful
removeAll
public boolean removeAll(Collection<SimEvent> events)Removes all the events from the queue.
Parameters
• events – the events
Returns true, if successful
size
public int size()
stream
public Stream<SimEvent> stream()
1.7.5 PredicateType
public class PredicateType implements Predicate<SimEvent>A predicate to select events with specific tag.
Author Marcos Dias de Assuncao
See also: Predicate
1.7. org.cloudbus.cloudsim.core.events 141
CloudSim Plus Documentation, Release 1.0.0
Constructors
PredicateType
public PredicateType(int tag)Constructor used to select events with the given tag value.
Parameters
• tag – an event tag value
Methods
test
public boolean test(SimEvent ev)Matches any event that has one of the specified tag.
Parameters
• ev – @inheritDoc
Returns @inheritDoc
See also: .tag
1.7.6 SimEvent
public interface SimEvent extends Comparable<SimEvent>, EventInfoRepresents a simulation event which is passed between the entities in a specific Simulation instance.
Author Costas Simatos, Manoel Campos da Silva Filho
See also: CloudSimEvent
Fields
NULL
SimEvent NULLAn attribute that implements the Null Object Design Pattern for SimEvent objects.
Methods
compareTo
int compareTo(SimEvent o)
eventTime
double eventTime()Gets the simulation time that this event was scheduled.
142 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getData
Object getData()Gets the data object passed in this event. The actual class of this data is defined by the entity that generates theevent. The value defined for the getTag() is used by an entity receiving the event to know what is the classof the data associated to the event. After checking what is the event tag, te destination entity then can perform atypecast to convert the data to the expected class.
Returns a reference to the data object
getDestination
SimEntity getDestination()Gets the entity which received this event.
getEndWaitingTime
double getEndWaitingTime()Gets the simulation time that this event was removed from the queue for service.
getSerial
long getSerial()Gets the serial number that defines the order of received events when multiple events are generated at the sametime. If two events have the same getTag(), to know what event is greater than other (i.e. that happens afterother), the compareTo(SimEvent) makes use of this field.
getSimulation
Simulation getSimulation()Gets the CloudSim instance that represents the simulation for with the Entity is related to.
getSource
SimEntity getSource()Gets the entity which scheduled this event.
getTag
int getTag()Gets the user-defined tag of this event. The meaning of such a tag depends on the entities that generate andreceive the event. Usually it is defined from a constant value defined in CloudSimTags.
getType
Type getType()Gets the internal type
1.7. org.cloudbus.cloudsim.core.events 143
CloudSim Plus Documentation, Release 1.0.0
scheduledBy
SimEntity scheduledBy()Gets the entity which scheduled this event.
setDestination
SimEvent setDestination(SimEntity destination)Sets the destination entity of this event, that defines its destination.
Parameters
• destination – the unique id number of the destination entity
setSerial
void setSerial(long serial)Sets the serial number that defines the order of received events when multiple events are generated at the sametime.
Parameters
• serial – the serial value to set
setSource
SimEvent setSource(SimEntity source)Sets the source entity of this event, that defines its sender.
Parameters
• source – the unique id number of the source entity
1.7.7 SimEvent.Type
enum TypeInternal event types
Enum Constants
CREATE
public static final SimEvent.Type CREATE
HOLD_DONE
public static final SimEvent.Type HOLD_DONE
144 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
NULL
public static final SimEvent.Type NULL
SEND
public static final SimEvent.Type SEND
1.7.8 SimEventNull
final class SimEventNull implements SimEventA class that implements the Null Object Design Pattern for SimEvent class.
Author Manoel Campos da Silva Filho
See also: SimEvent.NULL
Methods
compareTo
public int compareTo(SimEvent o)
eventTime
public double eventTime()
getData
public Object getData()
getDestination
public SimEntity getDestination()
getEndWaitingTime
public double getEndWaitingTime()
getListener
public EventListener<EventInfo> getListener()
getSerial
public long getSerial()
1.7. org.cloudbus.cloudsim.core.events 145
CloudSim Plus Documentation, Release 1.0.0
getSimulation
public Simulation getSimulation()
getSource
public SimEntity getSource()
getTag
public int getTag()
getTime
public double getTime()
getType
public Type getType()
scheduledBy
public SimEntity scheduledBy()
setDestination
public SimEvent setDestination(SimEntity destination)
setSerial
public void setSerial(long serial)
setSource
public SimEvent setSource(SimEntity source)
1.8 org.cloudbus.cloudsim.datacenters
Provides org.cloudbus.cloudsim.datacenters.Datacenter implementations, that represents a physi-cal Cloud Datacenter and contains a set of org.cloudbus.cloudsim.hosts.Host that together provide thebasic cloud infrastructure.
Each Datacenter has attributes that define its characteristics, such as the costs to use different physicalresources from Hosts. These attributes are defined by a org.cloudbus.cloudsim.datacenters.DatacenterCharacteristics object.
146 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
For each created Datacenter, a org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicy instance must be defined. This object decides which PM will host each org.cloudbus.cloudsim.vms.Vm. The most basic VmAllocationPolicy is the org.cloudbus.cloudsim.allocationpolicies.VmAllocationPolicySimple.
All datacenter implementations are natively power-ware. Specific implementations can also be network-aware, enabling the simulation of network communication. There are specifc networtk-aware versions for Hostsand VMs and a single kindle of such objects must be used for a simulation. For instance a network-awaresimulation must use org.cloudbus.cloudsim.datacenters.network.NetworkDatacenter, org.cloudbus.cloudsim.hosts.network.NetworkHost, org.cloudbus.cloudsim.vms.network.NetworkVm and org.cloudbus.cloudsim.cloudlets.network.NetworkCloudlet.
author Manoel Campos da Silva Filho
1.8.1 Datacenter
public interface Datacenter extends SimEntity, PowerAwareAn interface to be implemented by each class that provides Datacenter features. The interface imple-ments the Null Object Design Pattern in order to start avoiding NullPointerException when using theDatacenter.NULL object instead of attributing null to Datacenter variables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
DEF_BANDWIDTH_PERCENT_FOR_MIGRATION
double DEF_BANDWIDTH_PERCENT_FOR_MIGRATIONThe default percentage of bandwidth allocated for VM migration, is a value is not set.
See also: .setBandwidthPercentForMigration(double)
NULL
Datacenter NULLA property that implements the Null Object Design Pattern for Datacenter objects.
Methods
addFile
int addFile(File file)Adds a file into the resource’s storage before the experiment starts. If the file is a master file, then it will beregistered to the RC when the experiment begins.
Parameters
• file – a DataCloud file
Returns a tag number denoting whether this operation is a success or not
1.8. org.cloudbus.cloudsim.datacenters 147
CloudSim Plus Documentation, Release 1.0.0
addHost
<T extends Host> Datacenter addHost(T host)Physically expands the Datacenter by adding a new Host (physical machine) to it. Hosts can be added beforeor after the simulation has started. If a Host is added during simulation execution, in case VMs are addeddynamically too, they may be allocated to this new Host, depending on the VmAllocationPolicy .
If an ID is not assigned to the given Host, the method assigns one.
Parameters
• host – the new host to be added
See also: .getVmAllocationPolicy()
addHostList
<T extends Host> Datacenter addHostList(List<T> hostList)Physically expands the Datacenter by adding a List of new Hosts (physical machines) to it. Hosts can be addedbefore or after the simulation has started. If a Host is added during simulation execution, in case VMs are addeddynamically too, they may be allocated to this new Host, depending on the VmAllocationPolicy .
If an ID is not assigned to a Host, the method assigns one.
Parameters
• hostList – the List of new hosts to be added
See also: .getVmAllocationPolicy()
getBandwidthPercentForMigration
double getBandwidthPercentForMigration()Gets the percentage of the bandwidth allocated to a Host to migrate VMs. It’s a value between [0 and 1] (where1 is 100%). The default value is 0.5, meaning only 50% of the bandwidth will be allowed for migration, whilethe remaining will be used for VM services.
See also: .DEF_BANDWIDTH_PERCENT_FOR_MIGRATION
getCharacteristics
DatacenterCharacteristics getCharacteristics()Gets the Datacenter characteristics.
Returns the Datacenter characteristics
getHost
Host getHost(int index)
148 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getHostList
<T extends Host> List<T> getHostList()Gets an unmodifiable host list.
Parameters
• <T> – The generic type
Returns the host list
getPower
double getPower()Gets an estimation of Datacenter power consumption in Watt-Second (Ws).
To get actual power consumption, it’s required to enable Host’s StateHistory by calling and use each Host tocompute power usage based on the CPU utilization got form the StateHistory.
Returns th estimated power consumption in Watt-Second (Ws)
getSchedulingInterval
double getSchedulingInterval()Gets the scheduling interval to process each event received by the Datacenter (in seconds). This value de-fines the interval in which processing of Cloudlets will be updated. The interval doesn’t affect the process-ing of such cloudlets, it only defines in which interval the processing will be updated. For instance, if it isset a interval of 10 seconds, the processing of cloudlets will be updated at every 10 seconds. By this way,trying to get the amount of instructions the cloudlet has executed after 5 seconds, by means of Cloudlet.getFinishedLengthSoFar(Datacenter), it will not return an updated value. By this way, one shouldset the scheduling interval to 5 to get an updated result. As longer is the interval, faster will be the simulationexecution.
Returns the scheduling interval (in seconds)
getStorageList
List<FileStorage> getStorageList()Gets a read-only list of storage devices of the Datacenter.
Returns the storage list
getVmAllocationPolicy
VmAllocationPolicy getVmAllocationPolicy()Gets the policy to be used by the Datacenter to allocate VMs into hosts.
Returns the VM allocation policy
See also: VmAllocationPolicy
1.8. org.cloudbus.cloudsim.datacenters 149
CloudSim Plus Documentation, Release 1.0.0
getVmList
<T extends Vm> List<T> getVmList()Gets a read-only list all VMs from all Hosts of this Datacenter.
Parameters
• <T> – the class of VMs inside the list
Returns the list all VMs from all Hosts
setBandwidthPercentForMigration
void setBandwidthPercentForMigration(double bandwidthPercentForMigration)Sets the percentage of the bandwidth allocated to a Host to migrate VMs. It’s a value between [0 and 1] (where1 is 100%). The default value is 0.5, meaning only 50% of the bandwidth will be allowed for migration, whilethe remaining will be used for VM services.
Parameters
• bandwidthPercentForMigration – the bandwidth migration percentage to set
setSchedulingInterval
Datacenter setSchedulingInterval(double schedulingInterval)Sets the scheduling delay to process each event received by the Datacenter (in seconds).
Parameters
• schedulingInterval – the new scheduling interval (in seconds)
See also: .getSchedulingInterval()
setStorageList
Datacenter setStorageList(List<FileStorage> storageList)Sets the list of storage devices of the Datacenter.
Parameters
• storageList – the new storage list
1.8.2 DatacenterCharacteristics
public interface DatacenterCharacteristics extends IdentificableAn interface to be implemented by each class that represents the physical characteristics of a Datacenter.
Author Manzur Murshed, Rajkumar Buyya, Rodrigo N. Calheiros, Anton Beloglazov, Manoel Cam-pos da Silva Filho
150 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Fields
DEFAULT_ARCH
String DEFAULT_ARCHThe default architecture of Datacenter Hosts to be used if not one is set.
DEFAULT_OS
String DEFAULT_OSThe default Operating System of Datacenter Hosts to be used if not one is set.
DEFAULT_TIMEZONE
double DEFAULT_TIMEZONEThe default Datacenter’s Time Zone to be used if not one is set.
DEFAULT_VMM
String DEFAULT_VMMThe default Virtual Machine Monitor to be used if not one is set.
NULL
DatacenterCharacteristics NULLAn attribute that implements the Null Object Design Pattern for Datacenter objects.
Methods
getArchitecture
String getArchitecture()Gets the architecture of the Datacenter.
Returns the architecture
getCostPerBw
double getCostPerBw()Get the cost to use each each Megabit of bandwidth in the Datacenter.
Returns the cost to use bw
1.8. org.cloudbus.cloudsim.datacenters 151
CloudSim Plus Documentation, Release 1.0.0
getCostPerMem
double getCostPerMem()Get the cost to use each Megabyte of RAM in the Datacenter.
Returns the cost to use RAM
getCostPerSecond
double getCostPerSecond()Gets the cost per second of CPU for using the Hosts in the Datacenter.
Returns the cost per second
getCostPerStorage
double getCostPerStorage()Get the cost to use each Megabyte of storage in the Datacenter.
Returns the cost to use storage
getDatacenter
Datacenter getDatacenter()Gets the Datacenter that owns these characteristics
Returns the Datacenter
getId
int getId()Gets the Datacenter id.
Returns the id
getMips
double getMips()Gets the total MIPS rating, which is the sum of MIPS rating of all Hosts in the Datacenter.
Returns the sum of MIPS ratings
getNumberOfFailedHosts
long getNumberOfFailedHosts()Gets the current number of failed PMs.
Returns current number of failed PMs the Datacenter has.
152 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNumberOfFreePes
int getNumberOfFreePes()Gets the total number of FREE or non-busy PEs for all PMs.
Returns number of PEs
getNumberOfPes
int getNumberOfPes()Gets the total number of PEs for all PMs.
Returns number of PEs
getOs
String getOs()Gets the Operating System (OS) used by the Hosts in the Datacenter.
Returns the Operating System (OS)
getTimeZone
double getTimeZone()Gets the time zone, a value between [-12 and 13], in which the Datacenter is physically located.
Returns the time zone
getVmm
String getVmm()Gets the Virtual Machine Monitor (VMM), also called hypervisor, used in the Datacenter.
Returns the VMM name
isWorking
boolean isWorking()Checks whether all PMs of the Datacenter are working properly or not.
Returns if all PMs are working, otherwise
setArchitecture
DatacenterCharacteristics setArchitecture(String architecture)Sets the architecture.
Parameters
• architecture – the new architecture
1.8. org.cloudbus.cloudsim.datacenters 153
CloudSim Plus Documentation, Release 1.0.0
setCostPerBw
DatacenterCharacteristics setCostPerBw(double costPerBw)Sets cost to use each Megabit of bandwidth.
Parameters
• costPerBw – the cost to set
setCostPerMem
DatacenterCharacteristics setCostPerMem(double costPerMem)Sets the cost to use each Megabyte of RAM in the Datacenter.
Parameters
• costPerMem – cost to use RAM
setCostPerSecond
DatacenterCharacteristics setCostPerSecond(double costPerSecond)Sets the cost per second of CPU.
Parameters
• costPerSecond – the new cost per second
setCostPerStorage
DatacenterCharacteristics setCostPerStorage(double costPerStorage)Sets cost to use each Megabyte of storage.
Parameters
• costPerStorage – cost to use storage
setOs
DatacenterCharacteristics setOs(String os)Sets the Operating System (OS).
Parameters
• os – the new Operating System (OS)
setTimeZone
DatacenterCharacteristics setTimeZone(double timeZone)Sets the time zone. If an invalid value is given, the timezone is set to 0.
Parameters
• timeZone – the new time zone value, between [-12 and 13].
154 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setVmm
DatacenterCharacteristics setVmm(String vmm)Sets the vmm.
Parameters
• vmm – the new vmm
1.8.3 DatacenterCharacteristicsNull
final class DatacenterCharacteristicsNull implements DatacenterCharacteristicsA class that implements the Null Object Design Pattern for Datacenter class.
Author Manoel Campos da Silva Filho
See also: DatacenterCharacteristics.NULL
Methods
getArchitecture
public String getArchitecture()
getCostPerBw
public double getCostPerBw()
getCostPerMem
public double getCostPerMem()
getCostPerSecond
public double getCostPerSecond()
getCostPerStorage
public double getCostPerStorage()
getDatacenter
public Datacenter getDatacenter()
getId
public int getId()
1.8. org.cloudbus.cloudsim.datacenters 155
CloudSim Plus Documentation, Release 1.0.0
getMips
public double getMips()
getNumberOfFailedHosts
public long getNumberOfFailedHosts()
getNumberOfFreePes
public int getNumberOfFreePes()
getNumberOfPes
public int getNumberOfPes()
getOs
public String getOs()
getTimeZone
public double getTimeZone()
getVmm
public String getVmm()
isWorking
public boolean isWorking()
setArchitecture
public DatacenterCharacteristics setArchitecture(String a)
setCostPerBw
public DatacenterCharacteristics setCostPerBw(double c)
setCostPerMem
public DatacenterCharacteristics setCostPerMem(double c)
156 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setCostPerSecond
public DatacenterCharacteristics setCostPerSecond(double c)
setCostPerStorage
public DatacenterCharacteristics setCostPerStorage(double c)
setOs
public DatacenterCharacteristics setOs(String os)
setTimeZone
public DatacenterCharacteristics setTimeZone(double timeZone)
setVmm
public DatacenterCharacteristics setVmm(String vmm)
1.8.4 DatacenterCharacteristicsSimple
public class DatacenterCharacteristicsSimple implements DatacenterCharacteristicsRepresents static properties of a Datacenter such as architecture, Operating System (OS), management policy(time- or space-shared), cost and time zone at which the resource is located along resource configuration. EachDatacenter has to have its own instance of this class, since it stores the Datacenter host list.
Author Manzur Murshed, Rajkumar Buyya, Rodrigo N. Calheiros, Anton Beloglazov
Constructors
DatacenterCharacteristicsSimple
public DatacenterCharacteristicsSimple(Datacenter datacenter)Creates a DatacenterCharacteristics with default values for architecture, OS, Time Zone and VMM . Thecosts for BW , getCostPerMem() () RAM and getCostPerStorage() () Storage are set to zero.
Methods
getArchitecture
public String getArchitecture()
getCostPerBw
public double getCostPerBw()
1.8. org.cloudbus.cloudsim.datacenters 157
CloudSim Plus Documentation, Release 1.0.0
getCostPerMem
public double getCostPerMem()
getCostPerSecond
public double getCostPerSecond()
getCostPerStorage
public double getCostPerStorage()
getDatacenter
public Datacenter getDatacenter()
getId
public int getId()Gets the Datacenter id, setup when Datacenter is created.
getMips
public double getMips()
getNumberOfFailedHosts
public long getNumberOfFailedHosts()
getNumberOfFreePes
public int getNumberOfFreePes()
getNumberOfPes
public int getNumberOfPes()
getOs
public String getOs()
getTimeZone
public double getTimeZone()
158 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getVmm
public String getVmm()
isWorking
public boolean isWorking()
setArchitecture
public final DatacenterCharacteristics setArchitecture(String architecture)
setCostPerBw
public final DatacenterCharacteristics setCostPerBw(double costPerBw)
setCostPerMem
public final DatacenterCharacteristics setCostPerMem(double costPerMem)
setCostPerSecond
public final DatacenterCharacteristics setCostPerSecond(double costPerSecond)
setCostPerStorage
public final DatacenterCharacteristics setCostPerStorage(double costPerStorage)
setOs
public final DatacenterCharacteristics setOs(String os)
setTimeZone
public final DatacenterCharacteristics setTimeZone(double timeZone)
setVmm
public final DatacenterCharacteristics setVmm(String vmm)
1.8. org.cloudbus.cloudsim.datacenters 159
CloudSim Plus Documentation, Release 1.0.0
1.8.5 DatacenterNull
final class DatacenterNull implements DatacenterA class that implements the Null Object Design Pattern for Datacenter class.
Author Manoel Campos da Silva Filho
See also: Datacenter.NULL
Methods
addFile
public int addFile(File file)
addHost
public Datacenter addHost(Host host)
addHostList
public <T extends Host> Datacenter addHostList(List<T> hostList)
compareTo
public int compareTo(SimEntity o)
getBandwidthPercentForMigration
public double getBandwidthPercentForMigration()
getCharacteristics
public DatacenterCharacteristics getCharacteristics()
getHost
public Host getHost(int index)
getHostList
public List<Host> getHostList()
getId
public int getId()
160 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getName
public String getName()
getPower
public double getPower()
getPowerInKWattsHour
public double getPowerInKWattsHour()
getSchedulingInterval
public double getSchedulingInterval()
getSimulation
public Simulation getSimulation()
getStorageList
public List<FileStorage> getStorageList()
getVmAllocationPolicy
public VmAllocationPolicy getVmAllocationPolicy()
getVmList
public List<Vm> getVmList()
isStarted
public boolean isStarted()
println
public void println(String msg)
processEvent
public void processEvent(SimEvent ev)
1.8. org.cloudbus.cloudsim.datacenters 161
CloudSim Plus Documentation, Release 1.0.0
run
public void run()
schedule
public void schedule(SimEntity dest, double delay, int tag)
setBandwidthPercentForMigration
public void setBandwidthPercentForMigration(double bandwidthPercentForMigration)
setLog
public void setLog(boolean log)
setName
public SimEntity setName(String newName)
setSchedulingInterval
public Datacenter setSchedulingInterval(double schedulingInterval)
setSimulation
public SimEntity setSimulation(Simulation simulation)
setState
public SimEntity setState(State state)
setStorageList
public Datacenter setStorageList(List<FileStorage> storageList)
shutdownEntity
public void shutdownEntity()
start
public void start()
162 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
toString
public String toString()
1.8.6 DatacenterSimple
public class DatacenterSimple extends CloudSimEntity implements DatacenterImplements the basic features of a Virtualized Cloud Datacenter. It deals with processing of VM queries (i.e.,handling of VMs) instead of processing Cloudlet-related queries.
Author Rodrigo N. Calheiros, Anton Beloglazov
Constructors
DatacenterSimple
public DatacenterSimple(Simulation simulation, List<? extends Host> hostList, VmAllocationPolicyvmAllocationPolicy)
Creates a Datacenter.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
• hostList – list of Hosts that will compound the Datacenter
• vmAllocationPolicy – the policy to be used to allocate VMs into hosts
Throws
• IllegalArgumentException – when this entity has zero number of PEs (Process-ing Elements). No PEs mean the Cloudlets can’t be processed. A CloudResource mustcontain one or more Machines. A Machine must contain one or more PEs.
Methods
addFile
public int addFile(File file)
addHost
public <T extends Host> Datacenter addHost(T host)
addHostList
public <T extends Host> Datacenter addHostList(List<T> hostList)
1.8. org.cloudbus.cloudsim.datacenters 163
CloudSim Plus Documentation, Release 1.0.0
checkCloudletsCompletionForAllHosts
protected void checkCloudletsCompletionForAllHosts()Verifies if some cloudlet inside the hosts of this Datacenter have already finished. If yes, send them to theUser/Broker
contains
protected boolean contains(File file)Checks whether the Datacenter has the given file.
Parameters
• file – a file to be searched
Returns true if successful, false otherwise
contains
protected boolean contains(String fileName)Checks whether the Datacenter has the given file.
Parameters
• fileName – a file name to be searched
Returns true if successful, false otherwise
disableMigrations
public final Datacenter disableMigrations()Disable VM migrations.
enableMigrations
public final Datacenter enableMigrations()Enable VM migrations.
equals
public boolean equals(Object o)
finishVmMigration
protected void finishVmMigration(SimEvent ev, boolean ack)Finishes the process of migrating a VM.
Parameters
• ev – information about the event just happened
164 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• ack – indicates if the event’s sender expects to receive an acknowledge message when theevent finishes to be processed
getBandwidthPercentForMigration
public double getBandwidthPercentForMigration()
getCharacteristics
public DatacenterCharacteristics getCharacteristics()
getCloudletProcessingUpdateInterval
protected double getCloudletProcessingUpdateInterval(double nextFinishingCloudletTime)Gets the time when the next update of cloudlets has to be performed. This is the minimum value between thegetSchedulingInterval() and the given time (if the scheduling interval is enable, i.e. if it’s greater than0), which represents when the next update of Cloudlets processing has to be performed.
Parameters
• nextFinishingCloudletTime – the predicted completion time of the earliest fin-ishing cloudlet (which is a relative delay from the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet to execute
Returns next time cloudlets processing will be updated
See also: .updateCloudletProcessing()
getHost
public Host getHost(int index)
getHostList
public <T extends Host> List<T> getHostList()
getLastProcessTime
protected double getLastProcessTime()Gets the last time some cloudlet was processed in the Datacenter.
Returns the last process time
getPower
public double getPower()
1.8. org.cloudbus.cloudsim.datacenters 165
CloudSim Plus Documentation, Release 1.0.0
getSchedulingInterval
public double getSchedulingInterval()
getStorageList
public List<FileStorage> getStorageList()
getVmAllocationPolicy
public VmAllocationPolicy getVmAllocationPolicy()
getVmList
public <T extends Vm> List<T> getVmList()
hashCode
public int hashCode()
isMigrationsEnabled
public boolean isMigrationsEnabled()Checks if migrations are enabled.
Returns true, if migrations are enable; false otherwise
predictFileTransferTime
protected double predictFileTransferTime(List<String> requiredFiles)Predict the total time to transfer a list of files.
Parameters
• requiredFiles – the files to be transferred
Returns the predicted time
processCloudlet
protected void processCloudlet(SimEvent ev, int type)Processes a Cloudlet based on the event type.
Parameters
• ev – information about the event just happened
• type – event type
166 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processCloudletCancel
protected void processCloudletCancel(Cloudlet cloudlet)Processes a Cloudlet cancel request.
Parameters
• cloudlet – cloudlet to be canceled
processCloudletPause
protected void processCloudletPause(Cloudlet cloudlet, boolean ack)Processes a Cloudlet pause request.
Parameters
• cloudlet – cloudlet to be paused
• ack – indicates if the event’s sender expects to receive an acknowledge message when theevent finishes to be processed
processCloudletResume
protected void processCloudletResume(Cloudlet cloudlet, boolean ack)Processes a Cloudlet resume request.
Parameters
• cloudlet – cloudlet to be resumed
• ack – indicates if the event’s sender expects to receive an acknowledge message when theevent finishes to be processed
processCloudletSubmit
protected void processCloudletSubmit(SimEvent ev, boolean ack)Processes the submission of a Cloudlet by a DatacenterBroker.
Parameters
• ev – information about the event just happened
• ack – indicates if the event’s sender expects to receive an acknowledge message when theevent finishes to be processed
processEvent
public void processEvent(SimEvent ev)
processPingRequest
protected void processPingRequest(SimEvent ev)Processes a ping request.
Parameters
1.8. org.cloudbus.cloudsim.datacenters 167
CloudSim Plus Documentation, Release 1.0.0
• ev – information about the event just happened
processVmCreate
protected boolean processVmCreate(SimEvent ev, boolean ackRequested)Process the event for a Broker which wants to create a VM in this Datacenter. This Datacenter will then sendthe status back to the Broker.
Parameters
• ev – information about the event just happened
• ackRequested – indicates if the event’s sender expects to receive an acknowledge mes-sage when the event finishes to be processed
Returns true if a host was allocated to the VM; false otherwise
processVmDestroy
protected void processVmDestroy(SimEvent ev, boolean ack)Process the event sent by a Broker, requesting the destruction of a given VM created in this Datacenter. ThisDatacenter may send, upon request, the status back to the Broker.
Parameters
• ev – information about the event just happened
• ack – indicates if the event’s sender expects to receive an acknowledge message when theevent finishes to be processed
setBandwidthPercentForMigration
public void setBandwidthPercentForMigration(double bandwidthPercentForMigration)
setLastProcessTime
protected final void setLastProcessTime(double lastProcessTime)Sets the last time some cloudlet was processed in the Datacenter.
Parameters
• lastProcessTime – the new last process time
setSchedulingInterval
public final Datacenter setSchedulingInterval(double schedulingInterval)
setStorageList
public final Datacenter setStorageList(List<FileStorage> storageList)Sets the list of storage devices of the Datacenter.
Parameters
168 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• storageList – the new storage list
setVmAllocationPolicy
public final Datacenter setVmAllocationPolicy(VmAllocationPolicy vmAllocationPolicy)Sets the policy to be used by the Datacenter to allocate VMs into hosts.
Parameters
• vmAllocationPolicy – the new vm allocation policy
shutdownEntity
public void shutdownEntity()
startEntity
protected void startEntity()
toString
public String toString()
updateCloudletProcessing
protected double updateCloudletProcessing()Updates processing of each Host, that fires the update of VMs, which in turn updates cloudlets running in thisDatacenter. After that, the method schedules the next processing update. It is necessary because Hosts and VMsare simple objects, not entities. So, they don’t receive events and updating cloudlets inside them must be calledfrom the outside.
Returns the predicted completion time of the earliest finishing cloudlet (which is a relative delayfrom the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet toexecute or it isn’t time to update the cloudlets
1.9 org.cloudbus.cloudsim.datacenters.network
Provides network-enabled org.cloudbus.cloudsim.datacenters.Datacenter implementations. Formore general information, see the package org.cloudbus.cloudsim.datacenters at the upper level.
author Manoel Campos da Silva Filho
1.9.1 NetworkDatacenter
public class NetworkDatacenter extends DatacenterSimpleNetworkDatacenter class is a Datacenter whose hostList are virtualized and networked. It contains all theinformation about internal network. For example, which VM is connected to what switch, etc.
Please refer to following publication for more details:
1.9. org.cloudbus.cloudsim.datacenters.network 169
CloudSim Plus Documentation, Release 1.0.0
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
NetworkDatacenter
public NetworkDatacenter(Simulation simulation, List<? extends Host> hostList, VmAllocationPolicyvmAllocationPolicy)
Creates a NetworkDatacenter with the given parameters.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
• hostList – list of Hosts that will compound the Datacenter
• vmAllocationPolicy – the policy to be used to allocate VMs into hosts
Throws
• IllegalArgumentException – when this entity has zero number of PEs (Process-ing Elements). No PEs mean the Cloudlets can’t be processed. A CloudResource mustcontain one or more Machines. A Machine must contain one or more PEs.
Methods
addSwitch
public void addSwitch(Switch sw)Adds a AbstractSwitch to the Datacenter.
Parameters
• sw – the AbstractSwitch to be added
getEdgeSwitch
public List<Switch> getEdgeSwitch()Gets a map of all Edge Switches in the Datacenter network, where each key is the switch id and each value isthe switch itself. One can design similar functions for other type of Datacenter.
getSwitchMap
public List<Switch> getSwitchMap()Gets a read-only list of network Datacenter’s Switches.
170 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processCloudletSubmit
protected void processCloudletSubmit(SimEvent ev, boolean ack)
processVmCreate
protected boolean processVmCreate(SimEvent ev, boolean ackRequested)
1.10 org.cloudbus.cloudsim.distributions
Provides Pseudo Random Number Generators (PRNG) following several statistical distributions used by the simulationAPI. Additionally, they can be used by developers implementing their own simulations.
The most basic PRNG is the org.cloudbus.cloudsim.distributions.UniformDistr that generatesuniformly distributed pseudo random numbers.
1.10.1 ContinuousDistribution
public interface ContinuousDistributionInterface to be implemented by a pseudo random number generator (PRNG) that follows a defined statisticalcontinuous distribution.
Author Marcos Dias de Assuncao
Fields
NULL
ContinuousDistribution NULLAn attribute that implements the Null Object Design Pattern for ContinuousDistribution objects.
Methods
getSeed
long getSeed()
Returns the seed used to initialize the generator
sample
double sample()Generate a new pseudo random number.
Returns the next pseudo random number in the sequence, following the implemented distribution.
1.10. org.cloudbus.cloudsim.distributions 171
CloudSim Plus Documentation, Release 1.0.0
1.10.2 ContinuousDistributionAbstract
public abstract class ContinuousDistributionAbstract implements ContinuousDistributionAn base class for implementation of ContinuousDistributions.
Author Manoel Campos da Silva Filho
Constructors
ContinuousDistributionAbstract
protected ContinuousDistributionAbstract(RealDistribution numGen)Creates a new continuous random number generator using the current time as seed.
Parameters
• numGen – the actual random number generator that will be the base to generate randomnumbers following a continuous distribution.
ContinuousDistributionAbstract
protected ContinuousDistributionAbstract(RealDistribution numGen, long seed)Creates a new continuous random number generator.
Parameters
• numGen – the actual random number generator that will be the base to generate randomnumbers following a continuous distribution.
• seed – the seed to initialize the random number generator. If it is passed -1, the currenttime will be used
Methods
getSeed
public final long getSeed()
sample
public double sample()
setSeed
protected final void setSeed(long seed)
1.10.3 ContinuousDistributionNull
final class ContinuousDistributionNull implements ContinuousDistributionA class that implements the Null Object Design Pattern for ContinuousDistribution class.
172 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Author Manoel Campos da Silva Filho
See also: ContinuousDistribution.NULL
Methods
getSeed
public long getSeed()
sample
public double sample()
1.10.4 ExponentialDistr
public class ExponentialDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Exponential distribution.
Author Marcos Dias de Assuncao
Constructors
ExponentialDistr
public ExponentialDistr(long seed, double mean)Creates a new exponential pseudo random number generator.
Parameters
• seed – the seed to be used.
• mean – the mean for the distribution.
ExponentialDistr
public ExponentialDistr(double mean)Creates a new exponential pseudo random number generator.
Parameters
• mean – the mean for the distribution.
1.10.5 GammaDistr
public class GammaDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Gamma distribution.
Author Marcos Dias de Assuncao
1.10. org.cloudbus.cloudsim.distributions 173
CloudSim Plus Documentation, Release 1.0.0
Constructors
GammaDistr
public GammaDistr(long seed, int shape, double scale)Instantiates a new Gamma pseudo random number generator.
Parameters
• seed – the seed
• shape – the shape
• scale – the scale
GammaDistr
public GammaDistr(int shape, double scale)Instantiates a new Gamma pseudo random number generator.
Parameters
• shape – the shape
• scale – the scale
1.10.6 LognormalDistr
public class LognormalDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Lognormal distribution.
Author Marcos Dias de Assuncao
Constructors
LognormalDistr
public LognormalDistr(long seed, double shape, double scale)Instantiates a new Log-normal pseudo random number generator.
Parameters
• seed – the seed
• shape – the shape
• scale – the scale
LognormalDistr
public LognormalDistr(double shape, double scale)Instantiates a new Log-normal pseudo random number generator.
Parameters
• shape – the shape
174 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• scale – the scale
1.10.7 LomaxDistr
public class LomaxDistr extends ParetoDistrA pseudo random number generator following the Lomax distribution.
Author Marcos Dias de Assuncao
Constructors
LomaxDistr
public LomaxDistr(double shape, double location, double shift)Instantiates a new lomax pseudo random number generator.
Parameters
• shape – the shape
• location – the location
• shift – the shift
LomaxDistr
public LomaxDistr(long seed, double shape, double location, double shift)Instantiates a new lomax pseudo random number generator.
Parameters
• seed – the seed
• shape – the shape
• location – the location
• shift – the shift
Methods
sample
public double sample()
1.10.8 NormalDistr
public class NormalDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Normal (Gaussian) distribution.
Author Manoel Campos da Silva Filho
1.10. org.cloudbus.cloudsim.distributions 175
CloudSim Plus Documentation, Release 1.0.0
Constructors
NormalDistr
public NormalDistr(long seed, double mean, double standardDeviation)Creates a new normal (Gaussian) pseudo random number generator.
Parameters
• seed – the seed to be used.
• mean – the mean for the distribution.
• standardDeviation – the standard deviation for the distribution.
NormalDistr
public NormalDistr(double mean, double standardDeviation)Creates a new normal (Gaussian) pseudo random number generator.
Parameters
• mean – the mean for the distribution.
• standardDeviation – the standard deviation for the distribution.
1.10.9 ParetoDistr
public class ParetoDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Pareto distribution.
Author Marcos Dias de Assuncao
Constructors
ParetoDistr
public ParetoDistr(long seed, double shape, double location)Instantiates a new Pareto pseudo random number generator.
Parameters
• seed – the seed
• shape – the shape
• location – the location
ParetoDistr
public ParetoDistr(double shape, double location)Instantiates a new Pareto pseudo random number generator.
Parameters
• shape – the shape
176 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• location – the location
1.10.10 PoissonDistr
public class PoissonDistr implements ContinuousDistributionA pseudo random number generator which returns numbers following a Poisson Distribution, modeling theprobability of an event to happen a number of times in a given time interval.
Author Manoel Campos da Silva Filho
See also: Poisson Distribution, Poisson Point Process
Constructors
PoissonDistr
public PoissonDistr(double lambda, long seed)Creates a new Poisson random number generator to check the probability of 1 event (k) to happen at each timeinterval.
Parameters
• lambda – the average number of events that happen at each 1 time unit. If one considersthe unit as minute, this value means the average number of arrivals at each minute.
• seed – the seed to initialize the uniform random number generator
See also: .setK(int), .setLambda(double)
PoissonDistr
public PoissonDistr(double lambda)Creates a new Poisson process that considers you want to check the probability of 1 event (k) to happen at eachtime.
Parameters
• lambda – average number of events by interval. For instance, if it was defined 1 event tobe expected at each 2.5 minutes, it means that 0.4 event is expected at each minute (1/2.5).
See also: .setK(int)
Methods
eventsArrivalProbability
public double eventsArrivalProbability()Gets the probability to arrive K events in the current time, considering the expected average arrival timelambda. It computes the Probability Mass Function (PMF) of the Poisson distribution.
See also: Poisson distribution
1.10. org.cloudbus.cloudsim.distributions 177
CloudSim Plus Documentation, Release 1.0.0
eventsHappened
public boolean eventsHappened()Checks if at the current time, K events have happened, considering the probability of these Kevents to happen in a time interval.
Returns true if the K events have happened at current time, false otherwise
getInterarrivalMeanTime
public double getInterarrivalMeanTime()Gets the mean time between arrival of two events, which is the inverse of lambda. The time unit (if seconds,minutes, hours, etc) is the same considered when setting a value to the lambda parameter.
getK
public int getK()Gets the number of events to check the probability for them to happen in a time interval (default 1).
getLambda
public double getLambda()Gets the average number of events that are expected to happen at each 1 time unit. It is the expected number ofevents to happen each time, also called the event rate or rate parameter.
If the unit is minute, this value means the average number of arrivals at each minute. It’s the inverse of thegetInterarrivalMeanTime().
getSeed
public long getSeed()
main
public static void main(String[] args)Tests the simulations of customers arrivals in a Poisson process. All the code inside this method is just to try theclass. That is way it declares internal methods as Functional objects, instead of declaring such methods at theclass level and just calling them.
Parameters
• args –
sample
public double sample()Gets a random number that represents the next time for an event to happen, considering the events arrivalrate (lambda).
178 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setK
public void setK(int k)Sets the number of events to check the probability to happen in a time time.
Parameters
• k – the value to set
1.10.11 UniformDistr
public class UniformDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Uniform continuous distribution.
Author Marcos Dias de Assuncao
Constructors
UniformDistr
public UniformDistr()Creates new uniform pseudo random number generator that generates values between [0 and 1[ using the currenttime as seed.
UniformDistr
public UniformDistr(long seed)Creates new uniform pseudo random number generator that generates values between [0 and 1[ using a givenseed.
Parameters
• seed – simulation seed to be used
UniformDistr
public UniformDistr(double max)Creates new uniform pseudo random number generator that produces values between a 0 (inclusive) and max(exclusive).
Parameters
• max – maximum value (exclusive)
UniformDistr
public UniformDistr(double min, double max)Creates new uniform pseudo random number generator that produces values between a min (inclusive) and max(exclusive).
Parameters
• min – minimum value (inclusive)
1.10. org.cloudbus.cloudsim.distributions 179
CloudSim Plus Documentation, Release 1.0.0
• max – maximum value (exclusive)
UniformDistr
public UniformDistr(double min, double max, long seed)Creates new uniform pseudo random number generator.
Parameters
• min – minimum value (inclusive)
• max – maximum value (exclusive)
• seed – simulation seed to be used
Methods
isApplyAntitheticVariatesTechnique
public boolean isApplyAntitheticVariatesTechnique()Indicates if the pseudo random number generator (PRNG) has to apply the “Antithetic Variates Technique”in order to reduce variance of experiments using this PRNG. This technique doesn’t work for all the cases.However, in the cases it can be applied, in order to it work, one have to perform some actions. Consider anexperiment that has to run “n” times. The first half of these experiments has to use the seeds the developer want.However, the second half of the experiments have to set the applyAntitheticVariatesTechnique attribute to trueand use the seeds of the first half of experiments. Thus, the first half of experiments are run using PRNGs thatreturn random numbers as U(0, 1)[seed_1], . . . , U(0, 1)[seed_n]. The second half of experiments then uses theseeds of the first half of experiments, returning random numbers as 1 - U(0, 1)[seed_1], . . . , 1 - U(0, 1)[seed_n].
Returns true if the technique has to be applied, false otherwise
See also: Antithetic variates
sample
public double sample()
sample
public static double sample(Random rd, double min, double max)Generates a new pseudo random number based on the generator and values provided as parameters.
Parameters
• rd – the random number generator
• min – the minimum value
• max – the maximum value
Returns the next random number in the sequence
180 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setApplyAntitheticVariatesTechnique
public UniformDistr setApplyAntitheticVariatesTechnique(boolean applyAntitheticVariat-esTechnique)
Defines if the pseudo random number generator (PRNG) has to apply the “Antithetic Variates Technique” inorder to reduce variance of experiments using this PRNG.
Parameters
• applyAntitheticVariatesTechnique – true if the technique has to be applied,false otherwise
See also: .isApplyAntitheticVariatesTechnique()
1.10.12 WeibullDistr
public class WeibullDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Weibull distribution.
Author Marcos Dias de Assuncao
Constructors
WeibullDistr
public WeibullDistr(long seed, double alpha, double beta)Instantiates a new Weibull pseudo random number generator.
Parameters
• seed – the seed
• alpha – the alpha
• beta – the beta
WeibullDistr
public WeibullDistr(double alpha, double beta)Instantiates a new Weibull pseudo random number generator.
Parameters
• alpha – the alpha
• beta – the beta
1.10.13 ZipfDistr
public class ZipfDistr extends ContinuousDistributionAbstractA pseudo random number generator following the Zipf distribution.
Author Marcos Dias de Assuncao
1.10. org.cloudbus.cloudsim.distributions 181
CloudSim Plus Documentation, Release 1.0.0
Constructors
ZipfDistr
public ZipfDistr(long seed, double shape, int population)Instantiates a new Zipf pseudo random number generator.
Parameters
• seed – the seed
• shape – the shape
• population – the population
ZipfDistr
public ZipfDistr(double shape, int population)Instantiates a new Zipf pseudo random number generator.
Parameters
• shape – the shape
• population – the population
Methods
sample
public double sample()
1.11 org.cloudbus.cloudsim.hosts
Provides org.cloudbus.cloudsim.hosts.Host implementations that represent a Physical Machine (PM)is used to run org.cloudbus.cloudsim.vms.Vm from different cloud customers (represented by a org.cloudbus.cloudsim.brokers.DatacenterBroker).
As each Host can run several VMs, the scheduling of such VMs on the Host’s CPU cores (org.cloudbus.cloudsim.resources.Pe) is defined by a org.cloudbus.cloudsim.schedulers.vm.VmScheduler.
The most basic Host is the org.cloudbus.cloudsim.hosts.HostSimple.
Specific Host implementations can be power- or network-aware, enabling the simulation of power consumption andnetwork communication. For more information see org.cloudbus.cloudsim.datacenters package docu-mentation.
author Manoel Campos da Silva Filho
182 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.11.1 Host
public interface Host extends Machine, Comparable<Host>An interface to be implemented by each class that provides Physical Machines (Hosts) features. The interfaceimplements the Null Object Design Pattern in order to start avoiding NullPointerException when usingthe Host.NULL object instead of attributing null to Host variables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
Host NULLAn attribute that implements the Null Object Design Pattern for Host objects.
Methods
addMigratingInVm
boolean addMigratingInVm(Vm vm)Try to add a VM migrating into the current host if there is enough resources for it. In this case, the resources areallocated and the VM added to the getVmsMigratingIn() List. Otherwise, the VM is not added.
Parameters
• vm – the vm
Returns true if the Vm was migrated in, false if the Host doesn’t have enough resources to place theVm
addOnUpdateProcessingListener
Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> lis-tener)
Adds a listener object that will be notified every time when the host updates the processing of all its VMs.
Parameters
• listener – the OnUpdateProcessingListener to add
See also: .updateProcessing(double)
addVmMigratingOut
boolean addVmMigratingOut(Vm vm)Adds a Vm to the list of VMs migrating out from the Host.
Parameters
• vm – the vm to be added
Returns true if the VM wasn’t into the list and was added, false otherwise
1.11. org.cloudbus.cloudsim.hosts 183
CloudSim Plus Documentation, Release 1.0.0
createTemporaryVm
boolean createTemporaryVm(Vm vm)Try to allocate resources to a new temporary VM in the Host. The method is used only to book resources for agiven VM. For instance, if is being chosen Hosts to migrate a set of VMs, when a Host is selected for a givenVM, using this method, the resources are reserved and then, when the next VM is selected for the same Host,the reserved resources already were reduced from the available amount. This way, it it was possible to place justone Vm into that Host, with the booking, no other VM will be selected to that Host.
Parameters
• vm – Vm being started
Returns $true if the VM could be started in the host; $false otherwise
createVm
boolean createVm(Vm vm)Try to allocate resources to a new VM in the Host.
Parameters
• vm – Vm being started
Returns $true if the VM could be started in the host; $false otherwise
deallocatePesForVm
void deallocatePesForVm(Vm vm)Releases PEs allocated to a VM.
Parameters
• vm – the vm
destroyAllVms
void destroyAllVms()Destroys all VMs running in the host and remove them from the getVmList().
destroyTemporaryVm
void destroyTemporaryVm(Vm vm)Destroys a temporary VM created into the Host to book resources.
Parameters
• vm – the VM
See also: .createTemporaryVm(Vm)
184 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
destroyVm
void destroyVm(Vm vm)Destroys a VM running in the host and removes it from the getVmList().
Parameters
• vm – the VM
disableStateHistory
void disableStateHistory()Disable storing Host state history.
See also: .getStateHistory()
enableStateHistory
void enableStateHistory()Enables storing Host state history.
See also: .getStateHistory()
getAllocatedMipsForVm
List<Double> getAllocatedMipsForVm(Vm vm)Gets the MIPS share of each Pe that is allocated to a given VM.
Parameters
• vm – the vm
Returns an array containing the amount of MIPS of each pe that is available to the VM
getAvailableMips
double getAvailableMips()Gets the current amount of available MIPS at the host.
Returns the available amount of MIPS
getAvailableStorage
long getAvailableStorage()Gets the total free storage available at the host in Megabytes.
Returns the free storage
1.11. org.cloudbus.cloudsim.hosts 185
CloudSim Plus Documentation, Release 1.0.0
getBuzyPeList
List<Pe> getBuzyPeList()Gets the list of working Processing Elements (PEs) of the host, which excludes failed PEs.
Returns the list working (non-failed) Host PEs
getBwProvisioner
ResourceProvisioner getBwProvisioner()Gets the bandwidth (BW) provisioner with capacity in Megabits/s.
Returns the bw provisioner
getDatacenter
Datacenter getDatacenter()Gets the Datacenter where the host is placed.
Returns the data center of the host
getFinishedVms
List<Vm> getFinishedVms()Gets the List of VMs that have finished executing.
getFreePeList
List<Pe> getFreePeList()Gets the list of Free Processing Elements (PEs) of the host, which excludes failed PEs.
Returns the list free (non-failed) Host PEs
getMaxAvailableMips
double getMaxAvailableMips()Returns the maximum available MIPS among all the PEs of the host.
Returns max mips
getNumberOfFailedPes
long getNumberOfFailedPes()Gets the number of PEs that have failed.
Returns the number of failed pes
186 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNumberOfFreePes
int getNumberOfFreePes()Gets the free pes number.
Returns the free pes number
getNumberOfWorkingPes
long getNumberOfWorkingPes()Gets the number of PEs that are working. That is, the number of PEs that aren’t FAIL.
Returns the number of working pes
getPeList
List<Pe> getPeList()Gets the list of all Processing Elements (PEs) of the host, including failed PEs.
Returns the list of all Host PEs
See also: .getWorkingPeList()
getPowerModel
PowerModel getPowerModel()Gets the PowerModel used by the host to define how it consumes power. A Host just provides power usagedata if a PowerModel is set.
Returns the Host’s PowerModel
getPreviousUtilizationOfCpu
double getPreviousUtilizationOfCpu()
getProvisioner
ResourceProvisioner getProvisioner(Class<? extends ResourceManageable> resourceClass)Gets the ResourceProvisioners that manages a Host resource such as Ram, Bandwidth and Pe.
Parameters
• resourceClass – the class of the resource to get its provisioner
Returns the ResourceProvisioner for the given resource class
getRamProvisioner
ResourceProvisioner getRamProvisioner()Gets the ram provisioner with capacity in Megabytes.
Returns the ram provisioner
1.11. org.cloudbus.cloudsim.hosts 187
CloudSim Plus Documentation, Release 1.0.0
getStateHistory
List<HostStateHistoryEntry> getStateHistory()Gets a read-only host state history. This List is just populated if isStateHistoryEnabled()
Returns the state history
See also: .enableStateHistory()
getTotalAllocatedMipsForVm
double getTotalAllocatedMipsForVm(Vm vm)Gets the total allocated MIPS for a VM along all its PEs.
Parameters
• vm – the vm
Returns the allocated mips for vm
getTotalMipsCapacity
double getTotalMipsCapacity()Gets total MIPS capacity of PEs which are not Status.FAILED.
Returns the total MIPS of working PEs
getUtilizationHistory
double[] getUtilizationHistory()Gets the host CPU utilization percentage history (between [0 and 1], where 1 is 100%), based on its VMutilization history. Each value into the returned array is the CPU utilization percentage for a time interval equalto the Datacenter.getSchedulingInterval().
The values are stored in the reverse chronological order.
In order to enable the Host to get utilization history, utilization history of its VMs should be enabled by callingenable() from the .
getUtilizationOfBw
long getUtilizationOfBw()Gets the current utilization of bw (in absolute values).
getUtilizationOfCpu
double getUtilizationOfCpu()Gets current utilization of CPU in percentage (between [0 and 1]), considering the usage of all its PEs..
188 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getUtilizationOfCpuMips
double getUtilizationOfCpuMips()Gets the current total utilization of CPU in MIPS, considering the usage of all its PEs.
getUtilizationOfRam
long getUtilizationOfRam()Gets the current utilization of memory (in absolute values).
getVm
Vm getVm(int vmId, int brokerId)Gets a VM by its id and user.
Parameters
• vmId – the vm id
• brokerId – ID of VM’s owner
Returns the virtual machine object, $null if not found
getVmCreatedList
<T extends Vm> List<T> getVmCreatedList()Gets a read-only list of all VMs which have been created into the host during the entire simulation. This way,this method returns a historic list of created VMs, including those ones already destroyed.
Parameters
• <T> – The generic type
Returns the read-only vm created list
getVmList
<T extends Vm> List<T> getVmList()Gets a read-only list of VMs currently assigned to the host.
Parameters
• <T> – The generic type
Returns the read-only vm list
getVmScheduler
VmScheduler getVmScheduler()Gets the policy for allocation of host PEs to VMs in order to schedule VM execution.
Returns the VmScheduler
1.11. org.cloudbus.cloudsim.hosts 189
CloudSim Plus Documentation, Release 1.0.0
getVmsMigratingIn
<T extends Vm> Set<T> getVmsMigratingIn()Gets the list of VMs migrating into this host.
Parameters
• <T> – the generic type
Returns the vms migrating in
getVmsMigratingOut
Set<Vm> getVmsMigratingOut()Gets a read-only list of VMs migrating out from the Host.
getWorkingPeList
List<Pe> getWorkingPeList()Gets the list of working Processing Elements (PEs) of the host. It’s the list of all PEs which are not FAILEd.
Returns the list working (non-failed) Host PEs
isActive
boolean isActive()Checks if the Host is powered-on or not.
Returns true if the Host is powered-on, false otherwise.
isFailed
boolean isFailed()Checks if the host is working properly or has failed.
Returns true, if the host PEs have failed; false otherwise
isStateHistoryEnabled
boolean isStateHistoryEnabled()Checks if Host state history is being collected and stored.
isSuitableForVm
boolean isSuitableForVm(Vm vm)Checks if the host is active and is suitable for vm (if it has enough resources to attend the VM).
Parameters
• vm – the vm to check
Returns true if is suitable for vm, false otherwise
190 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
reallocateMigratingInVms
void reallocateMigratingInVms()Reallocate VMs migrating into the host. Gets the VM in the migrating in queue and allocate them on the host.
removeMigratingInVm
void removeMigratingInVm(Vm vm)Removes a migrating in vm.
Parameters
• vm – the vm
removeOnUpdateProcessingListener
boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>listener)
Removes a listener object from the OnUpdateProcessingListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
See also: .updateProcessing(double)
removeVmMigratingIn
boolean removeVmMigratingIn(Vm vm)Adds a Vm to the list of VMs migrating into the Host.
Parameters
• vm – the vm to be added
removeVmMigratingOut
boolean removeVmMigratingOut(Vm vm)Adds a Vm to the list of VMs migrating out from the Host.
Parameters
• vm – the vm to be added
setActive
Host setActive(boolean active)Sets the powered state of the Host, to indicate if it’s powered on or off. When a Host is powered off, no VMswill be submitted to it.
If it is set to powered off while VMs are running inside it, it is simulated a scheduled shutdown, so that, allrunning VMs will finish, but not more VMs will be submitted to this Host.
1.11. org.cloudbus.cloudsim.hosts 191
CloudSim Plus Documentation, Release 1.0.0
Parameters
• active – true to set the Host as powered on, false as powered off
setBwProvisioner
Host setBwProvisioner(ResourceProvisioner bwProvisioner)Sets the bandwidth (BW) provisioner with capacity in Megabits/s.
Parameters
• bwProvisioner – the new bw provisioner
setDatacenter
void setDatacenter(Datacenter datacenter)Sets the Datacenter where the host is placed.
Parameters
• datacenter – the new data center to move the host
setFailed
boolean setFailed(boolean failed)Sets the Host state to “failed” or “working”.
Parameters
• failed – true to set the Host to “failed”, false to set to “working”
Returns true if the Host status was changed, false otherwise
setPowerModel
Host setPowerModel(PowerModel powerModel)Sets the PowerModel used by the host to define how it consumes power. A Host just provides power usagedata if a PowerModel is set.
Parameters
• powerModel – the PowerModel to set
setRamProvisioner
Host setRamProvisioner(ResourceProvisioner ramProvisioner)Sets the ram provisioner with capacity in Megabytes.
Parameters
• ramProvisioner – the new ram provisioner
192 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setSimulation
Host setSimulation(Simulation simulation)Sets the CloudSim instance that represents the simulation the Entity is related to. Such attribute has to be set bythe Datacenter that the host belongs to.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
setVmScheduler
Host setVmScheduler(VmScheduler vmScheduler)Sets the policy for allocation of host PEs to VMs in order to schedule VM execution. The host also sets itself tothe given scheduler. It also sets the Host itself to the given scheduler.
Parameters
• vmScheduler – the vm scheduler to set
updateProcessing
double updateProcessing(double currentTime)Updates the processing of VMs running on this Host, that makes the processing of cloudlets inside such VMsto be updated.
Parameters
• currentTime – the current time
Returns the predicted completion time of the earliest finishing cloudlet (which is a relative delayfrom the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet toexecute
1.11.2 HostNull
final class HostNull implements HostA class that implements the Null Object Design Pattern for Host class.
Author Manoel Campos da Silva Filho
See also: Host.NULL
Methods
addMigratingInVm
public boolean addMigratingInVm(Vm vm)
1.11. org.cloudbus.cloudsim.hosts 193
CloudSim Plus Documentation, Release 1.0.0
addOnUpdateProcessingListener
public Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>l)
addVmMigratingOut
public boolean addVmMigratingOut(Vm vm)
compareTo
public int compareTo(Host o)
createTemporaryVm
public boolean createTemporaryVm(Vm vm)
createVm
public boolean createVm(Vm vm)
deallocatePesForVm
public void deallocatePesForVm(Vm vm)
destroyAllVms
public void destroyAllVms()
destroyTemporaryVm
public void destroyTemporaryVm(Vm vm)
destroyVm
public void destroyVm(Vm vm)
disableStateHistory
public void disableStateHistory()
enableStateHistory
public void enableStateHistory()
194 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getAllocatedMipsForVm
public List<Double> getAllocatedMipsForVm(Vm vm)
getAvailableMips
public double getAvailableMips()
getAvailableStorage
public long getAvailableStorage()
getBuzyPeList
public List<Pe> getBuzyPeList()
getBw
public Resource getBw()
getBwProvisioner
public ResourceProvisioner getBwProvisioner()
getDatacenter
public Datacenter getDatacenter()
getFinishedVms
public List<Vm> getFinishedVms()
getFreePeList
public List<Pe> getFreePeList()
getId
public int getId()
getMaxAvailableMips
public double getMaxAvailableMips()
1.11. org.cloudbus.cloudsim.hosts 195
CloudSim Plus Documentation, Release 1.0.0
getMips
public double getMips()
getNumberOfFailedPes
public long getNumberOfFailedPes()
getNumberOfFreePes
public int getNumberOfFreePes()
getNumberOfPes
public long getNumberOfPes()
getNumberOfWorkingPes
public long getNumberOfWorkingPes()
getPeList
public List<Pe> getPeList()
getPowerModel
public PowerModel getPowerModel()
getPreviousUtilizationOfCpu
public double getPreviousUtilizationOfCpu()
getProvisioner
public ResourceProvisioner getProvisioner(Class<? extends ResourceManageable> c)
getRam
public Resource getRam()
getRamProvisioner
public ResourceProvisioner getRamProvisioner()
196 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getResources
public List<ResourceManageable> getResources()
getSimulation
public Simulation getSimulation()
getStateHistory
public List<HostStateHistoryEntry> getStateHistory()
getStorage
public Resource getStorage()
getTotalAllocatedMipsForVm
public double getTotalAllocatedMipsForVm(Vm vm)
getTotalMipsCapacity
public double getTotalMipsCapacity()
getUtilizationHistory
public double[] getUtilizationHistory()
getUtilizationOfBw
public long getUtilizationOfBw()
getUtilizationOfCpu
public double getUtilizationOfCpu()
getUtilizationOfCpuMips
public double getUtilizationOfCpuMips()
getUtilizationOfRam
public long getUtilizationOfRam()
1.11. org.cloudbus.cloudsim.hosts 197
CloudSim Plus Documentation, Release 1.0.0
getVm
public Vm getVm(int vmId, int brokerId)
getVmCreatedList
public <T extends Vm> List<T> getVmCreatedList()
getVmList
public List<Vm> getVmList()
getVmScheduler
public VmScheduler getVmScheduler()
getVmsMigratingIn
public <T extends Vm> Set<T> getVmsMigratingIn()
getVmsMigratingOut
public Set<Vm> getVmsMigratingOut()
getWorkingPeList
public List<Pe> getWorkingPeList()
isActive
public boolean isActive()
isFailed
public boolean isFailed()
isStateHistoryEnabled
public boolean isStateHistoryEnabled()
isSuitableForVm
public boolean isSuitableForVm(Vm vm)
198 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
reallocateMigratingInVms
public void reallocateMigratingInVms()
removeMigratingInVm
public void removeMigratingInVm(Vm vm)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>l)
removeVmMigratingIn
public boolean removeVmMigratingIn(Vm vm)
removeVmMigratingOut
public boolean removeVmMigratingOut(Vm vm)
setActive
public Host setActive(boolean active)
setBwProvisioner
public Host setBwProvisioner(ResourceProvisioner bwProvisioner)
setDatacenter
public void setDatacenter(Datacenter datacenter)
setFailed
public boolean setFailed(boolean failed)
setId
public void setId(int id)
setPowerModel
public Host setPowerModel(PowerModel powerModel)
1.11. org.cloudbus.cloudsim.hosts 199
CloudSim Plus Documentation, Release 1.0.0
setRamProvisioner
public Host setRamProvisioner(ResourceProvisioner ramProvisioner)
setSimulation
public Host setSimulation(Simulation simulation)
setVmScheduler
public Host setVmScheduler(VmScheduler vmScheduler)
toString
public String toString()
updateProcessing
public double updateProcessing(double currentTime)
1.11.3 HostSimple
public class HostSimple implements HostA Host class that implements the most basic features of a Physical Machine (PM) inside a Datacenter. Itexecutes actions related to management of virtual machines (e.g., creation and destruction). A host has a definedpolicy for provisioning memory and bw, as well as an allocation policy for PEs to virtual machines. Ahost is associated to a Datacenter and can host virtual machines.
Author Rodrigo N. Calheiros, Anton Beloglazov
Constructors
HostSimple
public HostSimple(long ram, long bw, long storage, List<Pe> peList)Creates a Host without a pre-defined ID. The ID is automatically set when a List of Hosts is attached to aDatacenter.
Parameters
• ram – the RAM capacity in Megabytes
• bw – the Bandwidth (BW) capacity in Megabits/s
• storage – the storage capacity in Megabytes
• peList – the host’s Pe list
See also: .setId(int)
200 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
HostSimple
public HostSimple(ResourceProvisioner ramProvisioner, ResourceProvisioner bwProvisioner, long stor-age, List<Pe> peList, VmScheduler vmScheduler)
Creates a Host with the given parameters.
Parameters
• ramProvisioner – the ram provisioner with capacity in Megabytes
• bwProvisioner – the bw provisioner with capacity in Megabits/s
• storage – the storage capacity in Megabytes
• peList – the host’s PEs list
• vmScheduler – the vm scheduler
Methods
addMigratingInVm
public boolean addMigratingInVm(Vm vm)
addOnUpdateProcessingListener
public Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>listener)
addVmMigratingOut
public boolean addVmMigratingOut(Vm vm)
addVmToCreatedList
protected void addVmToCreatedList(Vm vm)
addVmToList
protected void addVmToList(Vm vm)
compareTo
public int compareTo(Host o)Compare this Host with another one based on getTotalMipsCapacity().
Parameters
• o – the Host to compare to
Returns @inheritDoc
1.11. org.cloudbus.cloudsim.hosts 201
CloudSim Plus Documentation, Release 1.0.0
computeCpuUtilizationPercent
protected double computeCpuUtilizationPercent(double mipsUsage)
createTemporaryVm
public boolean createTemporaryVm(Vm vm)
createVm
public boolean createVm(Vm vm)
deallocatePesForVm
public void deallocatePesForVm(Vm vm)
deallocateResourcesOfAllVms
protected void deallocateResourcesOfAllVms()Deallocate all resources that all VMs were using.
deallocateResourcesOfVm
protected void deallocateResourcesOfVm(Vm vm)Deallocate all resources that a VM was using.
Parameters
• vm – the VM
destroyAllVms
public void destroyAllVms()
destroyTemporaryVm
public void destroyTemporaryVm(Vm vm)
destroyVm
public void destroyVm(Vm vm)
disableStateHistory
public void disableStateHistory()
202 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
enableStateHistory
public void enableStateHistory()
equals
public boolean equals(Object o)
getAllocatedMipsForVm
public List<Double> getAllocatedMipsForVm(Vm vm)
getAvailableMips
public double getAvailableMips()
getAvailableStorage
public long getAvailableStorage()
getBuzyPeList
public List<Pe> getBuzyPeList()
getBw
public Resource getBw()
getBwProvisioner
public ResourceProvisioner getBwProvisioner()
getDatacenter
public Datacenter getDatacenter()
getFinishedVms
public List<Vm> getFinishedVms()
getFreePeList
public List<Pe> getFreePeList()
1.11. org.cloudbus.cloudsim.hosts 203
CloudSim Plus Documentation, Release 1.0.0
getId
public int getId()
getMaxAvailableMips
public double getMaxAvailableMips()
getMips
public double getMips()
getNumberOfFailedPes
public long getNumberOfFailedPes()
getNumberOfFreePes
public int getNumberOfFreePes()
getNumberOfPes
public long getNumberOfPes()@inheritDoc
Returns @inheritDoc
See also: .getNumberOfWorkingPes(), .getNumberOfFreePes(), .getNumberOfFailedPes()
getNumberOfWorkingPes
public long getNumberOfWorkingPes()
getPeList
public List<Pe> getPeList()
getPowerModel
public PowerModel getPowerModel()
getPreviousUtilizationOfCpu
public double getPreviousUtilizationOfCpu()
204 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getProvisioner
public ResourceProvisioner getProvisioner(Class<? extends ResourceManageable> resourceClass)
getRam
public Resource getRam()
getRamProvisioner
public ResourceProvisioner getRamProvisioner()
getResources
public List<ResourceManageable> getResources()
getSimulation
public Simulation getSimulation()
getStateHistory
public List<HostStateHistoryEntry> getStateHistory()
getStorage
public Resource getStorage()
getTotalAllocatedMipsForVm
public double getTotalAllocatedMipsForVm(Vm vm)
getTotalMipsCapacity
public double getTotalMipsCapacity()
getUtilizationHistory
public double[] getUtilizationHistory()
getUtilizationOfBw
public long getUtilizationOfBw()
1.11. org.cloudbus.cloudsim.hosts 205
CloudSim Plus Documentation, Release 1.0.0
getUtilizationOfCpu
public double getUtilizationOfCpu()
getUtilizationOfCpuMips
public double getUtilizationOfCpuMips()
getUtilizationOfRam
public long getUtilizationOfRam()
getVm
public Vm getVm(int vmId, int brokerId)
getVmCreatedList
public <T extends Vm> List<T> getVmCreatedList()
getVmList
public <T extends Vm> List<T> getVmList()
getVmScheduler
public VmScheduler getVmScheduler()
getVmsMigratingIn
public <T extends Vm> Set<T> getVmsMigratingIn()
getVmsMigratingOut
public Set<Vm> getVmsMigratingOut()
getWorkingPeList
public List<Pe> getWorkingPeList()
hashCode
public int hashCode()
206 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isActive
public boolean isActive()
isFailed
public boolean isFailed()
isStateHistoryEnabled
public boolean isStateHistoryEnabled()
isSuitableForVm
public boolean isSuitableForVm(Vm vm)
reallocateMigratingInVms
public void reallocateMigratingInVms()
removeMigratingInVm
public void removeMigratingInVm(Vm vm)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>listener)
removeVmMigratingIn
public boolean removeVmMigratingIn(Vm vm)
removeVmMigratingOut
public boolean removeVmMigratingOut(Vm vm)
setActive
public final Host setActive(boolean active)
setBwProvisioner
public final Host setBwProvisioner(ResourceProvisioner bwProvisioner)
1.11. org.cloudbus.cloudsim.hosts 207
CloudSim Plus Documentation, Release 1.0.0
setDatacenter
public final void setDatacenter(Datacenter datacenter)
setFailed
public final boolean setFailed(boolean failed)
setId
public final void setId(int id)
setPeList
protected final Host setPeList(List<Pe> peList)Sets the pe list.
Parameters
• peList – the new pe list
setPowerModel
public Host setPowerModel(PowerModel powerModel)
setRamProvisioner
public final Host setRamProvisioner(ResourceProvisioner ramProvisioner)
setSimulation
public final Host setSimulation(Simulation simulation)
setVmScheduler
public final Host setVmScheduler(VmScheduler vmScheduler)
toString
public String toString()
updateProcessing
public double updateProcessing(double currentTime)
208 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.11.4 HostStateHistoryEntry
public final class HostStateHistoryEntryKeeps historic CPU utilization data about a host.
Author Anton Beloglazov
Constructors
HostStateHistoryEntry
public HostStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean ac-tive)
Instantiates a host state history entry.
Parameters
• time – the time the data in this history entry is related to
• allocatedMips – the total MIPS allocated from all PEs of the Host, to running VMs, atthe recorded time
• requestedMips – the total MIPS requested by running VMs to all PEs of the Host at therecorded time
• active – if the Host is active at the given time
Methods
getAllocatedMips
public double getAllocatedMips()Gets the total MIPS allocated from all PEs of the Host, to running VMs, at the recorded time.
Returns the allocated mips
getRequestedMips
public double getRequestedMips()Gets the total MIPS requested by running VMs to all PEs of the Host at the recorded time.
Returns the requested mips
getTime
public double getTime()Gets the time the data in this history entry is related to.
isActive
public boolean isActive()Checks if the Host is/was active at the recorded time.
Returns true if is active, false otherwise
1.11. org.cloudbus.cloudsim.hosts 209
CloudSim Plus Documentation, Release 1.0.0
toString
public String toString()
1.12 org.cloudbus.cloudsim.hosts.network
Provides network-enabled org.cloudbus.cloudsim.hosts.Host implementations. For more general infor-mation, see the package org.cloudbus.cloudsim.hosts at the upper level.
author Manoel Campos da Silva Filho
1.12.1 NetworkHost
public class NetworkHost extends HostSimpleNetworkHost class extends HostSimple to support simulation of networked datacenters. It executes actionsrelated to management of packets (sent and received) other than that of virtual machines (e.g., creation anddestruction). A host has a defined policy for provisioning memory and bw, as well as an allocation policy forPE’s to virtual machines.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg
Constructors
NetworkHost
public NetworkHost(long ram, long bw, long storage, List<Pe> peList)Creates a NetworkHost.
Parameters
• ram – the RAM capacity in Megabytes
• bw – the Bandwidth (BW) capacity in Megabits/s
• storage – the storage capacity in Megabytes
• peList – the host’s Pe list
NetworkHost
public NetworkHost(long ram, long bw, long storage, List<Pe> peList, VmScheduler vmScheduler)Creates a NetworkHost.
Parameters
• ram – the RAM capacity in Megabytes
• bw – the Bandwidth (BW) capacity in Megabits/s
210 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• storage – the storage capacity in Megabytes
• peList – the host’s Pe list
• vmScheduler – the VM scheduler
Methods
addReceivedNetworkPacket
public void addReceivedNetworkPacket(HostPacket hostPacket)Adds a packet to the list of received packets in order to further submit them to the respective target VMs andCloudlets.
Parameters
• hostPacket – received network packet
createVm
public boolean createVm(Vm vm)@inheritDoc
It also creates and sets a for each Vm that doesn’t have one already.
Parameters
• vm – @inheritDoc
Returns @inheritDoc
getBandwidth
public double getBandwidth()Gets the Host bandwidth capacity in Megabits/s.
getEdgeSwitch
public EdgeSwitch getEdgeSwitch()
getTotalDataTransferBytes
public int getTotalDataTransferBytes()
setBandwidth
public void setBandwidth(double bandwidth)Sets the Host bandwidth capacity in Megabits/s.
Parameters
• bandwidth – the bandwidth to set
1.12. org.cloudbus.cloudsim.hosts.network 211
CloudSim Plus Documentation, Release 1.0.0
setEdgeSwitch
public void setEdgeSwitch(EdgeSwitch sw)
updateProcessing
public double updateProcessing(double currentTime)
1.13 org.cloudbus.cloudsim.network
Provides classes to define network assets, such as different kinds of org.cloudbus.cloudsim.network.switches.AbstractSwitch and also the org.cloudbus.cloudsim.network.topologies.NetworkTopology that can be specified in some standard file format and read using a implementation oforg.cloudbus.cloudsim.network.topologies.readers.TopologyReader.
It also provides class to enable simulation of network package transmission. For more information about the networkmoduule, please refer to following publication:
• ‘ Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011. <http://dx.doi.org/10.1109/UCC.2011.24>‘_
author Saurabh Kumar Garg, Manoel Campos da Silva Filho
1.13.1 DelayMatrix
public class DelayMatrixThis class represents a delay matrix between every pair or nodes inside a network topology, storing everydistance between connected nodes.
Author Thomas Hohnstein
Constructors
DelayMatrix
public DelayMatrix()
DelayMatrix
public DelayMatrix(TopologicalGraph graph, boolean directed)Creates an correctly initialized double-Delay-Matrix.
Parameters
• graph – the network topological graph
• directed – indicates if an directed matrix should be computed (true) or not (false)
212 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
getDelay
public double getDelay(int srcID, int destID)Gets the delay between two nodes.
Parameters
• srcID – the id of the source node
• destID – the id of the destination node
Returns the delay between the given two nodes
toString
public String toString()
1.13.2 FloydWarshall
public class FloydWarshallFloyd-Warshall algorithm to calculate the predecessor matrix and the delay between all pairs of nodes. The delayrepresents the distance between the two vertices and it works as the weight for the Floyd-Warshall algorithm.
Author Rahul Simha, Weishuai Yang
Constructors
FloydWarshall
public FloydWarshall(int numVertices)Creates a matrix of network nodes.
Parameters
• numVertices – number of network nodes
Methods
computeShortestPaths
public double[][] computeShortestPaths(double[][] originalDelayMatrix)Computes the shortest path between a vertex to all the other ones, for all existing vertices. This is representedby the delay between all pairs vertices.
Parameters
• originalDelayMatrix – original delay matrix
Returns the new delay matrix (dk)
1.13. org.cloudbus.cloudsim.network 213
CloudSim Plus Documentation, Release 1.0.0
getNumVertices
public int getNumVertices()
getPk
public int[][] getPk()Gets a copy of the predecessor matrix.
Returns the predecessor matrix copy
1.13.3 HostPacket
public class HostPacket implements NetworkPacket<NetworkHost>Represents a packet which travels from one Host to another. Each packet contains: IDs of the sender VM intothe source Host and receiver VM into the destination Host which are communicating; the time at which it is sentand received; type and virtual IDs of tasks.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
HostPacket
public HostPacket(NetworkHost senderHost, VmPacket vmPacket)Creates a new packet to be sent through the network between two hosts.
Parameters
• senderHost – The id of the host sending the packet
• vmPacket – The vm packet containing information of sender and receiver Cloudlets andtheir VMs.
Methods
getDestination
public NetworkHost getDestination()Gets the ID of the Host that the packet is going to.
getReceiveTime
public double getReceiveTime()
214 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getSendTime
public double getSendTime()
getSize
public long getSize()
getSource
public NetworkHost getSource()Gets the ID of the Host that this packet is coming from (the sender).
getVmPacket
public VmPacket getVmPacket()
setDestination
public void setDestination(NetworkHost receiverHost)Sets the ID of the Host that the packet is going to.
Parameters
• receiverHost – the receiver Host id to set
setReceiveTime
public void setReceiveTime(double receiveTime)
setSendTime
public void setSendTime(double sendTime)
setSource
public void setSource(NetworkHost senderHost)Sets the ID of the Host that this packet is coming from (the sender).
Parameters
• senderHost – the source Host id to set
1.13. org.cloudbus.cloudsim.network 215
CloudSim Plus Documentation, Release 1.0.0
1.13.4 IcmpPacket
public class IcmpPacket implements NetworkPacket<SimEntity>Represents a ping (ICMP protocol) packet that can be used to gather information from the network layer. AnIcmpPacket traverses the network topology similar to a HostPacket, but it collects information like band-widths, and Round Trip Time etc.
You can set all the parameters to an IcmpPacket that can be applied to a HostPacket. So if you want to find outthe kind of information that a particular type of HostPacket is experiencing, set the size and network class of anIcmpPacket to the same as the HostPacket, and send it to the same destination from the same source.
Author Gokul Poduval, Chen-Khong Tham, National University of Singapore
Constructors
IcmpPacket
public IcmpPacket(String name, int packetID, long size, SimEntity source, SimEntity destination, int netSer-viceLevel)
Constructs a new ICMP packet.
Parameters
• name – Name of this packet
• packetID – the ID of this packet
• size – size of the packet
• source – the entity that sends out this packet
• destination – the entity to which this packet is destined
• netServiceLevel – the class of traffic this packet belongs to
Methods
addBaudRate
public void addBaudRate(double baudRate)Register the baud rate of the output link where the current entity that holds the IcmpPacket will send it next.Every entity that the IcmpPacket traverses should add the baud rate of the link on which this packet will be sentout next.
Parameters
• baudRate – the entity’s baud rate in bits/s
addEntryTime
public void addEntryTime(double time)Register the time the packet arrives at an entity such as a Router or CloudResource. This method should becalled by routers and other entities when the IcmpPacket reaches them along with the current simulation time.
Parameters
• time – current simulation time, use org.cloudbus.cloudsim.core.CloudSim.clock() to obtain this
216 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addExitTime
public void addExitTime(double time)Register the time the packet leaves an entity such as a Router or CloudResource. This method should be calledby routers and other entities when the IcmpPacket is leaving them. It should also supply the current simulationtime.
Parameters
• time – current simulation time, use org.cloudbus.cloudsim.core.CloudSim.clock() to obtain this
addHop
public void addHop(SimEntity entity)Add an entity where the IcmpPacket traverses. This method should be called by network entities that count ashops, for instance Routers or CloudResources. It should not be called by links etc.
Parameters
• entity – the id of the hop that this IcmpPacket is traversing
getBaudRate
public double getBaudRate()Gets the bottleneck bandwidth between the source and the destination.
Returns the bottleneck bandwidth
getDestination
public SimEntity getDestination()
getDetailBaudRate
public List<Double> getDetailBaudRate()Gets a read-only list of all the bandwidths that this packet has traversed.
getDetailEntryTimes
public List<Double> getDetailEntryTimes()Gets a read-only list of all entry times that the packet has traversed.
getDetailExitTimes
public List<Double> getDetailExitTimes()Gets a read-only list of all exit times from all entities that the packet has traversed.
1.13. org.cloudbus.cloudsim.network 217
CloudSim Plus Documentation, Release 1.0.0
getHopsList
public List<SimEntity> getHopsList()Gets a read-only list of all entities that this packet has traversed, that defines the hops it has made.
getId
public int getId()Returns the ID of this packet
Returns packet ID
getLastHop
public SimEntity getLastHop()Gets the entity that was the last hop where this packet has traversed.
getNetServiceLevel
public int getNetServiceLevel()Gets the network service type of this packet
Returns the network service type
getNumberOfHops
public int getNumberOfHops()Gets the number of hops that the packet has traversed. Since the packet takes a round trip, the same router mayhave been traversed twice.
getReceiveTime
public double getReceiveTime()
getSendTime
public double getSendTime()
getSize
public long getSize()
getSource
public SimEntity getSource()
218 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getTag
public int getTag()Gets the packet direction that indicates if it is going or returning. The direction can be CloudSimTags.ICMP_PKT_SUBMIT or CloudSimTags.ICMP_PKT_RETURN .
getTotalResponseTime
public double getTotalResponseTime()Gets the total time that the packet has spent in the network. This is basically the Round-Trip Time (RTT).Dividing this by half should be the approximate latency.
RTT is taken as the “final entry time” - “first exit time”.
Returns total round-trip time
setDestination
public void setDestination(SimEntity destination)
setLastHop
public void setLastHop(SimEntity entity)Sets the entity that was the last hop where this packet has traversed.
Parameters
• entity – the entity to set as the last hop
setNetServiceLevel
public void setNetServiceLevel(int netServiceLevel)Sets the network service type of this packet.
By default, the service type is 0 (zero). It is depends on the packet scheduler to determine the priority of thisservice level.
Parameters
• netServiceLevel – the service level to set
setReceiveTime
public void setReceiveTime(double time)
setSendTime
public void setSendTime(double time)
1.13. org.cloudbus.cloudsim.network 219
CloudSim Plus Documentation, Release 1.0.0
setSize
public boolean setSize(long size)Sets the size of the packet.
Parameters
• size – the size to set
Returns true if a positive value was given, false otherwise
setSource
public void setSource(SimEntity source)
setTag
public boolean setTag(int tag)Sets the packet direction that indicates if it is going or returning. The direction can be CloudSimTags.ICMP_PKT_SUBMIT or CloudSimTags.ICMP_PKT_RETURN .
Parameters
• tag – the direction to set
Returns true if the tag is valid, false otherwise
toString
public String toString()Returns a human-readable information of this packet.
Returns description of this packet
1.13.5 NetworkPacket
public interface NetworkPacket<T extends Identificable>Defines the structure for a network packet.
Author Gokul Poduval, Chen-Khong Tham, National University of Singapore, Manoel Campos daSilva Filho
Parameters
• <T> – the class of objects involved in the packet transmission, if they are Hosts, VMs,Switches, etc.
Methods
getDestination
T getDestination()Gets the entity that the packet is going to.
220 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getReceiveTime
double getReceiveTime()Gets the time when the packet was received.
getSendTime
double getSendTime()Gets the time when the packet was sent.
getSize
long getSize()Gets the size of the packet in bytes.
getSource
T getSource()Gets the entity that this packet is coming from (the sender).
setDestination
void setDestination(T destination)Sets the entity that the packet is going to (the receiver).
Parameters
• destination – the destination to set
setReceiveTime
void setReceiveTime(double time)Sets the time when the packet was received.
Parameters
• time – the time to set
setSendTime
void setSendTime(double time)Sets the time when the packet was sent.
Parameters
• time – the time to set
1.13. org.cloudbus.cloudsim.network 221
CloudSim Plus Documentation, Release 1.0.0
setSource
void setSource(T source)Sets the entity that this packet is coming from (the sender).
Parameters
• source – the source ID to set
1.13.6 VmPacket
public class VmPacket implements NetworkPacket<Vm>Represents a packet that travels from a Vm to another, through the virtual network within a Host. It containsinformation about Cloudlets which are communicating.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
VmPacket
public VmPacket(Vm sourceVm, Vm destinationVm, long size, Cloudlet senderCloudlet, Cloudlet receiver-Cloudlet)
Creates a packet to be sent to to a VM inside the Host of the sender VM.
Parameters
• sourceVm – id of the VM sending the packet
• destinationVm – id of the VM that has to receive the packet
• size – data length of the packet in bytes
• senderCloudlet – cloudlet sending the packet
• receiverCloudlet – cloudlet that has to receive the packet
Methods
getDestination
public Vm getDestination()Gets the id of the VM that has to receive the packet. This is the VM where th receiver cloudlet isrunning.
getReceiveTime
public double getReceiveTime()
222 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getReceiverCloudlet
public Cloudlet getReceiverCloudlet()Gets the cloudlet that has to receive the packet.
getSendTime
public double getSendTime()
getSenderCloudlet
public Cloudlet getSenderCloudlet()Gets the cloudlet sending the packet.
getSize
public long getSize()
getSource
public Vm getSource()Gets the VM sending the packet. This is the VM where the sending cloudlet is running.
setDestination
public void setDestination(Vm destinationVmId)Sets the id of the VM that has to receive the packet. This is the VM where th receiver cloudlet isrunning.
Parameters
• destinationVmId – the destination VM id to set
setReceiveTime
public void setReceiveTime(double receiveTime)
setSendTime
public void setSendTime(double sendTime)
setSource
public void setSource(Vm sourceVmId)Sets the id of the VM sending the packet. This is the VM where the sending cloudlet is running.
Parameters
1.13. org.cloudbus.cloudsim.network 223
CloudSim Plus Documentation, Release 1.0.0
• sourceVmId – the source VM id to set
1.14 org.cloudbus.cloudsim.network.switches
Provides classes that implement the org.cloudbus.cloudsim.network.switches.Switch interface toallow creating Network Switches that compose a network topology. For more general information, see the packageorg.cloudbus.cloudsim.network at the upper level.
author Manoel Campos da Silva Filho
1.14.1 AbstractSwitch
public abstract class AbstractSwitch extends CloudSimEntity implements SwitchAn base class for implementing Network Switch.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
AbstractSwitch
public AbstractSwitch(CloudSim simulation, NetworkDatacenter dc)
Methods
addPacketToBeSentToDownlinkSwitch
public void addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
addPacketToBeSentToHost
public void addPacketToBeSentToHost(NetworkHost host, HostPacket packet)
addPacketToBeSentToUplinkSwitch
public void addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
connectHost
public void connectHost(NetworkHost host)
disconnectHost
public boolean disconnectHost(NetworkHost host)
224 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getDatacenter
public NetworkDatacenter getDatacenter()
getDownlinkBandwidth
public double getDownlinkBandwidth()
getDownlinkSwitchPacketList
public List<HostPacket> getDownlinkSwitchPacketList(Switch downlinkSwitch)
getDownlinkSwitches
public List<Switch> getDownlinkSwitches()
getHostList
public List<NetworkHost> getHostList()
getHostPacketList
public List<HostPacket> getHostPacketList(NetworkHost host)
getPacketList
public List<HostPacket> getPacketList()
getPacketToHostMap
public Map<NetworkHost, List<HostPacket>> getPacketToHostMap()
getPorts
public int getPorts()
getSwitchingDelay
public double getSwitchingDelay()
getUplinkBandwidth
public double getUplinkBandwidth()
1.14. org.cloudbus.cloudsim.network.switches 225
CloudSim Plus Documentation, Release 1.0.0
getUplinkSwitchPacketList
public List<HostPacket> getUplinkSwitchPacketList(Switch uplinkSwitch)
getUplinkSwitchPacketMap
public Map<Switch, List<HostPacket>> getUplinkSwitchPacketMap()
getUplinkSwitches
public List<Switch> getUplinkSwitches()
getVmEdgeSwitch
protected EdgeSwitch getVmEdgeSwitch(Vm vm)Gets the EdgeSwitch that the Host where the VM is placed is connected to.
Parameters
• vm – the VM to get the Edge Switch
Returns the connected Edge Switch
getVmHost
protected NetworkHost getVmHost(Vm vm)Gets the Host where a VM is placed.
Parameters
• vm – the VM to get its Host
Returns the Host where the VM is placed
networkDelayForPacketTransmission
protected double networkDelayForPacketTransmission(HostPacket netPkt, double bwCapacity,List<HostPacket> netPktList)
Computes the network delay to send a packet through the network.
Parameters
• netPkt – the packet to be sent
• bwCapacity – the total bandwidth capacity (in Megabits/s)
• netPktList – the list of packets waiting to be sent
Returns the expected time to transfer the packet through the network (in seconds)
processEvent
public void processEvent(SimEvent ev)
226 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processHostPacket
protected void processHostPacket(SimEvent ev)Process a packet sent to a host.
Parameters
• ev – The packet sent.
processPacketDown
protected void processPacketDown(SimEvent ev)Sends a packet to Datacenter connected through a downlink port.
Parameters
• ev – Event/packet to process
processPacketUp
protected void processPacketUp(SimEvent ev)Sends a packet to Datacenter connected through a uplink port.
Parameters
• ev – Event/packet to process
setDatacenter
public void setDatacenter(NetworkDatacenter datacenter)
setDownlinkBandwidth
public final void setDownlinkBandwidth(double downlinkBandwidth)
setPorts
public final void setPorts(int ports)
setSwitchingDelay
public final void setSwitchingDelay(double switchingDelay)
setUplinkBandwidth
public final void setUplinkBandwidth(double uplinkBandwidth)
1.14. org.cloudbus.cloudsim.network.switches 227
CloudSim Plus Documentation, Release 1.0.0
shutdownEntity
public void shutdownEntity()
startEntity
protected void startEntity()
1.14.2 AggregateSwitch
public class AggregateSwitch extends AbstractSwitchThis class represents an Aggregate AbstractSwitch in a Datacenter network. It interacts with other Datacenterin order to exchange packets.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Fields
DOWNLINK_BW
public static final long DOWNLINK_BWDefault downlink bandwidth of AggregateSwitch in Megabits/s. It also represents the uplink bandwidth ofconnected edge Datacenter.
LEVEL
public static final int LEVELThe level (layer) of the switch in the network topology.
PORTS
public static final int PORTSDefault number of aggregation switch ports that defines the number of EdgeSwitch that can be connected toit.
SWITCHING_DELAY
public static final double SWITCHING_DELAYDefault delay of AggregateSwitch in milliseconds.
228 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
AggregateSwitch
public AggregateSwitch(CloudSim simulation, NetworkDatacenter dc)Instantiates a Aggregate AbstractSwitch specifying the Datacenter that are connected to its downlink and uplinkports and corresponding bandwidths.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
• dc – The Datacenter where the switch is connected to
Methods
getLevel
public int getLevel()
processPacketDown
protected void processPacketDown(SimEvent ev)
processPacketUp
protected void processPacketUp(SimEvent ev)
1.14.3 EdgeSwitch
public class EdgeSwitch extends AbstractSwitchThis class represents an Edge AbstractSwitch in a Datacenter network. It interacts with other Datacenter inorder to exchange packets. Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Fields
DOWNLINK_BW
public static final long DOWNLINK_BWDefault downlink bandwidth of EdgeSwitch in Megabits/s. It also represents the uplink bandwidth of connectedhosts.
1.14. org.cloudbus.cloudsim.network.switches 229
CloudSim Plus Documentation, Release 1.0.0
LEVEL
public static final int LEVELThe level (layer) of the switch in the network topology.
PORTS
public static final int PORTSDefault number of ports that defines the number of Host that can be connected to the switch.
SWITCHING_DELAY
public static final double SWITCHING_DELAYDefault switching delay in milliseconds.
Constructors
EdgeSwitch
public EdgeSwitch(CloudSim simulation, NetworkDatacenter dc)Instantiates a EdgeSwitch specifying Datacenter that are connected to its downlink and uplink ports, and corre-sponding bandwidths. In this switch, downlink ports aren’t connected to other switch but to hosts.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
• dc – The Datacenter where the switch is connected to
Methods
getLevel
public int getLevel()
processPacketDown
protected void processPacketDown(SimEvent ev)
processPacketUp
protected void processPacketUp(SimEvent ev)
230 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.14.4 RootSwitch
public class RootSwitch extends AbstractSwitchThis class allows to simulate Root switch which connects Datacenters to external network. It interacts with otherDatacenter in order to exchange packets.
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Fields
DOWNLINK_BW
public static final long DOWNLINK_BWThe downlink bandwidth of RootSwitch in Megabits/s. It also represents the uplink bandwidth of connectedaggregation Datacenter.
LEVEL
public static final int LEVELThe level (layer) of the switch in the network topology.
PORTS
public static final int PORTSDefault number of root switch ports that defines the number of AggregateSwitch that can be connected toit.
SWITCHING_DELAY
public static final double SWITCHING_DELAYDefault switching delay in milliseconds.
Constructors
RootSwitch
public RootSwitch(CloudSim simulation, NetworkDatacenter dc)Instantiates a Root AbstractSwitch specifying what other Datacenter are connected to its downlink ports, andcorresponding bandwidths.
Parameters
• simulation – The CloudSim instance that represents the simulation the Entity is relatedto
• dc – The Datacenter where the switch is connected to
1.14. org.cloudbus.cloudsim.network.switches 231
CloudSim Plus Documentation, Release 1.0.0
Methods
getLevel
public int getLevel()
processPacketUp
protected void processPacketUp(SimEvent ev)
1.14.5 Switch
public interface Switch extends SimEntityRepresents a Network Switch.
Author Manoel Campos da Silva Filho
Fields
NULL
Switch NULLAn attribute that implements the Null Object Design Pattern for Switch objects.
Methods
addPacketToBeSentToDownlinkSwitch
void addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
addPacketToBeSentToHost
void addPacketToBeSentToHost(NetworkHost host, HostPacket packet)
addPacketToBeSentToUplinkSwitch
void addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
connectHost
void connectHost(NetworkHost host)Connects a NetworkHost to the switch, by adding it to the getHostList().
Parameters
• host – the host to be connected to the switch
232 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
disconnectHost
boolean disconnectHost(NetworkHost host)Disconnects a NetworkHost from the switch, by removing it from the getHostList().
Parameters
• host – the host to be disconnected from the switch
Returns true if the Host was connected to the switch, false otherwise
getDatacenter
NetworkDatacenter getDatacenter()Gets the Datacenter where the switch is connected to.
getDownlinkBandwidth
double getDownlinkBandwidth()
Returns Bandwitdh of downlink (in Megabits/s).
getDownlinkSwitchPacketList
List<HostPacket> getDownlinkSwitchPacketList(Switch downlinkSwitch)Gets the list of packets to be sent to a downlink switch.
Parameters
• downlinkSwitch – the id of the switch to get the list of packets to send
Returns the list of packets to be sent to the given switch.
getDownlinkSwitches
List<Switch> getDownlinkSwitches()
getHostList
List<NetworkHost> getHostList()Gets a read-only list of Hosts connected to the switch.
getHostPacketList
List<HostPacket> getHostPacketList(NetworkHost host)Gets the list of packets to be sent to a host.
Parameters
• host – the host to get the list of packets to send
Returns the list of packets to be sent to the given host.
1.14. org.cloudbus.cloudsim.network.switches 233
CloudSim Plus Documentation, Release 1.0.0
getLevel
int getLevel()Gets the level (layer) of the AbstractSwitch in the network topology, depending if it is a root switch (layer 0),aggregate switch (layer 1) or edge switch (layer 2)
Returns the switch network level
getPacketList
List<HostPacket> getPacketList()
getPacketToHostMap
Map<NetworkHost, List<HostPacket>> getPacketToHostMap()
Returns a read-only map of hosts and the list of packets to be sent to each one.
getPorts
int getPorts()Gets the number of ports the switch has.
getSwitchingDelay
double getSwitchingDelay()
Returns the latency time the switch spends to process a received packet. This time is consideredconstant no matter how many packets the switch have to process (in seconds).
getUplinkBandwidth
double getUplinkBandwidth()
Returns Bandwitdh of uplink (in Megabits/s).
getUplinkSwitchPacketList
List<HostPacket> getUplinkSwitchPacketList(Switch uplinkSwitch)Gets the list of packets to be sent to an uplink switch.
Parameters
• uplinkSwitch – the switch to get the list of packets to send
Returns the list of packets to be sent to the given switch.
234 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getUplinkSwitchPacketMap
Map<Switch, List<HostPacket>> getUplinkSwitchPacketMap()
Returns a read-only map of the uplink Switches and list of packets to be sent to each one.
getUplinkSwitches
List<Switch> getUplinkSwitches()
setDatacenter
void setDatacenter(NetworkDatacenter datacenter)Sets the Datacenter where the switch is connected to.
Parameters
• datacenter – the Datacenter to set
setDownlinkBandwidth
void setDownlinkBandwidth(double downlinkBandwidth)
setPorts
void setPorts(int ports)
setSwitchingDelay
void setSwitchingDelay(double switchingDelay)
setUplinkBandwidth
void setUplinkBandwidth(double uplinkBandwidth)
1.14.6 SwitchNull
final class SwitchNull implements SwitchA class that implements the Null Object Design Pattern for Switch class.
Author Manoel Campos da Silva Filho
See also: Switch.NULL
Methods
addPacketToBeSentToDownlinkSwitch
public void addPacketToBeSentToDownlinkSwitch(Switch downlinkSwitch, HostPacket packet)
1.14. org.cloudbus.cloudsim.network.switches 235
CloudSim Plus Documentation, Release 1.0.0
addPacketToBeSentToHost
public void addPacketToBeSentToHost(NetworkHost host, HostPacket packet)
addPacketToBeSentToUplinkSwitch
public void addPacketToBeSentToUplinkSwitch(Switch uplinkSwitch, HostPacket packet)
compareTo
public int compareTo(SimEntity o)
connectHost
public void connectHost(NetworkHost host)
disconnectHost
public boolean disconnectHost(NetworkHost host)
getDatacenter
public NetworkDatacenter getDatacenter()
getDownlinkBandwidth
public double getDownlinkBandwidth()
getDownlinkSwitchPacketList
public List<HostPacket> getDownlinkSwitchPacketList(Switch s)
getDownlinkSwitches
public List<Switch> getDownlinkSwitches()
getHostList
public List<NetworkHost> getHostList()
getHostPacketList
public List<HostPacket> getHostPacketList(NetworkHost host)
236 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getId
public int getId()
getLevel
public int getLevel()
getName
public String getName()
getPacketList
public List<HostPacket> getPacketList()
getPacketToHostMap
public Map<NetworkHost, List<HostPacket>> getPacketToHostMap()
getPorts
public int getPorts()
getSimulation
public Simulation getSimulation()
getSwitchingDelay
public double getSwitchingDelay()
getUplinkBandwidth
public double getUplinkBandwidth()
getUplinkSwitchPacketList
public List<HostPacket> getUplinkSwitchPacketList(Switch s)
getUplinkSwitchPacketMap
public Map<Switch, List<HostPacket>> getUplinkSwitchPacketMap()
1.14. org.cloudbus.cloudsim.network.switches 237
CloudSim Plus Documentation, Release 1.0.0
getUplinkSwitches
public List<Switch> getUplinkSwitches()
isStarted
public boolean isStarted()
println
public void println(String msg)
processEvent
public void processEvent(SimEvent ev)
run
public void run()
schedule
public void schedule(SimEntity dest, double delay, int tag)
setDatacenter
public void setDatacenter(NetworkDatacenter datacenter)
setDownlinkBandwidth
public void setDownlinkBandwidth(double downlinkBandwidth)
setLog
public void setLog(boolean log)
setName
public SimEntity setName(String newName)
setPorts
public void setPorts(int ports)
238 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setSimulation
public SimEntity setSimulation(Simulation simulation)
setState
public SimEntity setState(State state)
setSwitchingDelay
public void setSwitchingDelay(double switchingDelay)
setUplinkBandwidth
public void setUplinkBandwidth(double uplinkBandwidth)
shutdownEntity
public void shutdownEntity()
start
public void start()
1.15 org.cloudbus.cloudsim.network.topologies
Provides classes that implement the org.cloudbus.cloudsim.network.topologies.NetworkTopology interface to allow defining a network topology. For more general information, see thepackage org.cloudbus.cloudsim.network at the upper level.
author Manoel Campos da Silva Filho
1.15.1 BriteNetworkTopology
public final class BriteNetworkTopology implements NetworkTopologyImplements a network layer by reading the topology from a file in the BRITE format, the Boston universityRepresentative Topology gEnerator, and generates a topological network from it. Information of this network isused to simulate latency in network traffic of CloudSim.
The topology file may contain more nodes than the number of entities in the simulation. It allows users toincrease the scale of the simulation without changing the topology file. Nevertheless, each CloudSim entitymust be mapped to one (and only one) BRITE node to allow proper work of the network simulation. EachBRITE node can be mapped to only one entity at a time.
Author Rodrigo N. Calheiros, Anton Beloglazov
1.15. org.cloudbus.cloudsim.network.topologies 239
CloudSim Plus Documentation, Release 1.0.0
Constructors
BriteNetworkTopology
public BriteNetworkTopology()Creates a network topology
BriteNetworkTopology
public BriteNetworkTopology(String filePath)Creates a network topology if the file exists and can be successfully parsed. File is written in the BRITE formatand contains topological information on simulation entities.
Parameters
• filePath – the path of the BRITE file
Methods
addLink
public void addLink(int srcId, int destId, double bw, double lat)
getBwMatrix
public double[][] getBwMatrix()Gets acopy of the matrix containing the bandwidth between every pair of nodes in the network.
getDelay
public double getDelay(int srcID, int destID)
getInstance
public static BriteNetworkTopology getInstance(String fileName)Instantiates a new Network Topology a file inside the application’s resource directory.
Parameters
• fileName – the relative name of the BRITE file
Returns the BriteNetworkTopology instance.
getTopologycalGraph
public TopologicalGraph getTopologycalGraph()
240 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isNetworkEnabled
public boolean isNetworkEnabled()
mapNode
public void mapNode(int cloudSimEntityID, int briteID)
unmapNode
public void unmapNode(int cloudSimEntityID)
1.15.2 NetworkTopology
public interface NetworkTopology
• Implements a network layer by reading the topology from a file in a specific format that is defined by eachimplementing class.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See also: BriteNetworkTopology
Fields
NULL
NetworkTopology NULLAn attribute that implements the Null Object Design Pattern for NetworkTopology objects.
Methods
addLink
void addLink(int srcId, int destId, double bw, double lat)Adds a new link in the network topology. The CloudSim entities that represent the source and destination of thelink will be mapped to BRITE entities.
Parameters
• srcId – ID of the CloudSim entity that represents the link’s source node
• destId – ID of the CloudSim entity that represents the link’s destination node
• bw – Link’s bandwidth
• lat – link’s latency
1.15. org.cloudbus.cloudsim.network.topologies 241
CloudSim Plus Documentation, Release 1.0.0
getDelay
double getDelay(int srcID, int destID)Calculates the delay between two nodes.
Parameters
• srcID – ID of the CloudSim entity that represents the link’s source node
• destID – ID of the CloudSim entity that represents the link’s destination node
Returns communication delay between the two nodes
getTopologycalGraph
TopologicalGraph getTopologycalGraph()
Returns the graph
isNetworkEnabled
boolean isNetworkEnabled()Checks if the network simulation is working. If there were some problem during creation of network (e.g.,during parsing of BRITE file) that does not allow a proper simulation of the network, this method returns false.
Returns $true if network simulation is working, $false otherwise
mapNode
void mapNode(int cloudSimEntityID, int briteID)Maps a CloudSim entity to a BRITE node in the network topology.
Parameters
• cloudSimEntityID – ID of the entity being mapped
• briteID – ID of the BRITE node that corresponds to the CloudSim entity
unmapNode
void unmapNode(int cloudSimEntityID)Unmaps a previously mapped CloudSim entity to a BRITE node in the network topology.
Parameters
• cloudSimEntityID – ID of the entity being unmapped
1.15.3 NetworkTopologyNull
final class NetworkTopologyNull implements NetworkTopologyA class that implements the Null Object Design Pattern for NetworkTopology class.
Author Manoel Campos da Silva Filho
See also: NetworkTopology.NULL
242 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
addLink
public void addLink(int srcId, int destId, double bw, double lat)
getDelay
public double getDelay(int srcID, int destID)
getTopologycalGraph
public TopologicalGraph getTopologycalGraph()
isNetworkEnabled
public boolean isNetworkEnabled()
mapNode
public void mapNode(int cloudSimEntityID, int briteID)
unmapNode
public void unmapNode(int cloudSimEntityID)
1.15.4 Point2D
public class Point2DA class to represent the coordinates of a 2-dimensional point.
Constructors
Point2D
public Point2D()Creates a origin point with coordinates 0,0.
Point2D
public Point2D(int x, int y)
1.15. org.cloudbus.cloudsim.network.topologies 243
CloudSim Plus Documentation, Release 1.0.0
Methods
getX
public int getX()
getY
public int getY()
toString
public String toString()
1.15.5 TopologicalGraph
public class TopologicalGraphThis class represents a graph containing vertices (nodes) and edges (links), used for input with a network-layer.
Graphical-Output Restricions:
• EdgeColors: GraphicalProperties.getColorEdge
• NodeColors: GraphicalProperties.getColorNode
Author Thomas Hohnstein
Constructors
TopologicalGraph
public TopologicalGraph()Creates an empty graph-object.
Methods
addLink
public void addLink(TopologicalLink edge)Adds an link between two topological nodes.
Parameters
• edge – the topological link
244 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addNode
public void addNode(TopologicalNode node)Adds an Topological Node to this graph.
Parameters
• node – the topological node to add
getLinksList
public List<TopologicalLink> getLinksList()Gets a read-only List of all network-graph links.
Returns the List of network-graph links
getNodeList
public List<TopologicalNode> getNodeList()Gets a read-only list of nodes of the network graph.
getNumberOfLinks
public int getNumberOfLinks()Gets the number of links contained inside the topological-graph.
Returns number of links
getNumberOfNodes
public int getNumberOfNodes()Gets the number of nodes contained inside the topological-graph.
Returns number of nodes
toString
public String toString()
1.15.6 TopologicalLink
public class TopologicalLinkRepresents a link (edge) of a network graph where the network topology was defined from a file in BRITEformat.
Author Thomas Hohnstein
1.15. org.cloudbus.cloudsim.network.topologies 245
CloudSim Plus Documentation, Release 1.0.0
Constructors
TopologicalLink
public TopologicalLink(int srcNode, int destNode, double delay, double bw)Creates a new Topological Link.
Parameters
• srcNode – the BRITE id of the source node of the link.
• destNode – the BRITE id of the destination node of the link.
• delay – the link delay of the connection.
• bw – the link bandwidth (bw)
Methods
getDestNodeID
public int getDestNodeID()Gets the BRITE id of the destination node of the link.
Returns nodeID
getLinkBw
public double getLinkBw()Gets the bandwidth of the link.
Returns the bw
getLinkDelay
public double getLinkDelay()Gets the delay of the link.
Returns the link delay
getSrcNodeID
public int getSrcNodeID()Gets the BRITE id of the source node of the link.
Returns nodeID
1.15.7 TopologicalNode
public class TopologicalNodeRepresents an topological network node that retrieves its information from a topological-generated file (eg.topology-generator)
Author Thomas Hohnstein
246 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
TopologicalNode
public TopologicalNode()Creates a network topology node with ID equals to zero.
TopologicalNode
public TopologicalNode(int nodeId)Creates a network topology node with a specific ID.
Parameters
• nodeId – The BRITE id of the node inside the network
TopologicalNode
public TopologicalNode(int nodeId, Point2D worldCoordinates)Creates a network topology node including world-coordinates.
Parameters
• nodeId – The BRITE id of the node inside the network
• worldCoordinates – the x,y world-coordinates of the Node
TopologicalNode
public TopologicalNode(int nodeId, String nodeName, Point2D worldCoordinates)Creates a network topology node including world-coordinates and the nodeName.
Parameters
• nodeId – The BRITE id of the node inside the network
• nodeName – The name of the node inside the network
• worldCoordinates – the x,y world-coordinates of the Node
Methods
getNodeId
public int getNodeId()Gets the BRITE id of the node inside the network.
Returns the nodeId
getNodeName
public String getNodeName()Gets the name of the node
1.15. org.cloudbus.cloudsim.network.topologies 247
CloudSim Plus Documentation, Release 1.0.0
Returns name of the node
getWorldCoordinates
public Point2D getWorldCoordinates()Gets the x,y world coordinates of this network-node.
Returns the x,y world coordinates
setNodeId
public void setNodeId(int nodeId)
setNodeName
public void setNodeName(String nodeName)
setWorldCoordinates
public void setWorldCoordinates(Point2D worldCoordinates)
1.16 org.cloudbus.cloudsim.network.topologies.readers
Provides classes that implement the org.cloudbus.cloudsim.network.topologies.readers.TopologyReader interface to allow defining a Network Topology from the specifications inside a file in somespecific format.
author Manoel Campos da Silva Filho
1.16.1 TopologyReader
public interface TopologyReaderAn interface to be implemented by classes that read a network graph (topology) from a file name with a specificformat.
Author Thomas Hohnstein
Methods
readGraphFile
TopologicalGraph readGraphFile(String filename)Reads a file and creates an TopologicalGraph object.
Parameters
• filename – Name of the file to read
Throws
248 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• IOException – when the file cannot be accessed
Returns The created TopologicalGraph
readGraphFile
TopologicalGraph readGraphFile(InputStreamReader streamReader)Reads a file and creates an TopologicalGraph object.
Parameters
• streamReader – the InputStreamReader to read the file
Throws
• IOException – when the file cannot be accessed
Returns The created TopologicalGraph
1.16.2 TopologyReaderBrite
public class TopologyReaderBrite implements TopologyReaderA network graph (topology) readers that creates a network topology from a file in the BRITE format. A BRITEfile is structured as follows:
• Node-section: NodeID, xpos, ypos, indegree, outdegree, ASid, type(router/AS)
• Edge-section: EdgeID, fromNode, toNode, euclideanLength, linkDelay, linkBandwith, AS_from, AS_to,type
Author Thomas Hohnstein
Methods
readGraphFile
public TopologicalGraph readGraphFile(String filename)
readGraphFile
public TopologicalGraph readGraphFile(InputStreamReader streamReader)
1.17 org.cloudbus.cloudsim.power.models
Provides org.cloudbus.cloudsim.power.models.PowerModel implementations that are used to definehow a org.cloudbus.cloudsim.hosts.Host consumes electricity, according to its current resource usage.
It includes theoretical models and also concrete ones from specif versions of a physical machine from a given manu-facturer such as IBM or HP.
The most basic PowerModel is the org.cloudbus.cloudsim.power.models.PowerModelLinear.
1.17. org.cloudbus.cloudsim.power.models 249
CloudSim Plus Documentation, Release 1.0.0
1.17.1 PowerAware
public interface PowerAwareAn interface for power-aware components such as Datacenter and PowerModel.
Author Manoel Campos da Silva Filho
Methods
getPower
double getPower()Gets the current power consumption in Watt-Second (Ws). For this moment, it only computes the power con-sumed by Pes.
Returns the power consumption in Watt-Second (Ws)
See also: .getPowerInKWattsHour()
getPowerInKWattsHour
double getPowerInKWattsHour()Gets the current power consumption in Kilowatt-hour (kWh). For this moment, it only computes the powerconsumed by Pes.
Returns the power consumption Kilowatt-hour (kWh)
See also: .getPower()
wattsSecToKWattsHour
static double wattsSecToKWattsHour(double power)Converts from Watts-Second to Kilowatt-hour (kWh).
Parameters
• power – the value in Watts-Second
Returns the value converted to Kilowatt-hour (kWh)
1.17.2 PowerModel
public interface PowerModel extends PowerAwareProvides a model for power consumption of hosts, depending on utilization of a critical system component, suchas CPU. This is the fundamental class to enable power-aware Hosts. However, a Host just provides power usagedata if a PowerModel is set using the .
The interface implements the Null Object Design Pattern in order to start avoiding NullPointerExceptionwhen using the PowerModel.NULL object instead of attributing null to PowerModel variables.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
250 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
PowerModel NULLA property that implements the Null Object Design Pattern for Host objects.
Methods
getEnergyLinearInterpolation
double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, double time)Gets an estimation of energy consumption using linear interpolation of the utilization change. It’s required toset a in order to get power usage data.
Parameters
• fromUtilization – the initial utilization percentage
• toUtilization – the final utilization percentage
• time – the time span between the initial and final utilization to compute the energy con-sumption
Returns the estimated energy consumption
getHost
Host getHost()
getMaxPower
double getMaxPower()Gets the max power that can be consumed by the host in Watt-Second (Ws).
Returns the max consumption power in Watt-Second (Ws)
getPower
double getPower(double utilization)Gets power consumption in Watt-Second (Ws) of the Power Model, according to the utilization percentage of acritical resource, such as CPU.
The power consumption data is just available while the host is active.
Parameters
1.17. org.cloudbus.cloudsim.power.models 251
CloudSim Plus Documentation, Release 1.0.0
• utilization – the utilization percentage (between [0 and 1]) of a resource that is criticalfor power consumption.
Throws
• IllegalArgumentException – when the utilization percentage is not between [0 and1]
Returns the power consumption in Watt-Second (Ws)
setHost
void setHost(Host host)
1.17.3 PowerModelAbstract
public abstract class PowerModelAbstract implements PowerModelAn abstract implementation of a PowerModel.
Author raysaoliveira
Methods
getEnergyLinearInterpolation
public double getEnergyLinearInterpolation(double fromUtilization, double toUtilization, doubletime)
getHost
public Host getHost()
getPower
public double getPower()
getPower
public final double getPower(double utilization)
getPowerInternal
protected abstract double getPowerInternal(double utilization)An internal method to be implemented by sub classes to get the power consumption for the current CPU utiliza-tion.
The basic parameter validation is performed by the getPower(double) method.
Parameters
252 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• utilization – the utilization percentage (between [0 and 1]) of a resource that is criticalfor power consumption.
Throws
• IllegalArgumentException – when the utilization percentage is not between [0 and1]
Returns the power consumption
setHost
public final void setHost(Host host)
1.17.4 PowerModelCubic
public class PowerModelCubic extends PowerModelSimpleImplements a power model where the power consumption is the cube of the resource usage.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
PowerModelCubic
public PowerModelCubic(double maxPower, double staticPowerPercent)Instantiates a new power model cubic.
Parameters
• maxPower – the max power that can be consumed in Watt-Second (Ws).
• staticPowerPercent – the static power usage percentage between 0 and 1.
1.17.5 PowerModelLinear
public class PowerModelLinear extends PowerModelSimpleA power model where the power consumption is linear to resource usage.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
1.17. org.cloudbus.cloudsim.power.models 253
CloudSim Plus Documentation, Release 1.0.0
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
PowerModelLinear
public PowerModelLinear(double maxPower, double staticPowerPercent)Instantiates a linear power model.
Parameters
• maxPower – the max power that can be consumed in Watt-Second (Ws).
• staticPowerPercent – the static power usage percentage between 0 and 1.
1.17.6 PowerModelSimple
public class PowerModelSimple extends PowerModelAbstractA power model where the power consumption is defined by a UnaryOperator function given as parameterto the constructor. This way, the user can define how the power consumption increases along the time withoutrequiring to create a new class for it.
However, specific classes that implement well known models are provided, such as PowerModelLinear,PowerModelSquare, PowerModelCubic and PowerModelSqrt.
Author Manoel Campos da Silva Filho
Constructors
PowerModelSimple
public PowerModelSimple(double maxPower, double staticPowerPercent, UnaryOperator<Double> pow-erIncrementFunction)
Instantiates a PowerModelSimple.
Parameters
• maxPower – the max power that can be consumed in Watt-Second (Ws).
• staticPowerPercent – the static power usage percentage between 0 and 1.
• powerIncrementFunction – a function that defines how the power consumption in-creases along the time. This function receives the utilization percentage in scale from 0 to100 and returns a factor representing how the power consumption will increase for the givenutilization percentage. The function return is again a percentage value between [0 and 1].
Methods
getConstant
protected double getConstant()Gets the constant which represents the power consumption for each fraction of resource used in Watt-Second(Ws).
Returns the power consumption constant in Watt-Second (Ws)
254 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getMaxPower
public double getMaxPower()
getPowerInternal
protected double getPowerInternal(double utilization)
getStaticPower
public final double getStaticPower()Gets the static power consumption in Watt-Second (Ws) that is not dependent of resource usage, according tothe getStaticPowerPercent(). It is the amount of energy consumed even when the host is idle.
Returns the static power usage in Watt-Second (Ws)
getStaticPowerPercent
public double getStaticPowerPercent()Gets the static power consumption percentage (between 0 and 1) that is not dependent of resource usage. It isthe amount of energy consumed even when the host is idle.
Returns the static power consumption percentage (between 0 and 1)
1.17.7 PowerModelSpecPower
public abstract class PowerModelSpecPower extends PowerModelAbstractThe abstract class of power models created based on data from SPECpower benchmark.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getMaxPower
public double getMaxPower()
getPowerData
protected abstract double getPowerData(int index)Gets the power consumption for a given utilization percentage.
1.17. org.cloudbus.cloudsim.power.models 255
CloudSim Plus Documentation, Release 1.0.0
Parameters
• index – the utilization percentage in the scale from [0 to 10], where 10 means 100% ofutilization.
Returns the power consumption for the given utilization percentage
getPowerInternal
protected double getPowerInternal(double utilization)
1.17.8 PowerModelSpecPowerHpProLiantMl110G3PentiumD930
public class PowerModelSpecPowerHpProLiantMl110G3PentiumD930 extends PowerModelSpecPowerThe power model of an HP ProLiant ML110 G3 (1 x [Pentium D930 3000 MHz, 2 cores], 4GB). http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17.9 PowerModelSpecPowerHpProLiantMl110G4Xeon3040
public class PowerModelSpecPowerHpProLiantMl110G4Xeon3040 extends PowerModelSpecPowerThe power model of an HP ProLiant ML110 G4 (1 x [Xeon 3040 1860 MHz, 2 cores], 4GB). http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
256 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
getPowerData
protected double getPowerData(int index)
1.17.10 PowerModelSpecPowerHpProLiantMl110G5Xeon3075
public class PowerModelSpecPowerHpProLiantMl110G5Xeon3075 extends PowerModelSpecPowerThe power model of an HP ProLiant ML110 G5 (1 x [Xeon 3075 2660 MHz, 2 cores], 4GB). http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110124-00339.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17.11 PowerModelSpecPowerIbmX3250XeonX3470
public class PowerModelSpecPowerIbmX3250XeonX3470 extends PowerModelSpecPowerThe power model of an IBM server x3250 (1 x [Xeon X3470 2933 MHz, 4 cores], 8GB). http://www.spec.org/power_ssj2008/results/res2009q4/power_ssj2008-20091104-00213.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17. org.cloudbus.cloudsim.power.models 257
CloudSim Plus Documentation, Release 1.0.0
1.17.12 PowerModelSpecPowerIbmX3250XeonX3480
public class PowerModelSpecPowerIbmX3250XeonX3480 extends PowerModelSpecPowerThe power model of an IBM server x3250 (1 x [Xeon X3480 3067 MHz, 4 cores], 8GB). http://www.spec.org/power_ssj2008/results/res2010q4/power_ssj2008-20101001-00297.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17.13 PowerModelSpecPowerIbmX3550XeonX5670
public class PowerModelSpecPowerIbmX3550XeonX5670 extends PowerModelSpecPowerThe power model of an IBM server x3550 (2 x [Xeon X5670 2933 MHz, 6 cores], 12GB). http://www.spec.org/power_ssj2008/results/res2010q2/power_ssj2008-20100315-00239.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17.14 PowerModelSpecPowerIbmX3550XeonX5675
public class PowerModelSpecPowerIbmX3550XeonX5675 extends PowerModelSpecPowerThe power model of an IBM server x3550 (2 x [Xeon X5675 3067 MHz, 6 cores], 16GB). http://www.spec.org/power_ssj2008/results/res2011q2/power_ssj2008-20110406-00368.html
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
258 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getPowerData
protected double getPowerData(int index)
1.17.15 PowerModelSqrt
public class PowerModelSqrt extends PowerModelSimpleImplements a power model where the power consumption is the square root of the resource usage.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
PowerModelSqrt
public PowerModelSqrt(double maxPower, double staticPowerPercent)Instantiates a new power model sqrt.
Parameters
• maxPower – the max power that can be consumed in Watt-Second (Ws).
• staticPowerPercent – the static power usage percentage between 0 and 1.
1.17.16 PowerModelSquare
public class PowerModelSquare extends PowerModelSimpleImplements a power model where the power consumption is the square of the resource usage.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
1.17. org.cloudbus.cloudsim.power.models 259
CloudSim Plus Documentation, Release 1.0.0
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
PowerModelSquare
public PowerModelSquare(double maxPower, double staticPowerPercent)Instantiates a new power model square.
Parameters
• maxPower – the max power that can be consumed in Watt-Second (Ws).
• staticPowerPercent – the static power usage percentage between 0 and 1.
1.18 org.cloudbus.cloudsim.provisioners
Provides org.cloudbus.cloudsim.provisioners.ResourceProvisioner implementations that de-fine policies used by a org.cloudbus.cloudsim.hosts.Host to manage the allocation of some re-source for its VMs, such as org.cloudbus.cloudsim.resources.Ram, org.cloudbus.cloudsim.resources.Bandwidth or org.cloudbus.cloudsim.resources.Pe.
1.18.1 PeProvisioner
public interface PeProvisioner extends ResourceProvisionerA class that represents the provisioning policy used by a host to allocate its PEs to virtual machines inside it. Itgets a physical PE and manage it in order to provide this PE as virtual PEs for VMs. In that way, a given PEmight be shared among different VMs.
Author Manoel Campos da Silva Filho
Fields
NULL
PeProvisioner NULLAn attribute that implements the Null Object Design Pattern for PeProvisioner objects.
Methods
allocateResourceForVm
boolean allocateResourceForVm(Vm vm, long mipsCapacity)Allocates an amount of MIPS from the physical Pe to a new virtual PE for a given VM. The virtual PE to beadded will use the total or partial MIPS capacity of the physical PE.
Parameters
• vm – the virtual machine for which the new virtual PE is being allocated
• mipsCapacity – the MIPS to be allocated to the virtual PE of the given VM
260 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns $true if the virtual PE could be allocated; $false otherwise
deallocateResourceForAllVms
void deallocateResourceForAllVms()Releases all virtual PEs allocated to all VMs.
deallocateResourceForVm
boolean deallocateResourceForVm(Vm vm)Releases the virtual Pe allocated to a given VM.
Parameters
• vm – the vm to release the virtual Pe
getAllocatedResourceForVm
long getAllocatedResourceForVm(Vm vm)Gets the amount of allocated MIPS from the physical Pe to a virtual PE of a VM.
Parameters
• vm – the virtual machine to get the allocated virtual Pe MIPS
Returns the allocated virtual Pe MIPS
getTotalAllocatedResource
long getTotalAllocatedResource()Gets the total allocated MIPS from the physical Pe.
Returns the total allocated MIPS
getUtilization
double getUtilization()Gets the utilization percentage of the Pe in scale from 0 to 1.
Returns the utilization percentage from 0 to 1
setPe
void setPe(Pe pe)Sets the Pe that this provisioner will manage.
Parameters
• pe – the Pe to set
1.18. org.cloudbus.cloudsim.provisioners 261
CloudSim Plus Documentation, Release 1.0.0
1.18.2 PeProvisionerNull
final class PeProvisionerNull implements PeProvisionerA class that implements the Null Object Design Pattern for PeProvisioner class.
Author Manoel Campos da Silva Filho
See also: PeProvisioner.NULL
Methods
allocateResourceForVm
public boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)
allocateResourceForVm
public boolean allocateResourceForVm(Vm vm, double newTotalVmResource)
deallocateResourceForAllVms
public void deallocateResourceForAllVms()
deallocateResourceForVm
public boolean deallocateResourceForVm(Vm vm)
getAllocatedResourceForVm
public long getAllocatedResourceForVm(Vm vm)
getAvailableResource
public long getAvailableResource()
getCapacity
public long getCapacity()
getResource
public ResourceManageable getResource()
getTotalAllocatedResource
public long getTotalAllocatedResource()
262 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getUtilization
public double getUtilization()
isResourceAllocatedToVm
public boolean isResourceAllocatedToVm(Vm vm)
isSuitableForVm
public boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)
setPe
public void setPe(Pe pe)
setResource
public void setResource(ResourceManageable resource)
1.18.3 PeProvisionerSimple
public class PeProvisionerSimple extends ResourceProvisionerSimple implements PeProvisionerA PeProvisioner that uses a best-effort policy to allocate virtual PEs to VMs from a physical PE: if thereis available MIPS on the physical PE, it allocates to a virtual PE; otherwise, it fails. Each host’s PE has to haveits own instance of a PeProvisioner.
Each host’s PE must have its own instance of a PeProvisioner. When extending this class, care must be takento guarantee that the field availableMips will always contain the amount of free MIPS available for futureallocations.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
PeProvisionerSimple
public PeProvisionerSimple()Instantiates a new PeProvisionerSimple that the Pe it will manage will be set just at Pe instantiation.
PeProvisionerSimple
public PeProvisionerSimple(Pe pe)Instantiates a new PeProvisionerSimple for a given Pe.
Parameters
• pe –
1.18. org.cloudbus.cloudsim.provisioners 263
CloudSim Plus Documentation, Release 1.0.0
Methods
getUtilization
public double getUtilization()
setPe
public void setPe(Pe pe)
1.18.4 ResourceProvisioner
public interface ResourceProvisionerAn interface that represents the provisioning policy used by a Host to allocate a given physical resource to Vmsinside it. Each host has to have its own instance of a ResourceProvisioner for each Resource it owns, such asRam, Bandwidth (BW) and Pe (CPU).
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
ResourceProvisioner NULLAn attribute that implements the Null Object Design Pattern for ResourceProvisioner objects.
Methods
allocateResourceForVm
boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)Allocates an amount of the physical resource for a given VM, changing the current capacity of the virtualresource to the given amount.
Parameters
• vm – the virtual machine for which the resource is being allocated
• newTotalVmResourceCapacity – the new total amount of resource to allocate to theVM, changing the allocate resource to this new amount. It doesn’t increase the currentallocated VM resource by the given amount, instead, it changes the VM allocated resourceto that specific amount
Returns $true if the resource could be allocated; $false otherwise
allocateResourceForVm
boolean allocateResourceForVm(Vm vm, double newTotalVmResource)Allocates an amount of the physical resource for a given VM, changing the current capacity of the virtualresource to the given amount.
This method is just a shorthand to avoid explicitly converting a double to long.
264 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• vm – the virtual machine for which the resource is being allocated
• newTotalVmResource – the new total amount of resource to allocate to the VM, chang-ing the allocate resource to this new amount. It doesn’t increase the current allocated VMresource by the given amount, instead, it changes the VM allocated resource to that specificamount
Returns $true if the resource could be allocated; $false otherwise
See also: .allocateResourceForVm(Vm,long)
deallocateResourceForAllVms
void deallocateResourceForAllVms()Releases all the allocated amount of the resource used by all VMs.
deallocateResourceForVm
boolean deallocateResourceForVm(Vm vm)Releases all the allocated amount of the resource used by a VM.
Parameters
• vm – the vm
Returns true if the resource was deallocated; false if the related resource has never been allocatedto the given VM.
getAllocatedResourceForVm
long getAllocatedResourceForVm(Vm vm)Gets the amount of resource allocated to a given VM from the physical resource
Parameters
• vm – the VM
Returns the allocated resource for the VM
getAvailableResource
long getAvailableResource()Gets the amount of free available physical resource from the host that the provisioner can allocate to VMs.
Returns the amount of free available physical resource
getCapacity
long getCapacity()Gets the total capacity of the physical resource from the Host that the provisioner manages.
Returns the total physical resource capacity
1.18. org.cloudbus.cloudsim.provisioners 265
CloudSim Plus Documentation, Release 1.0.0
getResource
ResourceManageable getResource()Gets the resource being managed for the provisioner, such as Ram, Pe, Bandwidth, etc.
Returns the resource managed by this provisioner
getTotalAllocatedResource
long getTotalAllocatedResource()Gets the total amount of resource allocated to all VMs from the physical resource
Returns the total allocated resource among all VMs
isResourceAllocatedToVm
boolean isResourceAllocatedToVm(Vm vm)Checks if the resource the provisioner manages is allocated to a given Vm.
Parameters
• vm – the VM to check if the resource is allocated to
Returns true if the resource is allocated to the VM, false otherwise
isSuitableForVm
boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)Checks if it is possible to change the current allocated resource for a given VM to a new amount, depending onthe available physical resource remaining.
Parameters
• vm – the vm to check if there is enough available resource on the host to change the allocatedamount for the VM
• newVmTotalAllocatedResource – the new total amount of resource to allocate forthe VM.
Returns true, if it is possible to allocate the new total VM resource; false otherwise
setResource
void setResource(ResourceManageable resource)Sets the resource to be managed for the provisioner, such as Ram, Pe, Bandwidth, etc.
Parameters
• resource – the resource managed by this provisioner
266 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.18.5 ResourceProvisionerAbstract
public abstract class ResourceProvisionerAbstract implements ResourceProvisionerAn abstract class that implements the basic features of a provisioning policy used by a host to allocate a givenresource to virtual machines inside it.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See also: ResourceProvisioner
Constructors
ResourceProvisionerAbstract
protected ResourceProvisionerAbstract()Creates a new ResourceManageable Provisioner for which the resource must be set further.
ResourceProvisionerAbstract
public ResourceProvisionerAbstract(ResourceManageable resource)Creates a new ResourceManageable Provisioner.
Parameters
• resource – The resource to be managed by the provisioner
Methods
deallocateResourceForAllVms
public void deallocateResourceForAllVms()
deallocateResourceForVmSettingAllocationMapEntryToZero
protected abstract long deallocateResourceForVmSettingAllocationMapEntryToZero(Vmvm)
Deallocate the resource for the given VM, without removing the VM fro the allocation map. The resource usageof the VM entry on the allocation map is just set to 0.
Parameters
• vm – the VM to deallocate resource
Returns the amount of allocated VM resource or zero if VM is not found
getAllocatedResourceForVm
public long getAllocatedResourceForVm(Vm vm)
getAvailableResource
public long getAvailableResource()
1.18. org.cloudbus.cloudsim.provisioners 267
CloudSim Plus Documentation, Release 1.0.0
getCapacity
public long getCapacity()
getResource
public ResourceManageable getResource()
getResourceAllocationMap
protected Map<Vm, Long> getResourceAllocationMap()Gets the VM resource allocation map, where each key is a VM and each value is the amount of resource allocatedto that VM.
Returns the resource allocation Map
getResourceClass
protected Class<? extends ResourceManageable> getResourceClass()Gets the class of the resource that this provisioner manages.
Returns the resource class
getTotalAllocatedResource
public long getTotalAllocatedResource()
isResourceAllocatedToVm
public boolean isResourceAllocatedToVm(Vm vm)
setResource
public final void setResource(ResourceManageable resource)
1.18.6 ResourceProvisionerNull
final class ResourceProvisionerNull implements ResourceProvisionerA class that implements the Null Object Design Pattern for ResourceProvisioner class.
Author Manoel Campos da Silva Filho
See also: ResourceProvisioner.NULL
268 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
allocateResourceForVm
public boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)
deallocateResourceForAllVms
public void deallocateResourceForAllVms()
deallocateResourceForVm
public boolean deallocateResourceForVm(Vm vm)
getAllocatedResourceForVm
public long getAllocatedResourceForVm(Vm vm)
getAvailableResource
public long getAvailableResource()
getCapacity
public long getCapacity()
getResource
public ResourceManageable getResource()
getTotalAllocatedResource
public long getTotalAllocatedResource()
isResourceAllocatedToVm
public boolean isResourceAllocatedToVm(Vm vm)
isSuitableForVm
public boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)
1.18. org.cloudbus.cloudsim.provisioners 269
CloudSim Plus Documentation, Release 1.0.0
setResource
public void setResource(ResourceManageable resource)
1.18.7 ResourceProvisionerSimple
public class ResourceProvisionerSimple extends ResourceProvisionerAbstractResourceProvisionerSimple is a ResourceProvisioner implementation which uses a best-effort policy toallocate a resource to VMs: if there is available amount of the resource on the host, it allocates; otherwise, itfails.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
ResourceProvisionerSimple
public ResourceProvisionerSimple()Creates a new ResourceProvisionerSimple which the ResourceManageable it will manage have to be setfurther.
See also: .setResource(ResourceManageable)
ResourceProvisionerSimple
protected ResourceProvisionerSimple(ResourceManageable resource)Creates a new ResourceProvisionerSimple.
Parameters
• resource – the resource to be managed by the provisioner
Methods
allocateResourceForVm
public boolean allocateResourceForVm(Vm vm, long newTotalVmResourceCapacity)
allocateResourceForVm
public boolean allocateResourceForVm(Vm vm, double newTotalVmResource)
deallocateResourceForVm
public boolean deallocateResourceForVm(Vm vm)
deallocateResourceForVmSettingAllocationMapEntryToZero
protected long deallocateResourceForVmSettingAllocationMapEntryToZero(Vm vm)
270 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isSuitableForVm
public boolean isSuitableForVm(Vm vm, long newVmTotalAllocatedResource)
1.19 org.cloudbus.cloudsim.resources
Provides classes that represent different physical and logical org.cloudbus.cloudsim.resources.Resource used by simulation objects such as Hosts and VMs.
There are different interfaces that enable the existence of resources with different features such as if the capacity ofthe resource can be changed after defined, if the resource can be managed (meaning that some amount of it can beallocated or freed in runtime), etc.
The most basic resources are org.cloudbus.cloudsim.resources.HarddriveStorage, org.cloudbus.cloudsim.resources.Ram, org.cloudbus.cloudsim.resources.Bandwidth, org.cloudbus.cloudsim.resources.Pe and org.cloudbus.cloudsim.resources.File.
author Manoel Campos da Silva Filho
1.19.1 Bandwidth
public final class Bandwidth extends ResourceManageableAbstractRepresents the Bandwidth (BW) capacity of a PM or VM in Megabits/s. Such a class allows managing the BWcapacity and allocation.
Author Manoel Campos da Silva Filho
Constructors
Bandwidth
public Bandwidth(long capacity)Creates a new Bandwidth resource.
Parameters
• capacity – the bandwidth capacity in in Megabits/s
1.19.2 File
public class FileA class for representing a physical file in a DataCloud environment
Author Uros Cibej, Anthony Sulistio
Fields
NOT_REGISTERED
public static final int NOT_REGISTEREDDenotes that this file has not been registered to a Replica Catalogue.
1.19. org.cloudbus.cloudsim.resources 271
CloudSim Plus Documentation, Release 1.0.0
TYPE_UNKNOWN
public static final int TYPE_UNKNOWNDenotes that the type of this file is unknown.
Constructors
File
public File(String fileName, int fileSize)Creates a new DataCloud file with a given size (in MBytes). NOTE: By default, a newly-created file is set to amaster copy.
Parameters
• fileName – file name
• fileSize – file size in MBytes
Throws
• IllegalArgumentException – This happens when one of the following scenariosoccur:
• the file name is empty or null
• the file size is zero or negative numbers
File
public File(File file)Copy constructor that creates a clone from a source file and set the given file as a replica.
Parameters
• file – the source file to create a copy and that will be set as a replica
Throws
• IllegalArgumentException – This happens when the source file is null
Methods
getAttributeSize
public int getAttributeSize()Gets the size of this object (in byte). NOTE: This object size is NOT the actual file size. Moreover, this size isused for transferring this object over a network.
Returns the object size (in byte)
272 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getChecksum
public int getChecksum()Gets the file checksum.
Returns file checksum
getCost
public double getCost()Gets the cost associated with the file.
Returns the cost of this file
getCreationTime
public long getCreationTime()Gets the file creation time (in millisecond).
Returns the file creation time (in millisecond)
getDatacenter
public Datacenter getDatacenter()Gets the Datacenter that stores the file.
getFileAttribute
public FileAttribute getFileAttribute()Gets an attribute of this file.
Returns a file attribute
getLastUpdateTime
public double getLastUpdateTime()Gets the last update time (in seconds).
Returns the last update time (in seconds)
getName
public String getName()Gets the file name.
Returns the file name
1.19. org.cloudbus.cloudsim.resources 273
CloudSim Plus Documentation, Release 1.0.0
getOwnerName
public String getOwnerName()Gets the owner name of this file.
Returns the owner name or null if empty
getRegistrationID
public int getRegistrationID()Gets the file registration ID.
Returns registration ID
getSize
public int getSize()Gets the file size (in MBytes).
Returns the file size (in MBytes)
getSizeInByte
public int getSizeInByte()Gets the file size (in bytes).
Returns the file size (in bytes)
getTransactionTime
public double getTransactionTime()Gets the last transaction time of the file (in second).
Returns the transaction time (in second)
getType
public int getType()Gets the file type.
Returns file type
isDeleted
public boolean isDeleted()Checks if the file was deleted or not.
Returns true if it was deleted, false otherwise
274 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isMasterCopy
public boolean isMasterCopy()Checks whether the file is a master copy or replica.
Returns true if it is a master copy or false otherwise
isRegistered
public boolean isRegistered()Checks if the file is already registered to a Replica Catalogue.
Returns true if it is registered, false otherwise
isValid
public static boolean isValid(String fileName)Check if the name of a file is valid or not.
Parameters
• fileName – the file name to be checked for validity
Returns true if the file name is valid, false otherwise
isValid
public static boolean isValid(File file)Check if a file object is valid or not. This method checks whether the given file object itself and its file name arevalid.
Parameters
• file – the file to be checked for validity
Returns true if the file is valid, false otherwise
makeMasterCopy
public File makeMasterCopy()Clone the current file and make the new file as a master copy as well.
Returns a clone of the current file (as a master copy) or null if an error occurs
makeReplica
public File makeReplica()Clone the current file and set the cloned one as a replica.
Returns a clone of the current file (as a replica) or null if an error occurs
1.19. org.cloudbus.cloudsim.resources 275
CloudSim Plus Documentation, Release 1.0.0
setChecksum
public boolean setChecksum(int checksum)Sets the checksum of the file.
Parameters
• checksum – the checksum of this file
Returns true if successful, false otherwise
setCost
public boolean setCost(double cost)Sets the cost associated with the file.
Parameters
• cost – cost of this file
Returns true if successful, false otherwise
setDatacenter
public final File setDatacenter(Datacenter datacenter)Sets the Datacenter that will store the file. When the file is added to a FileStorage and such a storage isattached to a Datacenter, the Datacenter sets itself for all files of that storage.
Parameters
• datacenter – the Datacenter that will store the file
setDeleted
public void setDeleted(boolean deleted)Sets the file as deleted or not.
Parameters
• deleted – true if it was deleted, false otherwise
setMasterCopy
public void setMasterCopy(boolean masterCopy)Marks the file as a master copy or replica.
Parameters
• masterCopy – a flag denotes true for master copy or false for a replica
setName
public final void setName(String name)Sets the file name.
276 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• name – the file name
setOwnerName
public boolean setOwnerName(String name)Sets the owner name of this file.
Parameters
• name – the owner name
Returns true if successful, false otherwise
setRegistrationID
public boolean setRegistrationID(int id)Sets the file registration ID (published by a Replica Catalogue entity).
Parameters
• id – registration ID
Returns true if successful, false otherwise
setSize
public boolean setSize(int fileSize)Sets the file size (in MBytes).
Parameters
• fileSize – the file size (in MBytes)
Returns true if successful, false otherwise
setTransactionTime
public boolean setTransactionTime(double time)Sets the current transaction time (in second) of this file. This transaction time can be related to the operation ofadding, deleting or getting the file on a Datacenter’s storage.
Parameters
• time – the transaction time (in second)
Returns true if successful, false otherwise
setType
public boolean setType(int type)Sets the file type (for instance, raw, tag, etc).
Parameters
1.19. org.cloudbus.cloudsim.resources 277
CloudSim Plus Documentation, Release 1.0.0
• type – a file type
Returns true if successful, false otherwise
setUpdateTime
public boolean setUpdateTime(double time)Sets the last update time of this file (in seconds). NOTE: This time is relative to the start time. Preferably useorg.cloudbus.cloudsim.core.CloudSim.clock() method.
Parameters
• time – the last update time (in seconds)
Returns true if successful, false otherwise
toString
public String toString()
1.19.3 FileAttribute
public class FileAttributeStores related information regarding to a org.cloudbus.cloudsim.resources.File entity.
Author Uros Cibej, Anthony Sulistio
Constructors
FileAttribute
public FileAttribute(File file, int fileSize)Creates a new FileAttribute object.
Parameters
• file – the file that this attribute object is related to
• fileSize – the size for the File
Methods
copyValue
public void copyValue(FileAttribute destinationAttr)Copy the values of the object into a given FileAttribute instance.
Parameters
• destinationAttr – the destination FileAttribute object to copy the current object to
278 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getAttributeSize
public int getAttributeSize()Gets the size of the object (in byte). NOTE: This object size is NOT the actual file size. Moreover, this size isused for transferring this object over a network.
Returns the object size (in byte)
getChecksum
public int getChecksum()Gets the file checksum.
Returns file checksum
getCost
public double getCost()Gets the cost associated with the file.
Returns the cost of this file
getCreationTime
public long getCreationTime()Gets the file creation time (in millisecond).
Returns the file creation time (in millisecond)
getFileSize
public int getFileSize()Gets the file size (in MBytes).
Returns the file size (in MBytes)
getFileSizeInByte
public int getFileSizeInByte()Gets the file size (in bytes).
Returns the file size (in bytes)
getLastUpdateTime
public double getLastUpdateTime()Gets the last update time (in seconds).
Returns the last update time (in seconds)
1.19. org.cloudbus.cloudsim.resources 279
CloudSim Plus Documentation, Release 1.0.0
getOwnerName
public String getOwnerName()Gets the owner name of the file.
Returns the owner name or null if empty
getRegistrationID
public int getRegistrationID()Gets the file registration ID.
Returns registration ID
getType
public int getType()Gets the file type.
Returns file type
isMasterCopy
public boolean isMasterCopy()Checks whether the file is a master copy or replica.
Returns true if it is a master copy or false if it is a replica
isRegistered
public boolean isRegistered()Checks if the file is already registered to a Replica Catalogue.
Returns true if it is registered, false otherwise
isValid
public static boolean isValid(String fileName)Check if the name of a file is valid or not.
Parameters
• fileName – the file name to be checked for validity
Returns true if the file name is valid, false otherwise
setChecksum
public boolean setChecksum(int checksum)Sets the checksum of the file.
Parameters
280 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• checksum – the checksum of this file
Returns true if successful, false otherwise
setCost
public boolean setCost(double cost)Sets the cost associated with the file.
Parameters
• cost – cost of this file
Returns true if successful, false otherwise
setCreationTime
public boolean setCreationTime(long creationTime)Sets the file creation time (in millisecond).
Parameters
• creationTime – the file creation time (in millisecond)
Returns true if successful, false otherwise
setFileSize
public final boolean setFileSize(int fileSize)Sets the file size (in MBytes).
Parameters
• fileSize – the file size (in MBytes)
Returns true if successful, false otherwise
setMasterCopy
public void setMasterCopy(boolean masterCopy)Marks the file as a master copy or replica.
Parameters
• masterCopy – a flag denotes true for master copy or false for a replica
setOwnerName
public boolean setOwnerName(String name)Sets the owner name of the file.
Parameters
• name – the owner name
Returns true if successful, false otherwise
1.19. org.cloudbus.cloudsim.resources 281
CloudSim Plus Documentation, Release 1.0.0
setRegistrationId
public boolean setRegistrationId(int id)Sets the file registration ID (published by a Replica Catalogue entity).
Parameters
• id – registration ID
Returns true if successful, false otherwise
setType
public boolean setType(int type)Sets the file type (for instance raw, tag, etc).
Parameters
• type – a file type
Returns true if successful, false otherwise
setUpdateTime
public boolean setUpdateTime(double time)Sets the last update time of the file (in seconds). NOTE: This time is relative to the start time. Preferably useorg.cloudbus.cloudsim.core.CloudSim.clock() method.
Parameters
• time – the last update time (in seconds)
Returns true if successful, false otherwise
1.19.4 FileStorage
public interface FileStorage extends ResourceAn interface which defines the desired functionality of a storage system in a Data Cloud that performs operationson a file system, such as file inclusion, exclusion and renaming. Classes that implement this interface shouldsimulate the characteristics of different storage systems by setting the capacity of the storage and the maximumtransfer rate. The transfer rate defines the time required to execute some common operations on the storage, e.g.storing a file, getting a file and deleting a file.
Author Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
Methods
addFile
double addFile(File file)Adds a file to the storage. The time taken (in seconds) for adding the specified file can also be found usingFile.getTransactionTime().
Parameters
• file – the file to be added
282 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns the time taken (in seconds) for adding the specified file or zero if there isn’t available storagespace.
addFile
double addFile(List<File> list)Adds a set of files to the storage. The time taken (in seconds) for adding each file can also be found usingFile.getTransactionTime().
Parameters
• list – the files to be added
Returns the time taken (in seconds) for adding the specified file or zero if the file is invalid or thereisn’t available storage space.
addReservedFile
double addReservedFile(File file)Adds a file for which the space has already been reserved. The time taken (in seconds) for adding the specifiedfile can also be found using File.getTransactionTime().
Parameters
• file – the file to be added
Returns the time (in seconds) required to add the file
contains
boolean contains(String fileName)Checks whether a file exists in the storage or not.
Parameters
• fileName – the name of the file we are looking for
Returns true if the file is in the storage, false otherwise
contains
boolean contains(File file)Checks whether a file is stored in the storage or not.
Parameters
• file – the file we are looking for
Returns true if the file is in the storage, false otherwise
deleteFile
File deleteFile(String fileName)Removes a file from the storage. The time taken (in seconds) for deleting the specified file can be found usingFile.getTransactionTime().
1.19. org.cloudbus.cloudsim.resources 283
CloudSim Plus Documentation, Release 1.0.0
Parameters
• fileName – the name of the file to be removed
Returns the deleted file.
deleteFile
double deleteFile(File file)Removes a file from the storage. The time taken (in seconds) for deleting the specified file can also be foundusing File.getTransactionTime().
Parameters
• file – the file to be removed
Returns the time taken (in seconds) for deleting the specified file
getFile
File getFile(String fileName)Gets the file with the specified name. The time taken (in seconds) for getting the specified file can also be foundusing File.getTransactionTime().
Parameters
• fileName – the name of the needed file
Returns the file with the specified filename; null if not found
getFileList
List<File> getFileList()Gets a read-only list with all files stored on the device.
Returns a List of files
getFileNameList
List<String> getFileNameList()Gets a read-only list with the names of all files stored on the device.
Returns a List of file names
getMaxTransferRate
double getMaxTransferRate()Gets the maximum transfer rate of the storage in MByte/sec.
Returns the maximum transfer rate in MEGABYTE/sec
284 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getName
String getName()
Returns the name of the storage device
getNumStoredFile
int getNumStoredFile()Gets the number of files stored on this device.
Returns the number of stored files
hasPotentialAvailableSpace
boolean hasPotentialAvailableSpace(int fileSize)Checks whether there is enough space on the storage for a certain file
Parameters
• fileSize – to size of the file intended to be stored on the device
Returns true if enough space available, false otherwise
renameFile
boolean renameFile(File file, String newName)Renames a file on the storage. The time taken (in seconds) for renaming the specified file can also be foundusing File.getTransactionTime().
Parameters
• file – the file we would like to rename
• newName – the new name of the file
Returns true if the renaming succeeded, false otherwise
reserveSpace
boolean reserveSpace(int fileSize)Makes reservation of space on the storage to store a file.
Parameters
• fileSize – the size to be reserved in MEGABYTE
Returns true if reservation succeeded, false otherwise
setMaxTransferRate
boolean setMaxTransferRate(int rate)Sets the maximum transfer rate of this storage system in MByte/sec.
Parameters
1.19. org.cloudbus.cloudsim.resources 285
CloudSim Plus Documentation, Release 1.0.0
• rate – the maximum transfer rate in MEGABYTE/sec
Returns true if the values is greater than zero and was set successfully, false otherwise
1.19.5 HarddriveStorage
public class HarddriveStorage implements FileStorageAn implementation of a Hard Drive (HD) storage device. It simulates the behavior of a typical hard drive.The default values for this storage are those of a “Maxtor DiamonMax 10 ATA” hard disk with the followingparameters:
• latency = 4.17 ms
• avg seek time = 9 m/s
• max transfer rate = 133 MEGABYTE/sec
Author Uros Cibej, Anthony Sulistio
Constructors
HarddriveStorage
public HarddriveStorage(String name, long capacity)Creates a new hard drive storage with a given name and capacity.
Parameters
• name – the name of the new hard drive storage
• capacity – the capacity in MByte
Throws
• IllegalArgumentException – when the name and the capacity are not valid
HarddriveStorage
public HarddriveStorage(long capacity)Creates a new hard drive storage with a given capacity. In this case the name of the storage is a default name.
Parameters
• capacity – the capacity in MByte
Throws
• IllegalArgumentException – when the name and the capacity are not valid
Methods
addFile
public double addFile(File file)@inheritDoc
286 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
First, the method checks if there is enough space on the storage, then it checks if the file with the same name isalready taken to avoid duplicate filenames.
Parameters
• file – @inheritDoc
Returns @inheritDoc
addFile
public double addFile(List<File> list)
addReservedFile
public double addReservedFile(File file)
contains
public boolean contains(String fileName)
contains
public boolean contains(File file)
deleteFile
public File deleteFile(String fileName)
deleteFile
public double deleteFile(File file)
getAllocatedResource
public long getAllocatedResource()
getAvailableResource
public long getAvailableResource()
getAvgSeekTime
public double getAvgSeekTime()Gets the average seek time of the hard drive in seconds.
Returns the average seek time in seconds
1.19. org.cloudbus.cloudsim.resources 287
CloudSim Plus Documentation, Release 1.0.0
getCapacity
public long getCapacity()
getFile
public File getFile(String fileName)
getFileList
public List<File> getFileList()
getFileNameList
public List<String> getFileNameList()
getLatency
public double getLatency()Gets the latency of this hard drive in seconds.
Returns the latency in seconds
getMaxTransferRate
public double getMaxTransferRate()
getName
public String getName()
getNumStoredFile
public int getNumStoredFile()
hasPotentialAvailableSpace
public boolean hasPotentialAvailableSpace(int fileSize)
isFull
public boolean isFull()
288 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isResourceAmountAvailable
public boolean isResourceAmountAvailable(long amountToCheck)
isResourceAmountAvailable
public boolean isResourceAmountAvailable(double amountToCheck)
renameFile
public boolean renameFile(File file, String newName)
reserveSpace
public boolean reserveSpace(int fileSize)
setAvgSeekTime
public boolean setAvgSeekTime(double seekTime)Sets the average seek time of the storage in seconds.
Parameters
• seekTime – the average seek time in seconds
Returns true if the values is greater than zero and was set successfully, false otherwise
setAvgSeekTime
public boolean setAvgSeekTime(double seekTime, ContinuousDistribution gen)Sets the average seek time and a new generator of seek times in seconds. The generator determines a randomizedseek time.
Parameters
• seekTime – the average seek time in seconds
• gen – the ContinuousGenerator which generates seek times
Returns true if the values is greater than zero and was set successfully, false otherwise
setLatency
public boolean setLatency(double latency)Sets the latency of this hard drive in seconds.
Parameters
• latency – the new latency in seconds
Returns true if the setting succeeded, false otherwise
1.19. org.cloudbus.cloudsim.resources 289
CloudSim Plus Documentation, Release 1.0.0
setMaxTransferRate
public boolean setMaxTransferRate(int rate)
1.19.6 Pe
public interface Pe extends Identificable, ResourceManageableA interface to be implemented by each class that provides the basic features of a virtual or physical ProcessingElement (PE) of a PM or VM. Each Pe represents a virtual or physical processor core.
It also implements the Null Object Design Pattern in order to start avoiding NullPointerException whenusing the Pe.NULL object instead of attributing null to Pe variables.
Author Manzur Murshed, Rajkumar Buyya, Manoel Campos da Silva Filho
Fields
NULL
Pe NULLAn attribute that implements the Null Object Design Pattern for Pe objects.
Methods
getCapacity
long getCapacity()Gets the capacity of this Pe in MIPS (Million Instructions Per Second).
Returns the MIPS capacity
getPeProvisioner
PeProvisioner getPeProvisioner()Gets the PE provisioner that manages the allocation of this physical PE to virtual machines.
Returns the PE provisioner
getStatus
Status getStatus()Gets the status of the PE.
Returns the PE status
isBuzy
boolean isBuzy()Checks if the PE is buzy to be used (it’s being used).
290 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isFailed
boolean isFailed()Checks if the PE is failed.
isFree
boolean isFree()Checks if the PE is free to be used (it’s idle).
isWorking
boolean isWorking()Checks if the PE is working (not failed).
setCapacity
boolean setCapacity(long mipsCapacity)Sets the capacity of this Pe in MIPS (Million Instructions Per Second).
Parameters
• mipsCapacity – the MIPS capacity to set
Returns true if mipsCapacity > 0, false otherwise
setCapacity
boolean setCapacity(double mipsCapacity)Sets the capacity of this Pe in MIPS (Million Instructions Per Second).
It receives the amount of MIPS as a double value but converts it internally to a long. The method is just providedas a handy-way to define the PE capacity using a double value that usually is generated from some computations.
Parameters
• mipsCapacity – the MIPS capacity to set
Returns true if mipsCapacity > 0, false otherwise
setId
void setId(int id)Sets the getId().
Parameters
• id – the new PE id
1.19. org.cloudbus.cloudsim.resources 291
CloudSim Plus Documentation, Release 1.0.0
setPeProvisioner
Pe setPeProvisioner(PeProvisioner peProvisioner)Sets the getPeProvisioner() that manages the allocation of this physical PE to virtual machines. Thismethod is automatically called when a PeProvisioner is created passing a Pe instance. Thus, the PeProvi-sioner for a Pe doesn’t have to be set manually.
Parameters
• peProvisioner – the new PE provisioner
setStatus
boolean setStatus(Status status)Sets the status of the PE.
Parameters
• status – the new PE status
Returns true if the status was set, false otherwise
1.19.7 Pe.Status
enum StatusStatus of PEs.
Enum Constants
BUSY
public static final Pe.Status BUSYDenotes PE is allocated and hence busy processing some Cloudlet.
FAILED
public static final Pe.Status FAILEDDenotes PE is failed and hence it can’t process any Cloudlet at this moment. This PE is failed because it belongsto a machine which is also failed.
FREE
public static final Pe.Status FREEDenotes PE is FREE for allocation.
1.19.8 PeNull
final class PeNull implements PeA class that implements the Null Object Design Pattern for Pe class.
Author Manoel Campos da Silva Filho
292 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
See also: Pe.NULL
Methods
addCapacity
public boolean addCapacity(long capacityToAdd)
allocateResource
public boolean allocateResource(long amountToAllocate)
deallocateAllResources
public long deallocateAllResources()
deallocateAndRemoveResource
public boolean deallocateAndRemoveResource(long amountToDeallocate)
deallocateResource
public boolean deallocateResource(long amountToDeallocate)
getAllocatedResource
public long getAllocatedResource()
getAvailableResource
public long getAvailableResource()
getCapacity
public long getCapacity()
getId
public int getId()
getPeProvisioner
public PeProvisioner getPeProvisioner()
1.19. org.cloudbus.cloudsim.resources 293
CloudSim Plus Documentation, Release 1.0.0
getStatus
public Status getStatus()
isBuzy
public boolean isBuzy()
isFailed
public boolean isFailed()
isFree
public boolean isFree()
isFull
public boolean isFull()
isResourceAmountAvailable
public boolean isResourceAmountAvailable(long amountToCheck)
isResourceAmountAvailable
public boolean isResourceAmountAvailable(double amountToCheck)
isResourceAmountBeingUsed
public boolean isResourceAmountBeingUsed(long amountToCheck)
isSuitable
public boolean isSuitable(long newTotalAllocatedResource)
isWorking
public boolean isWorking()
removeCapacity
public boolean removeCapacity(long capacityToRemove)
294 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setAllocatedResource
public boolean setAllocatedResource(long newTotalAllocatedResource)
setCapacity
public boolean setCapacity(long mipsCapacity)
setCapacity
public boolean setCapacity(double mipsCapacity)
setId
public void setId(int id)
setPeProvisioner
public Pe setPeProvisioner(PeProvisioner peProvisioner)
setStatus
public boolean setStatus(Status status)
1.19.9 PeSimple
public class PeSimple extends ResourceManageableAbstract implements PePe (Processing Element) class represents a CPU core of a physical machine (PM), defined in terms of MillionsInstructions Per Second (MIPS) rating. Such a class allows managing the Pe capacity and allocation.
ASSUMPTION: All PEs under the same Machine have the same MIPS rating.
Author Manzur Murshed, Rajkumar Buyya
Constructors
PeSimple
public PeSimple(double mipsCapacity, PeProvisioner peProvisioner)Instantiates a new PE object. The id of the PE is just set when a List of PEs is assigned to a Host.
Parameters
• mipsCapacity – the capacity of the PE in MIPS (Million Instructions per Second)
• peProvisioner – the provisioner that will manage the allocation of this physical Pe forVMs
1.19. org.cloudbus.cloudsim.resources 295
CloudSim Plus Documentation, Release 1.0.0
PeSimple
public PeSimple(int id, double mipsCapacity, PeProvisioner peProvisioner)Instantiates a new PE object defining a given id. The id of the PE is just set when a List of PEs is assigned to aHost.
Parameters
• id – the PE id
• mipsCapacity – the capacity of the PE in MIPS (Million Instructions per Second)
• peProvisioner – the provisioner that will manage the allocation of this physical Pe forVMs
Methods
getId
public int getId()
getPeProvisioner
public PeProvisioner getPeProvisioner()Gets the PE provisioner that manages the allocation of this physical PE to virtual machines.
Returns the PE provisioner
getStatus
public Status getStatus()
isBuzy
public boolean isBuzy()
isFailed
public boolean isFailed()
isFree
public boolean isFree()
isWorking
public boolean isWorking()
296 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setCapacity
public boolean setCapacity(double mipsCapacity)
setId
public final void setId(int id)
setPeProvisioner
public final Pe setPeProvisioner(PeProvisioner peProvisioner)
setStatus
public final boolean setStatus(Status status)
toString
public String toString()
1.19.10 Processor
public final class Processor extends ResourceManageableAbstractA Central Unit Processing (CPU) attached to a Vm and which can have multiple cores (Pes). It’s a also called aVirtual CPU (vCPU).
Author Manoel Campos da Silva Filho
Fields
NULL
public static final Processor NULL
Constructors
Processor
public Processor(Vm vm, double pesMips, long numberOfPes)Instantiates a Processor for a given VM.
Parameters
• vm – the Vm the processor will belong to
• pesMips – MIPS of each Pe
• numberOfPes – number of Pes
1.19. org.cloudbus.cloudsim.resources 297
CloudSim Plus Documentation, Release 1.0.0
Methods
getAllocatedResource
public long getAllocatedResource()Gets the number of used PEs.
getAvailableResource
public long getAvailableResource()Gets the number of free PEs.
getCapacity
public long getCapacity()Gets the number of Pes of the Processor
getMips
public double getMips()Gets the individual MIPS of each Pe.
getTotalMips
public double getTotalMips()Gets the sum of MIPS from all Pes.
getVm
public Vm getVm()Gets the Vm the processor belongs to.
setCapacity
public boolean setCapacity(long numberOfPes)Sets the number of Pes of the Processor
Parameters
• numberOfPes – the number of PEs to set
setMips
public void setMips(double newMips)Sets the individual MIPS of each Pe.
Parameters
• newMips – the new MIPS of each PE
298 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.19.11 Ram
public final class Ram extends ResourceManageableAbstractRepresents the RAM resource of a PM or VM in Mebabytes. Such a class allows managing the RAM capacityand allocation.
Author Manoel Campos da Silva Filho
Constructors
Ram
public Ram(long capacity)Creates a new RAM resource.
Parameters
• capacity – the RAM capacity in Megabytes
1.19.12 Resource
public interface Resource extends ResourceCapacityAn interface to represent a physical or virtual resource (like RAM, CPU or Bandwidth) that doesn’t provide di-rect features to change allocated amount of resource. Objects that directly implement this interface are supposedto define the capacity and amount of allocated resource in their constructors.
Author Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
Fields
NULL
Resource NULLAn attribute that implements the Null Object Design Pattern for Resource objects.
Methods
getAllocatedResource
long getAllocatedResource()Gets the current total amount of allocated resource.
Returns amount of allocated resource
getAvailableResource
long getAvailableResource()Gets the amount of the resource that is available (free).
Returns the amount of available resource
1.19. org.cloudbus.cloudsim.resources 299
CloudSim Plus Documentation, Release 1.0.0
getPercentUtilization
double getPercentUtilization()Gets the current percentage of resource utilization in scale from 0 to 1. It is the percentage of the total resourcecapacity that is currently allocated.
Returns current resource utilization (allocation) percentage in scale from 0 to 1
isFull
boolean isFull()Checks if the resource is full or not.
Returns true if the storage is full, false otherwise
isObjectSubClassOf
static boolean isObjectSubClassOf(Object object, Class classWanted)Checks if a given object is instance of a given class.
Parameters
• object – the object to check
• classWanted – the class to verify if the object is instance of
Returns true if the object is instance of the given class, false otherwise
isObjectSubClassOf
boolean isObjectSubClassOf(Class classWanted)Checks if this object is instance of a given class.
Parameters
• classWanted – the class to verify if the object is instance of
Returns true if the object is instance of the given class, false otherwise
isResourceAmountAvailable
boolean isResourceAmountAvailable(Resource resource)Checks if there the capacity required for the given resource is available (free) at this resource. This methodis commonly used to check if there is a specific amount of resource free at a physical resource (this Resourceinstance) that is required by a virtualized resource (the given Resource).
Parameters
• resource – the resource to check if its capacity is available at the current resource
Returns true if the capacity required by the given Resource is free; false otherwise
See also: .isResourceAmountAvailable(long)
300 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isResourceAmountAvailable
boolean isResourceAmountAvailable(long amountToCheck)Checks if there is a specific amount of resource available (free).
Parameters
• amountToCheck – the amount of resource to check if is free.
Returns true if the specified amount is free; false otherwise
isResourceAmountAvailable
boolean isResourceAmountAvailable(double amountToCheck)Checks if there is a specific amount of resource available (free), where such amount is a double value that willbe converted to long.
This method is just a shorthand to avoid explicitly converting a double to long.
Parameters
• amountToCheck – the amount of resource to check if is free.
Returns true if the specified amount is free; false otherwise
See also: .isResourceAmountAvailable(long)
1.19.13 ResourceAbstract
public abstract class ResourceAbstract implements ResourceAn abstract implementation of a Resource.
Author Manoel Campos da Silva Filho
Fields
capacity
protected long capacitySee also: .getCapacity()
Constructors
ResourceAbstract
public ResourceAbstract(long capacity)
Methods
getAllocatedResource
public long getAllocatedResource()
1.19. org.cloudbus.cloudsim.resources 301
CloudSim Plus Documentation, Release 1.0.0
getCapacity
public long getCapacity()
isResourceAmountAvailable
public boolean isResourceAmountAvailable(long amountToCheck)
isResourceAmountAvailable
public boolean isResourceAmountAvailable(double amountToCheck)
isResourceAmountBeingUsed
public boolean isResourceAmountBeingUsed(long amountToCheck)
isSuitable
public boolean isSuitable(long newTotalAllocatedResource)
1.19.14 ResourceCapacity
public interface ResourceCapacityAn interface to allow getting the capacity of a given resource.
Author Manoel Campos da Silva Filho
Methods
getCapacity
long getCapacity()Gets the total capacity of the resource.
Returns the total resource capacity
1.19.15 ResourceManageable
public interface ResourceManageable extends ResourceAn interface to represent a physical or virtual resource (like RAM, CPU or Bandwidth) with features to manageresource capacity and allocation.
Author Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
302 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Fields
NULL
ResourceManageable NULLAn attribute that implements the Null Object Design Pattern for ResourceManageable objects.
Methods
addCapacity
boolean addCapacity(long capacityToAdd)Try to add a given amount to the resource capacity .
Parameters
• capacityToAdd – the amount to add
Returns true if capacityToAdd > 0, false otherwise
See also: .getAllocatedResource()
allocateResource
boolean allocateResource(long amountToAllocate)Try to allocate a given amount of the resource, reducing that amount from the total available resource.
Parameters
• amountToAllocate – the amount of resource to be allocated
Returns true if amountToAllocate > 0 and there is enough resource to allocate, false otherwise
allocateResource
boolean allocateResource(Resource resource)Try to allocate in this resource, the amount of resource specified by the capacity of the given resource. Thismethod is commonly used to allocate a specific amount from a physical resource (this Resource instance) to avirtualized resource (the given Resource).
Parameters
• resource – the resource to try to allocate its capacity from the current resource
Returns true if required capacity from the given resource > 0 and there is enough resource to allo-cate, false otherwise
See also: .allocateResource(long)
deallocateAllResources
long deallocateAllResources()Deallocates all allocated resources, restoring the total available resource to the resource capacity.
Returns the amount of resource freed
1.19. org.cloudbus.cloudsim.resources 303
CloudSim Plus Documentation, Release 1.0.0
deallocateAndRemoveResource
boolean deallocateAndRemoveResource(long amountToDeallocate)Try to deallocate a given amount of the resource and then remove such amount from the total capacity. If thegiven amount is greater than the total allocated resource, all the resource will be deallocated and that amountwill be removed from the total capacity.
Parameters
• amountToDeallocate – the amount of resource to be deallocated and then removedfrom the total capacity
Returns true if amountToDeallocate > 0 and there is enough resource to deallocate, false otherwise
deallocateResource
boolean deallocateResource(Resource resource)Try to deallocate all the capacity of the given resource from this resource. This method is commonly used todeallocate a specific amount of a physical resource (this Resource instance) that was being used by a virtualizedresource (the given Resource).
Parameters
• resource – the resource that its capacity will be deallocated
Returns true if capacity of the given resource > 0 and there is enough resource to deallocate, falseotherwise
See also: .deallocateResource(long)
deallocateResource
boolean deallocateResource(long amountToDeallocate)Try to deallocate a given amount of the resource.
Parameters
• amountToDeallocate – the amount of resource to be deallocated
Returns true if amountToDeallocate > 0 and there is enough resource to deallocate, false otherwise
isResourceAmountBeingUsed
boolean isResourceAmountBeingUsed(long amountToCheck)Checks if there is a specific amount of resource being used.
Parameters
• amountToCheck – the amount of resource to check if is used.
Returns true if the specified amount is being used; false otherwise
304 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isSuitable
boolean isSuitable(long newTotalAllocatedResource)Checks if it is possible to change the current allocated resource to a new amount, depending on the availableresource remaining.
Parameters
• newTotalAllocatedResource – the new total amount of resource to allocate.
Returns true, if it is possible to allocate the new total resource; false otherwise
removeCapacity
boolean removeCapacity(long capacityToRemove)Try to remove a given amount to the resource capacity .
Parameters
• capacityToRemove – the amount to remove
Returns true if capacityToRemove > 0, the current allocated resource is less or equal to the expectednew capacity and the capacity to remove is not higher than the current capacity; false otherwise
See also: .getAllocatedResource()
setAllocatedResource
boolean setAllocatedResource(long newTotalAllocatedResource)Try to set the current total amount of allocated resource, changing it to the given value. It doesn’t increasethe current allocated resource by the given amount, instead, it changes the allocated resource to that specifiedamount.
Parameters
• newTotalAllocatedResource – the new total amount of resource to allocate, chang-ing the allocate resource to this new amount.
Returns true if newTotalAllocatedResource is not negative and there is enough resource to allocate,false otherwise
setAllocatedResource
boolean setAllocatedResource(double newTotalAllocatedResource)Try to set the current total amount of allocated resource, changing it to the given value. It doesn’t increasethe current allocated resource by the given amount, instead, it changes the allocated resource to that specifiedamount.
This method is just a shorthand to avoid explicitly converting a double to long.
Parameters
• newTotalAllocatedResource – the new total amount of resource to allocate, chang-ing the allocate resource to this new amount.
Returns true if newTotalAllocatedResource is not negative and there is enough resource to allocate,false otherwise
1.19. org.cloudbus.cloudsim.resources 305
CloudSim Plus Documentation, Release 1.0.0
setCapacity
boolean setCapacity(long newCapacity)Try to set the resource capacity .
Parameters
• newCapacity – the new resource capacity
Returns true if capacity >= 0 and capacity >= current allocated resource, false otherwise
See also: .getAllocatedResource()
1.19.16 ResourceManageableAbstract
public abstract class ResourceManageableAbstract extends ResourceAbstract implements ResourceManageableA class that represents simple resources such as RAM, CPU, Bandwidth or Pe, storing, for instance, the resourcecapacity and amount of free available resource.
The class is abstract just to ensure there will be an specific subclass for each kind of resource, allowing todifferentiate, for instance, a RAM resource instance from a BW resource instance. The VM class also relies onthis differentiation for generically getting a required resource.
Author Uros Cibej, Anthony Sulistio, Manoel Campos da Silva Filho
Constructors
ResourceManageableAbstract
public ResourceManageableAbstract(long capacity)
Methods
addCapacity
public boolean addCapacity(long capacityToAdd)
allocateResource
public boolean allocateResource(long amountToAllocate)
deallocateAllResources
public long deallocateAllResources()
deallocateAndRemoveResource
public boolean deallocateAndRemoveResource(long amountToDeallocate)
306 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
deallocateResource
public boolean deallocateResource(long amountToDeallocate)
getAvailableResource
public long getAvailableResource()
removeCapacity
public boolean removeCapacity(long capacityToRemove)
setAllocatedResource
public boolean setAllocatedResource(long newTotalAllocatedResource)
setAvailableResource
protected final boolean setAvailableResource(long newAvailableResource)Sets the given amount as available resource.
Parameters
• newAvailableResource – the new amount of available resource to set
Returns true if availableResource > 0 and availableResource <= capacity,false otherwise
setCapacity
public boolean setCapacity(long newCapacity)
sumAvailableResource
protected boolean sumAvailableResource(long amountToSum)Sum a given amount (negative or positive) of available (free) resource to the total available resource.
Parameters
• amountToSum – the amount to sum in the current total available resource. If given a pos-itive number, increases the total available resource; otherwise, decreases the total availableresource.
Returns true if the total available resource was changed; false otherwise
toString
public String toString()
1.19. org.cloudbus.cloudsim.resources 307
CloudSim Plus Documentation, Release 1.0.0
1.19.17 ResourceManageableNull
final class ResourceManageableNull implements ResourceManageableA class that implements the Null Object Design Pattern for ResourceManageable class.
Author Manoel Campos da Silva Filho
See also: ResourceManageable.NULL
Methods
addCapacity
public boolean addCapacity(long capacityToAdd)
allocateResource
public boolean allocateResource(long amountToAllocate)
deallocateAllResources
public long deallocateAllResources()
deallocateAndRemoveResource
public boolean deallocateAndRemoveResource(long amountToDeallocate)
deallocateResource
public boolean deallocateResource(long amountToDeallocate)
getAllocatedResource
public long getAllocatedResource()
getAvailableResource
public long getAvailableResource()
getCapacity
public long getCapacity()
isFull
public boolean isFull()
308 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isResourceAmountAvailable
public boolean isResourceAmountAvailable(long amountToCheck)
isResourceAmountAvailable
public boolean isResourceAmountAvailable(double amountToCheck)
isResourceAmountBeingUsed
public boolean isResourceAmountBeingUsed(long amountToCheck)
isSuitable
public boolean isSuitable(long newTotalAllocatedResource)
removeCapacity
public boolean removeCapacity(long capacityToRemove)
setAllocatedResource
public boolean setAllocatedResource(long newTotalAllocatedResource)
setCapacity
public boolean setCapacity(long newCapacity)
1.19.18 ResourceNull
final class ResourceNull implements ResourceA class that implements the Null Object Design Pattern for Resource class.
Author Manoel Campos da Silva Filho
See also: Resource.NULL
Methods
getAllocatedResource
public long getAllocatedResource()
getAvailableResource
public long getAvailableResource()
1.19. org.cloudbus.cloudsim.resources 309
CloudSim Plus Documentation, Release 1.0.0
getCapacity
public long getCapacity()
isFull
public boolean isFull()
isResourceAmountAvailable
public boolean isResourceAmountAvailable(long amountToCheck)
1.19.19 Resourceful
public interface ResourcefulAn interface to be implemented by a machine such as a Host or Vm, that provides a polymorphic way to accessa given resource like Ram, Bandwidth, Storage or Pe from a List containing such different resources.
Author Manoel Campos da Silva Filho
Methods
getResource
ResourceManageable getResource(Class<? extends ResourceManageable> resourceClass)Gets a given Machine Resource, such as Ram or Bandwidth, from the List of machine resources.
Parameters
• resourceClass – the class of resource to get
Returns the Resource corresponding to the given class
getResources
List<ResourceManageable> getResources()Gets a read-only list of resources the machine has.
Returns a read-only list of resources
See also: .getResource(Class)
1.19.20 SanStorage
public class SanStorage extends HarddriveStorageSanStorage represents a Storage Area Network (SAN) composed of a set of hard disks connected in a LAN.Capacity of individual disks are abstracted, thus only the overall capacity of the SAN is considered.
WARNING: This class is not yet fully functional. Effects of network contention are not considered in the simu-lation. So, time for file transfer is underestimated in the presence of high network load.
Author Rodrigo N. Calheiros
310 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
SanStorage
public SanStorage(long capacity, double bandwidth, double networkLatency)Creates a new SAN with a given capacity, latency, and bandwidth of the network connection.
Parameters
• capacity – Total storage capacity of the SAN
• bandwidth – Network bandwidth (in Megabits/s)
• networkLatency – Network latency (in seconds)
Throws
• IllegalArgumentException – when the name and the capacity are not valid
SanStorage
public SanStorage(String name, long capacity, double bandwidth, double networkLatency)Creates a new SAN with a given capacity, latency, and bandwidth of the network connection and with a specificname.
Parameters
• name – the name of the new storage device
• capacity – Storage device capacity
• bandwidth – Network bandwidth (in Megabits/s)
• networkLatency – Network latency (in seconds)
Throws
• IllegalArgumentException – when the name and the capacity are not valid
Methods
addFile
public double addFile(File file)
addReservedFile
public double addReservedFile(File file)
deleteFile
public double deleteFile(File file)
1.19. org.cloudbus.cloudsim.resources 311
CloudSim Plus Documentation, Release 1.0.0
getBandwidth
public double getBandwidth()Get the bandwidth of the SAN network.
Returns the bandwidth
getMaxTransferRate
public double getMaxTransferRate()Gets the maximum transfer rate of the SAN in MByte/sec. It is defined as the minimum value between the diskrate and the SAN bandwidth. Even the bandwidth being faster the the disk rate, the max transfer rate is limitedby the disk speed.
Returns the max transfer in MEGABYTE/sec
getNetworkLatency
public double getNetworkLatency()Gets the SAN’s network latency.
Returns the SAN’s network latency
1.19.21 Storage
public final class Storage extends ResourceManageableAbstractA simple storage that just manages the device capacity and raw allocated (used) space. It doesn’t deals with filesneither with file system operations such as file inclusion or deletion. Such a class allows managing the Storagecapacity and allocation.
Author Manoel Campos da Silva Filho
Constructors
Storage
public Storage(long capacity)Creates a new Storage device.
Parameters
• capacity – the storage capacity in Megabytes
1.20 org.cloudbus.cloudsim.schedulers.cloudlet
Provides org.cloudbus.cloudsim.schedulers.cloudlet.CloudletScheduler implementationsthat are used to schedule the execution of multiple org.cloudbus.cloudsim.cloudlets.Cloudlet insidea given org.cloudbus.cloudsim.vms.Vm.
For more general information, see the package org.cloudbus.cloudsim.schedulers at the upper level.
author Manoel Campos da Silva Filho
312 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.20.1 CloudletScheduler
public interface CloudletScheduler extends SerializableAn interface to be implemented by each class that provides a policy of scheduling performed by a virtualmachine to run its Cloudlets. Each VM has to have its own instance of a CloudletScheduler.
It also implements the Null Object Design Pattern in order to start avoiding NullPointerException whenusing the CloudletScheduler.NULL object instead of attributing null to CloudletScheduler vari-ables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
CloudletScheduler NULLAn attribute that implements the Null Object Design Pattern for CloudletScheduler objects.
Methods
addCloudletToReturnedList
void addCloudletToReturnedList(Cloudlet cloudlet)Adds a Cloudlet to the list of finished Cloudlets that have been returned to its DatacenterBroker.
Parameters
• cloudlet – the Cloudlet to be added
canAddCloudletToExecutionList
boolean canAddCloudletToExecutionList(CloudletExecution cloudlet)Checks if a Cloudlet can be added to the execution list or not. Each CloudletScheduler can define a differentpolicy to indicate if a Cloudlet can be added to the execution list or not at the moment this method is called.
For instance, time-shared implementations can put all Cloudlets in the execution list, once it uses a preemptivepolicy that shares the CPU time between all running Cloudlets, even there are more Cloudlets than the numberof CPUs. That is, it might always add new Cloudlets to the execution list.
On the other hand, space-shared schedulers do not share the same CPUs between different Cloudlets. In thistype of scheduler, a CPU is only allocated to a Cloudlet when the previous Cloudlet finished its entire execution.That is, it might not always add new Cloudlets to the execution list.
Parameters
• cloudlet – Cloudlet to check if it can be added to the execution list
Returns true if the Cloudlet can be added to the execution list, false otherwise
cloudletCancel
Cloudlet cloudletCancel(int cloudletId)Cancels execution of a cloudlet.
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 313
CloudSim Plus Documentation, Release 1.0.0
Parameters
• cloudletId – ID of the cloudlet being canceled
Returns the canceled cloudlet or Cloudlet.NULL if not found
cloudletFinish
void cloudletFinish(CloudletExecution ce)Processes a finished cloudlet.
Parameters
• ce – finished cloudlet
cloudletPause
boolean cloudletPause(int cloudletId)Pauses execution of a cloudlet.
Parameters
• cloudletId – ID of the cloudlet being paused
Returns $true if cloudlet paused, $false otherwise
cloudletResume
double cloudletResume(int cloudletId)Resumes execution of a paused cloudlet.
Parameters
• cloudletId – ID of the cloudlet being resumed
Returns expected finish time of the cloudlet, 0.0 if queued or not found in the paused list
cloudletSubmit
double cloudletSubmit(Cloudlet cl, double fileTransferTime)Receives an cloudlet to be executed in the VM managed by this scheduler.
Parameters
• cl – the submitted cloudlet
• fileTransferTime – time required to move the required files from the SAN to the VM
Returns expected finish time of this cloudlet (considering the time to transfer required files from theDatacenter to the Vm), or 0 if it is in a waiting queue
cloudletSubmit
double cloudletSubmit(Cloudlet cl)Receives an cloudlet to be executed in the VM managed by this scheduler.
314 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• cl – the submitted cloudlet
Returns expected finish time of this cloudlet (considering the time to transfer required files from theDatacenter to the Vm), or 0 if it is in a waiting queue
deallocatePesFromVm
void deallocatePesFromVm(int pesToRemove)Releases a given number of PEs from a VM.
Parameters
• pesToRemove – number of PEs to deallocate
getAllocatedMipsForCloudlet
double getAllocatedMipsForCloudlet(CloudletExecution ce, double time)Gets the current allocated MIPS for cloudlet.
Parameters
• ce – the ce
• time – the time
Returns the current allocated mips for cloudlet
getCloudletExecList
List<CloudletExecution> getCloudletExecList()Gets a read-only List of cloudlets being executed on the VM.
Returns the cloudlet execution list
getCloudletFinishedList
List<CloudletExecution> getCloudletFinishedList()Gets a list of finished cloudlets.
Returns the cloudlet finished list
getCloudletList
List<Cloudlet> getCloudletList()Gets a read-only List of all cloudlets which are either waiting or executing on the VM.
Returns the list of waiting and executing cloudlets
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 315
CloudSim Plus Documentation, Release 1.0.0
getCloudletReturnedList
Set<Cloudlet> getCloudletReturnedList()Gets a read-only list of Cloudlets that finished executing and were returned the their broker. A Cloudlet isreturned to to notify the broker about the end of its execution.
getCloudletStatus
int getCloudletStatus(int cloudletId)Gets the status of a cloudlet with a given id.
Parameters
• cloudletId – ID of the cloudlet to get the status
Returns status of the cloudlet if it was found, otherwise, returns -1
getCloudletToMigrate
Cloudlet getCloudletToMigrate()Returns one cloudlet to migrate to another Vm. How the migrating cloudlet is select is defined by each classimplementing this interface.
Returns one running cloudlet
getCloudletWaitingList
List<CloudletExecution> getCloudletWaitingList()Gets a read-only List of cloudlet waiting to be executed on the VM.
Returns the cloudlet waiting list
getCurrentMipsShare
List<Double> getCurrentMipsShare()Gets a read-only list of current mips capacity from the VM that will be made available to the scheduler. Thismips share will be allocated to Cloudlets as requested.
Returns the current mips share list, where each item represents the MIPS capacity of a Pe. that isavailable to the scheduler.
getCurrentRequestedBwPercentUtilization
double getCurrentRequestedBwPercentUtilization()/** Gets the current utilization percentage of Bandwidth that the running Cloudlets are requesting (in scale from0 to 1).
Returns the BW utilization percentage from 0 to 1 (where 1 is 100%)
316 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCurrentRequestedRamPercentUtilization
double getCurrentRequestedRamPercentUtilization()Gets the current utilization percentage of RAM that the running Cloudlets are requesting (in scale from 0 to 1).
Returns the RAM utilization percentage from 0 to 1 (where 1 is 100%)
getFreePes
long getFreePes()Gets the number of PEs currently not being used.
getPacketScheduler
PacketScheduler getPacketScheduler()Gets the PacketScheduler that will be used by this CloudletScheduler to process VmPackets to be sentor received by the Vm that is assigned to the current CloudletScheduler.
Returns the PacketScheduler for this CloudletScheduler or PacketScheduler.NULL if thisscheduler will not deal with packets transmission.
getPreviousTime
double getPreviousTime()Gets the previous time when the scheduler updated the processing of cloudlets it is managing.
Returns the previous time
getRequestedCpuPercentUtilization
double getRequestedCpuPercentUtilization(double time)Gets total CPU utilization percentage of all cloudlets, according to CPU UtilizationModel of each one (in scalefrom 0 to 1, where 1 is 100%).
Parameters
• time – the time to get the current CPU utilization
Returns the total CPU utilization percentage
getRequestedMipsForCloudlet
double getRequestedMipsForCloudlet(CloudletExecution ce, double time)Gets the current requested MIPS for a given cloudlet.
Parameters
• ce – the ce
• time – the time
Returns the current requested mips for the given cloudlet
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 317
CloudSim Plus Documentation, Release 1.0.0
getUsedPes
long getUsedPes()Gets the number of currently used Pe’s.
getVm
Vm getVm()Gets the Vm that uses the scheduler.
hasFinishedCloudlets
boolean hasFinishedCloudlets()Informs if there is any cloudlet that finished to execute in the VM managed by this scheduler.
Returns $true if there is at least one finished cloudlet; $false otherwise
isCloudletReturned
boolean isCloudletReturned(Cloudlet cloudlet)Checks if a Cloudlet has finished and was returned to its DatacenterBroker.
Parameters
• cloudlet – the Cloudlet to be checked
Returns true if the Cloudlet has finished and was returned to the broker, falser otherwise
isEmpty
boolean isEmpty()Checks if there aren’t cloudlets waiting or executing inside the Vm.
Returns true if there aren’t waiting or executing Cloudlets, false otherwise.
isTherePacketScheduler
boolean isTherePacketScheduler()Checks if there is a packet scheduler assigned to this CloudletScheduler in order to enable dispatching packetsfrom and to the Vm of this CloudletScheduler.
runningCloudletsNumber
int runningCloudletsNumber()Returns the number of cloudlets running in the virtual machine.
Returns number of cloudlets running
318 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setPacketScheduler
void setPacketScheduler(PacketScheduler packetScheduler)Sets the PacketScheduler that will be used by this CloudletScheduler to process VmPackets to be sentor received by the Vm that is assigned to the current CloudletScheduler. The Vm from the CloudletScheduler isalso set to the PacketScheduler.
This attribute usually doesn’t need to be set manually. See the note at the interface for more details.
Parameters
• packetScheduler – the PacketScheduler to set for this CloudletScheduler orPacketScheduler.NULL if this scheduler will not deal with packets transmission.
setVm
void setVm(Vm vm)Sets the Vm that will use the scheduler. It is not required to manually set a Vm for the scheduler, since a Vm setsitself to the scheduler when the scheduler is assigned to the Vm.
Parameters
• vm – the Vm to set
Throws
• IllegalArgumentException – when the scheduler already is assigned to anotherVm, since each Vm must have its own scheduler
• NullPointerException – when the vm parameter is null
updateProcessing
double updateProcessing(double currentTime, List<Double> mipsShare)Updates the processing of cloudlets inside the Vm running under management of this scheduler.
Parameters
• currentTime – current simulation time
• mipsShare – list with MIPS share of each Pe available to the scheduler
Returns the predicted completion time of the earliest finishing cloudlet (which is a relative delayfrom the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet toexecute
1.20.2 CloudletSchedulerAbstract
public abstract class CloudletSchedulerAbstract implements CloudletSchedulerImplements the basic features of a CloudletScheduler, representing the policy of scheduling performedby a virtual machine to run its Cloudlets. So, classes extending this must execute Cloudlets. The inter-face for cloudlet management is also implemented in this class. Each VM has to have its own instance of aCloudletScheduler.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 319
CloudSim Plus Documentation, Release 1.0.0
Constructors
CloudletSchedulerAbstract
protected CloudletSchedulerAbstract()Creates a new CloudletScheduler object.
Methods
addCloudletToExecList
protected void addCloudletToExecList(CloudletExecution cloudlet)Adds a Cloudlet to the list of cloudlets in execution.
Parameters
• cloudlet – the Cloudlet to be added
addCloudletToFinishedList
protected void addCloudletToFinishedList(CloudletExecution cloudlet)
addCloudletToReturnedList
public void addCloudletToReturnedList(Cloudlet cloudlet)
addCloudletToWaitingList
protected void addCloudletToWaitingList(CloudletExecution cloudlet)
addWaitingCloudletToExecList
protected CloudletExecution addWaitingCloudletToExecList(CloudletExecution cloudlet)Removes a Cloudlet from waiting list and adds it to the exec list.
Parameters
• cloudlet – the cloudlet to add to to exec list
Returns the given cloudlet
cloudletCancel
public Cloudlet cloudletCancel(int cloudletId)
cloudletFinish
public void cloudletFinish(CloudletExecution ce)
320 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
cloudletPause
public boolean cloudletPause(int cloudletId)
cloudletSubmit
public double cloudletSubmit(Cloudlet cloudlet)
cloudletSubmit
public double cloudletSubmit(Cloudlet cl, double fileTransferTime)
deallocatePesFromVm
public void deallocatePesFromVm(int pesToRemove)
findCloudletInAllLists
protected Optional<CloudletExecution> findCloudletInAllLists(double cloudletId)Search for a Cloudlet into all Cloudlet lists.
Parameters
• cloudletId – the id of the Cloudlet to search for
Returns an Optional value that is able to indicate if the Cloudlet was found or not
findCloudletInList
protected Optional<CloudletExecution> findCloudletInList(double cloudletId,List<CloudletExecution> list)
Search for a Cloudlet into a given list.
Parameters
• cloudletId – the id of the Cloudlet to search for
• list – the list to search the Cloudlet into
Returns an Optional value that is able to indicate if the Cloudlet was found or not
findSuitableWaitingCloudlet
protected Optional<CloudletExecution> findSuitableWaitingCloudlet()Try to find the first Cloudlet in the waiting list which the number of required PEs is not higher than the numberof free PEs.
Returns an Optional containing the found Cloudlet or an empty Optional otherwise
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 321
CloudSim Plus Documentation, Release 1.0.0
getAllocatedMipsForCloudlet
public double getAllocatedMipsForCloudlet(CloudletExecution ce, double time)
getAvailableMipsByPe
public double getAvailableMipsByPe()Gets the amount of MIPS available (free) for each Processor PE, considering the currently executing cloudletsin this processor and the number of PEs these cloudlets require. This is the amount of MIPS that each Cloudletis allowed to used, considering that the processor is shared among all executing cloudlets.
In the case of space shared schedulers, there is no concurrency for PEs because some cloudlets may wait in aqueue until there is available PEs to be used exclusively by them.
Returns the amount of available MIPS for each Processor PE.
getCloudletExecList
public List<CloudletExecution> getCloudletExecList()
getCloudletFailedList
protected List<CloudletExecution> getCloudletFailedList()Gets the list of failed cloudlets.
Returns the cloudlet failed list.
getCloudletFinishedList
public List<CloudletExecution> getCloudletFinishedList()
getCloudletList
public List<Cloudlet> getCloudletList()
getCloudletPausedList
protected List<CloudletExecution> getCloudletPausedList()Gets the list of paused cloudlets.
Returns the cloudlet paused list
getCloudletReturnedList
public Set<Cloudlet> getCloudletReturnedList()
322 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCloudletStatus
public int getCloudletStatus(int cloudletId)
getCloudletToMigrate
public Cloudlet getCloudletToMigrate()Returns the first cloudlet in the execution list to migrate to another VM, removing it from the list.
Returns the first executing cloudlet or Cloudlet.NULL if the executing list is empty
getCloudletWaitingList
public List<CloudletExecution> getCloudletWaitingList()
getCurrentMipsShare
public List<Double> getCurrentMipsShare()
getCurrentRequestedBwPercentUtilization
public double getCurrentRequestedBwPercentUtilization()
getCurrentRequestedRamPercentUtilization
public double getCurrentRequestedRamPercentUtilization()
getEstimatedFinishTimeOfCloudlet
protected double getEstimatedFinishTimeOfCloudlet(CloudletExecution ce, double currentTime)Gets the estimated time when a given cloudlet is supposed to finish executing. It considers the amount of VmPES and the sum of PEs required by all VMs running inside the VM.
Parameters
• ce – cloudlet to get the estimated finish time
• currentTime – current simulation time
Returns the estimated finish time of the given cloudlet (which is a relative delay from the currentsimulation time)
getEstimatedFinishTimeOfSoonerFinishingCloudlet
protected double getEstimatedFinishTimeOfSoonerFinishingCloudlet(double currentTime)Gets the estimated time, considering the current time, that a next Cloudlet is expected to finish.
Parameters
• currentTime – current simulation time
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 323
CloudSim Plus Documentation, Release 1.0.0
Returns the estimated finish time of sooner finishing cloudlet (which is a relative delay from thecurrent simulation time)
getFreePes
public long getFreePes()Gets the number of PEs currently not being used.
getPacketScheduler
public PacketScheduler getPacketScheduler()
getPreviousTime
public double getPreviousTime()
getRequestedCpuPercentUtilization
public double getRequestedCpuPercentUtilization(double time)
getRequestedMipsForCloudlet
public double getRequestedMipsForCloudlet(CloudletExecution ce, double time)
getUsedPes
public long getUsedPes()
getVm
public Vm getVm()
hasFinishedCloudlets
public boolean hasFinishedCloudlets()
isCloudletReturned
public boolean isCloudletReturned(Cloudlet cloudlet)
isEmpty
public boolean isEmpty()
324 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isThereEnoughFreePesForCloudlet
protected boolean isThereEnoughFreePesForCloudlet(CloudletExecution c)Checks if the amount of PEs required by a given Cloudlet is free to use.
Parameters
• c – the Cloudlet to get the number of required PEs
Returns true if there is the amount of free PEs, false otherwise
isTherePacketScheduler
public boolean isTherePacketScheduler()
moveNextCloudletsFromWaitingToExecList
protected void moveNextCloudletsFromWaitingToExecList()Selects the next Cloudlets in the waiting list to move to the execution list in order to start executing them. Whilethere is enough free PEs, the method try to find a suitable Cloudlet in the list, until it reaches the end of such alist.
The method might also exchange some cloudlets in the execution list with some in the waiting list. Thus,some running cloudlets may be preempted to give opportunity to previously waiting cloudlets to run. This is aprocess called context switch. However, each CloudletScheduler implementation decides how such a processis implemented. For instance, Space-Shared schedulers may just perform context switch just after currentlyrunning Cloudlets completely finish executing.
This method is called internally by the CloudletScheduler.updateProcessing(double,List)one.
processCloudletSubmit
protected double processCloudletSubmit(CloudletExecution ce, double fileTransferTime)Process a Cloudlet after it is received by the cloudletSubmit(Cloudlet,double) method, that createsa CloudletExecution object to encapsulate the submitted Cloudlet and record execution data.
Parameters
• ce – the CloudletExecutionInfo that encapsulates the Cloudlet object
• fileTransferTime – time required to move the required files from the SAN to the VM
Returns expected finish time of this cloudlet (considering the time to transfer required files from theDatacenter to the Vm), or 0 if it is in a waiting queue
removeCloudletFromExecList
protected CloudletExecution removeCloudletFromExecList(CloudletExecution cloudlet)Removes a Cloudlet from the list of cloudlets in execution.
Parameters
• cloudlet – the Cloudlet to be removed
Returns the removed Cloudlet or CloudletExecution.NULL if not found
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 325
CloudSim Plus Documentation, Release 1.0.0
runningCloudletsNumber
public int runningCloudletsNumber()
setCurrentMipsShare
protected void setCurrentMipsShare(List<Double> currentMipsShare)Sets the list of current mips share available for the VM using the scheduler.
Parameters
• currentMipsShare – the new current mips share
See also: .getCurrentMipsShare()
setPacketScheduler
public void setPacketScheduler(PacketScheduler packetScheduler)
setPreviousTime
protected final void setPreviousTime(double previousTime)Sets the previous time when the scheduler updated the processing of cloudlets it is managing.
Parameters
• previousTime – the new previous time
setVm
public void setVm(Vm vm)
sortCloudletWaitingList
protected void sortCloudletWaitingList(Comparator<CloudletExecution> comparator)Sorts the cloudletWaitingList using a given Comparator.
Parameters
• comparator – the Comparator to sort the Waiting Cloudlets List
timeSpan
protected double timeSpan(CloudletExecution cl, double currentTime)Computes the time span between the current simulation time and the last time the processing of a cloudlet wasupdated.
Parameters
• cl – the cloudlet to compute the execution time span
• currentTime – the current simulation time
326 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
updateCloudletProcessing
protected void updateCloudletProcessing(CloudletExecution ce, double currentTime)Updates the processing of a specific cloudlet of the Vm using this scheduler.
Parameters
• ce – The cloudlet to be its processing updated
• currentTime – current simulation time
updateProcessing
public double updateProcessing(double currentTime, List<Double> mipsShare)
1.20.3 CloudletSchedulerCompletelyFair
public final class CloudletSchedulerCompletelyFair extends CloudletSchedulerTimeSharedA simplified implementation of the Completely Fair Scheduler (CFS) that is the default scheduler used for mosttasks on recent Linux Kernel. It is a time-shared scheduler that shares CPU cores between running applicationsby preempting them after a time period (timeslice) to allow other ones to start executing during their timeslices.
This scheduler supposes that Cloudlets priorities are in the range from [-20 to 19], as used in Linux Kernel.Despite setting Cloudlets priorities with values outside this interval will work as well, one has to realize thatlower priorities are defined by negative values.
It is a basic implementation that covers the following features:
• Defines a general runqueue (the waiting list which defines which Cloudlets to run next) for all CPU cores(Pe) instead of one for each core. More details in the listing below.
• Computes process (Cloudlet) niceness based on its priority: niceness = -priority. The nicevalue (niceness) defines how nice a process is to the other ones. Lower niceness (negative values) rep-resents higher priority and consequently higher weight, while higher niceness (positive values) representlower priority and lower weight.
• Computes process timeslice based on its weight, that in turn is computed based on its niceness. Thetimeslice is the amount of time that a process is allowed to use the CPU before be preempted to makeroom for other process to run. The CFS scheduler uses a dynamic defined timeslice.
And it currently DOES NOT implement the following features:
• Additional overhead for CPU context switch: the context switch is the process of removing an applicationthat is using a CPU core to allow another one to start executing. This is the task preemption process thatallows a core to be shared between several applications.
• Since this scheduler does not consider context switch overhead, there is only one runqueue (waiting list)for all CPU cores because each application is not in fact assigned to a specific CPU core. The schedulerjust computes how much computing power (in MIPS) and number of cores each application can use andthat MIPS capacity is multiplied by the number of cores the application requires. Such an approach thenenables the application to execute that number of instructions per second. Once the PEs do not in fact runthe application, (application execution is simulated just computing the amount of instructions that can berun), it doesn’t matter which PEs are “running” the application.
• It doesn’t use a Red-Black tree (such as the TreeSet), as in real implementations of CFS, to sort wait-ing Cloudlets (runqueue list) increasingly, based on their virtual runtime (vruntime or VRT) (placing theCloudlets that have run the least at the top of the tree). Furthermore, the use of such a data structure addedsome complexity to the implementation. Since different Cloudlets may have the same virtual runtime, this
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 327
CloudSim Plus Documentation, Release 1.0.0
introduced some issues when adding or removing elements in a structure such as the TreeSet, that requireseach value (the virtual runtime in this case) used to sort the Set to be unique.
NOTES:
• The time interval for updating cloudlets execution in this scheduler is not primarily defined bythe Datacenter.getSchedulingInterval(), but by the timeslice computed based onthe defined getLatency(). Each time the computed timeslice is greater than the Datacenterscheduling interval, then the next update of Cloudlets processing will follow the Datacenter.getSchedulingInterval().
• The implementation was based on the book of Robert Love: Linux Kernel Development, 3rd ed. Addison-Wesley, 2010 and some other references listed below.
Author Manoel Campos da Silva Filho
See also: Inside the Linux 2.6 Completely Fair Scheduler, Learn Linux, 101: Process execution priorities,Towards achieving fairness in the Linux scheduler, The Linux scheduler, kernel.org: CFS Scheduler Design,Linux Scheduler FAQ
Methods
canAddCloudletToExecutionList
public boolean canAddCloudletToExecutionList(CloudletExecution cloudlet)Checks if a Cloudlet can be submitted to the execution list. This scheduler, different from its time-shared parent,only adds submitted Cloudlets to the execution list if there is enough free PEs. Otherwise, such Cloudlets areadded to the waiting list, really enabling time-sharing between running Cloudlets. By this way, some Cloudletshave to be preempted to allow other ones to be executed.
Parameters
• cloudlet – @inheritDoc
Returns @inheritDoc
computeCloudletTimeSlice
protected double computeCloudletTimeSlice(CloudletExecution cloudlet)Computes the timeslice for a Cloudlet, which is the amount of time (in seconds) that it will have to use the PEs,considering all Cloudlets in the executing list.
The timeslice is computed considering the Cloudlet weight and what it represents in percentage of theweight sum of all cloudlets in the execution list.
Parameters
• cloudlet – Cloudlet to get the timeslice
Returns Cloudlet timeslice (in seconds)
See also: .getCloudletWeight(CloudletExecution), .getWeightSumOfRunningCloudlets()
328 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
findSuitableWaitingCloudlet
protected Optional<CloudletExecution> findSuitableWaitingCloudlet()@inheritDoc The cloudlet waiting list (runqueue) is sorted according to the virtual runtime (vruntime orVRT), which indicates the amount of time the Cloudlet has run. This runtime increases as the Cloudlet executes.
Returns @inheritDoc
getCloudletExecList
public List<CloudletExecution> getCloudletExecList()@inheritDoc
Prior to start executing, a Cloudlet is added to this list. When the Cloudlet vruntime reaches its times-lice (the amount of time it can use the CPU), it is removed from this list and added back to thegetCloudletWaitingList().
The sum of the PEs of Cloudlets into this list cannot exceeds the number of PEs available for the scheduler. Ifthe sum of PEs of such Cloudlets is less than the number of existing PEs, there are idle PEs. Since the CPUcontext switch overhead is not regarded in this implementation and as result, it doesn’t matter which PEs arerunning which Cloudlets, there is not such information in anywhere. As an example, if the first Cloudlet requires2 PEs, then one can say that it is using the first 2 PEs. But if at the next simulation time the same Cloudlet canbe at the 3º position in this Collection, indicating that now it is using the 3º and 4º Pe, which doesn’t changeanything. In real schedulers, usually a process is pinned to a specific set of cores until it finishes executing, toavoid the overhead of changing processes from a run queue to another unnecessarily.
getCloudletNiceness
protected double getCloudletNiceness(CloudletExecution cloudlet)Gets the nice value from a Cloudlet based on its priority. The nice value is the opposite of the priority.
As “niceness” is a terminology defined by specific schedulers (such as Linux Schedulers), it is not defined insidethe Cloudlet.
Parameters
• cloudlet – Cloudlet to get the nice value
Returns the cloudlet niceness
See also: Man Pages: Nice values for Linux processes
getCloudletWaitingList
public List<CloudletExecution> getCloudletWaitingList()Gets a read-only list of Cloudlets which are waiting to run, the so called run queue.
NOTE: Different from real implementations, this scheduler uses just one run queue for all processor cores(PEs). Since CPU context switch is not concerned, there is no point in using different run queues.
getCloudletWeight
protected double getCloudletWeight(CloudletExecution cloudlet)Gets the weight of the Cloudlet to use the CPU, that is defined based on its niceness. As greater is the weight,
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 329
CloudSim Plus Documentation, Release 1.0.0
more time the Cloudlet will have to use the PEs.
As the timelice assigned to a Cloudlet to use the CPU is defined exponentially instead of linearly accordingto its niceness, this method is used as the base to correctly compute the timeslice.
NOTICE: The formula used is based on the book referenced at the class documentation.
Parameters
• cloudlet – Cloudlet to get the weight to use PEs
Returns the cloudlet weight to use PEs
See also: .getCloudletNiceness(CloudletExecution)
getLatency
public int getLatency()Gets the latency, which is the amount of time (in seconds) the scheduler will allow the execution of runningCloudlets in the available PEs, before checking which are the next Cloudlets to execute. The latency timeis divided by the number of the number of Cloudlets that can be executed at the current time. If there are4 Cloudlets by just 2 PEs, the latency is divided by 2, because only 2 Cloudlets can be concurrently exe-cuted at the moment. However, the minimum amount of time allocated to each Cloudlet is defined by thegetMinimumGranularity().
As lower is the latency, more responsive a real operating system will be perceived by users, at the cost or morefrequent CPU context Datacenter (that reduces CPU throughput). However, CPU context switch overhead isnot being considered.
NOTE: The default value for linux scheduler is 0.02s.
getMinimumGranularity
public int getMinimumGranularity()Gets the minimum granularity that is the minimum amount of time (in seconds) that is assigned to each Cloudletto execute.
This minimum value is used to reduce the frequency of CPU context Datacenter, that degrade CPU throughput.However, CPU context switch overhead is not being considered. By this way, it just ensures that eachCloudlet will not use the CPU for less than the minimum granularity.
The default value for linux scheduler is 0.001s
See also: .getLatency()
moveNextCloudletsFromWaitingToExecList
protected void moveNextCloudletsFromWaitingToExecList()Checks which Cloudlets in the execution list has the virtual runtime equals to its allocated time slice and preemptthem, getting the most priority Cloudlets in the waiting list (that is those ones in the beginning of the list).
See also: .preemptExecCloudletsWithExpiredVRuntimeAndMoveToWaitingList()
330 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processCloudletSubmit
public double processCloudletSubmit(CloudletExecution ce, double fileTransferTime)@inheritDoc
It also sets the initial virtual runtime for the given Cloudlet in order to define how long the Cloudlet has executedyet. See computeCloudletInitialVirtualRuntime(CloudletExecution) for more details.
Parameters
• ce – @inheritDoc
• fileTransferTime – @inheritDoc
setLatency
public void setLatency(int latency)Sets the latency time (in seconds).
Parameters
• latency – the latency to set
Throws
• IllegalArgumentException – when latency is lower than minimum granularity
See also: .getLatency()
setMinimumGranularity
public void setMinimumGranularity(int minimumGranularity)Sets the minimum granularity that is the minimum amount of time (in seconds) that is assigned to each Cloudletto execute.
Parameters
• minimumGranularity – the minimum granularity to set
Throws
• IllegalArgumentException – when minimum granularity is greater than latency
updateCloudletProcessing
public void updateCloudletProcessing(CloudletExecution ce, double currentTime)
updateProcessing
public double updateProcessing(double currentTime, List<Double> mipsShare)@inheritDoc
Parameters
• currentTime – @inheritDoc
• mipsShare – @inheritDoc
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 331
CloudSim Plus Documentation, Release 1.0.0
Returns the shorter timeslice assigned to the running cloudlets (which defines the time of the nextexpiring Cloudlet, enabling the preemption process), or Double.MAX_VALUE if there is nonext events
1.20.4 CloudletSchedulerNull
final class CloudletSchedulerNull implements CloudletSchedulerA class that implements the Null Object Design Pattern for CloudletScheduler class.
Author Manoel Campos da Silva Filho
See also: CloudletScheduler.NULL
Methods
addCloudletToReturnedList
public void addCloudletToReturnedList(Cloudlet cloudlet)
canAddCloudletToExecutionList
public boolean canAddCloudletToExecutionList(CloudletExecution cloudlet)
cloudletCancel
public Cloudlet cloudletCancel(int cloudletId)
cloudletFinish
public void cloudletFinish(CloudletExecution ce)
cloudletPause
public boolean cloudletPause(int cloudletId)
cloudletResume
public double cloudletResume(int cloudletId)
cloudletSubmit
public double cloudletSubmit(Cloudlet cl, double fileTransferTime)
cloudletSubmit
public double cloudletSubmit(Cloudlet cl)
332 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
deallocatePesFromVm
public void deallocatePesFromVm(int pesToRemove)
getAllocatedMipsForCloudlet
public double getAllocatedMipsForCloudlet(CloudletExecution ce, double time)
getCloudletExecList
public List<CloudletExecution> getCloudletExecList()
getCloudletFinishedList
public List<CloudletExecution> getCloudletFinishedList()
getCloudletList
public List<Cloudlet> getCloudletList()
getCloudletReturnedList
public Set<Cloudlet> getCloudletReturnedList()
getCloudletStatus
public int getCloudletStatus(int cloudletId)
getCloudletToMigrate
public Cloudlet getCloudletToMigrate()
getCloudletWaitingList
public List<CloudletExecution> getCloudletWaitingList()
getCurrentMipsShare
public List<Double> getCurrentMipsShare()
getCurrentRequestedBwPercentUtilization
public double getCurrentRequestedBwPercentUtilization()
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 333
CloudSim Plus Documentation, Release 1.0.0
getCurrentRequestedRamPercentUtilization
public double getCurrentRequestedRamPercentUtilization()
getFreePes
public long getFreePes()
getPacketScheduler
public PacketScheduler getPacketScheduler()
getPreviousTime
public double getPreviousTime()
getRequestedCpuPercentUtilization
public double getRequestedCpuPercentUtilization(double time)
getRequestedMipsForCloudlet
public double getRequestedMipsForCloudlet(CloudletExecution ce, double time)
getUsedPes
public long getUsedPes()
getVm
public Vm getVm()
hasFinishedCloudlets
public boolean hasFinishedCloudlets()
isCloudletReturned
public boolean isCloudletReturned(Cloudlet cloudlet)
isEmpty
public boolean isEmpty()
334 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isTherePacketScheduler
public boolean isTherePacketScheduler()
runningCloudletsNumber
public int runningCloudletsNumber()
setPacketScheduler
public void setPacketScheduler(PacketScheduler packetScheduler)
setVm
public void setVm(Vm vm)
updateProcessing
public double updateProcessing(double currentTime, List<Double> mipsShare)
1.20.5 CloudletSchedulerSpaceShared
public class CloudletSchedulerSpaceShared extends CloudletSchedulerAbstractCloudletSchedulerSpaceShared implements a policy of scheduling performed by a virtual machine to run itsCloudlets. It considers there will be only one Cloudlet per VM. Other Cloudlets will be in a waiting list. Italso considers that the time to transfer Cloudlets to the Vm happens before Cloudlet starts executing. I.e., eventhough Cloudlets must wait for CPU, data transfer happens as soon as Cloudlets are submitted.
This scheduler does not consider Cloudlets priorities to define execution order. If actual priorities are definedfor Cloudlets, they are just ignored by the scheduler.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Methods
canAddCloudletToExecutionList
public boolean canAddCloudletToExecutionList(CloudletExecution cloudlet)The space-shared scheduler does not share the CPU time between executing cloudlets. Each CPU (Pe) is usedby another Cloudlet just when the previous Cloudlet using it has finished executing completely. By this way, ifthere are more Cloudlets than PEs, some Cloudlet will not be allowed to start executing immediately.
Parameters
• cloudlet – @inheritDoc
Returns @inheritDoc
1.20. org.cloudbus.cloudsim.schedulers.cloudlet 335
CloudSim Plus Documentation, Release 1.0.0
cloudletResume
public double cloudletResume(int cloudletId)
1.20.6 CloudletSchedulerTimeShared
public class CloudletSchedulerTimeShared extends CloudletSchedulerAbstractCloudletSchedulerTimeShared implements a policy of scheduling performed by a virtual machine to run itsCloudlets. Cloudlets execute in time-shared manner in VM. Each VM has to have its own instance of aCloudletScheduler. This scheduler does not consider Cloudlets priorities to define execution order. If actualpriorities are defined for Cloudlets, they are just ignored by the scheduler.
It also does not perform a preemption process in order to move running Cloudlets to the waiting list in orderto make room for other already waiting Cloudlets to run. It just imposes there is not waiting Cloudlet, over-simplifying the problem considering that for a given simulation second t, the total processing capacity of theprocessor cores (in MIPS) is equally divided by the applications that are using them.
In processors enabled with Hyper-threading technology (HT), it is possible to run up to 2 processes at the samephysical CPU core. However, usually just the Host operating system scheduler (a VmScheduler assigned toa Host) has direct knowledge of HT to accordingly schedule up to 2 processes to the same physical CPU core.Further, this scheduler implementation oversimplifies a possible HT for the virtual PEs, allowing that more than2 processes to run at the same core.
Since this CloudletScheduler implementation does not account for the context switch overhead, this oversim-plification impacts tasks completion by penalizing equally all the Cloudlets that are running on the same CPUcore. Other impact is that, if there are Cloudlets of the same length running in the same PEs, they will finishexactly at the same time. On the other hand, on a real time-shared scheduler these Cloudlets will finish almostin the same time.
As an example, consider a scheduler that has 1 PE that is able to execute 1000 MI/S (MIPS) and is runningCloudlet 0 and Cloudlet 1, each of having 5000 MI of length. These 2 Cloudlets will spend 5 seconds to finish.Now consider that the time slice allocated to each Cloudlet to execute is 1 second. As at every 1 second adifferent Cloudlet is allowed to run, the execution path will be as follows: Time (second): 00 01 02 03 04 05Cloudlet (id): C0 C1 C0 C1 C0 C1 As one can see, in a real time-shared scheduler that does not define prioritiesfor applications, the 2 Cloudlets will in fact finish in different times. In this example, one Cloudlet will finish 1second after the other.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
See also: CloudletSchedulerCompletelyFair
Methods
canAddCloudletToExecutionList
public boolean canAddCloudletToExecutionList(CloudletExecution cloudlet)This time-shared scheduler shares the CPU time between all executing cloudlets, giving the same CPU timeslicefor each Cloudlet to execute. It always allow any submitted Cloudlets to be immediately added to the executionlist. By this way, it doesn’t matter what Cloudlet is being submitted, since it will always include it in theexecution list.
Parameters
• cloudlet – the Cloudlet that will be added to the execution list.
336 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns always true to indicate that any submitted Cloudlet can be immediately added to the exe-cution list
cloudletResume
public double cloudletResume(int cloudletId)
getCloudletWaitingList
public List<CloudletExecution> getCloudletWaitingList()@inheritDoc
For this scheduler, this list is always empty, once the VM PEs are shared across all Cloudlets running inside aVM. Each Cloudlet has the opportunity to use the PEs for a given timeslice.
Returns @inheritDoc
1.21 org.cloudbus.cloudsim.schedulers.cloudlet.network
Provides org.cloudbus.cloudsim.schedulers.cloudlet.network.PacketScheduler imple-mentations to perform network packet dispatching by a regular org.cloudbus.cloudsim.schedulers.cloudlet.CloudletScheduler. Such PacketSchedulers are attached to a CloudletScheduler to receive/sendpackets from/to a Cloudlet.
author Manoel Campos da Silva Filho
1.21.1 PacketScheduler
public interface PacketSchedulerProvides the functionalities to enable a CloudletScheduler to send VmPackets from the Vm of the sched-uler to other ones or to receive VmPackets sent from other VMs to that Vm. The packet dispatching is per-formed by processing CloudletTasks inside a NetworkCloudlet.
A researcher creating its own simulations using CloudSim Plus usually doesn’t have to care about thisclass, since even creating network-enabled simulations using objects such as NetworkDatacenter,NetworkHost, NetworkVm and NetworkCloudlet, the NetworkHost will automatically create andinstance of the current interface and attach them to the CloudletScheduler that every Vm is using, doesn’tmatter what kind of scheduler it is.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Fields
NULL
PacketScheduler NULLAn attribute that implements the Null Object Design Pattern for PacketScheduler objects.
1.21. org.cloudbus.cloudsim.schedulers.cloudlet.network 337
CloudSim Plus Documentation, Release 1.0.0
Methods
addPacketToListOfPacketsSentFromVm
boolean addPacketToListOfPacketsSentFromVm(VmPacket pkt)Adds a packet to the list of packets sent by a given VM, targeting the VM of this scheduler. The source VM isgot from the packet.
Parameters
• pkt – packet to be added to the list
Returns true if the packet was added, false otherwise
clearVmPacketsToSend
void clearVmPacketsToSend()Clears the list of VmPacket’s to send from the Vm of this scheduler to other VMs.
getVm
Vm getVm()Gets the Vm that the PacketScheduler will sent packets from or receive packets to.
getVmPacketsToSend
List<VmPacket> getVmPacketsToSend()Gets a read-only list of VmPacket’s to send from the Vm of this scheduler to other VMs.
Returns a read-only VmPacket list
isTimeToUpdateCloudletProcessing
boolean isTimeToUpdateCloudletProcessing(Cloudlet cloudlet)Checks if is time to update the execution of a given Cloudlet. If the Cloudlet is waiting for packets to be sent orreceived, then it isn’t time to update its processing.
Parameters
• cloudlet – the Cloudlet to check if it is time to update its execution
Returns true if its timie to update Cloudlet execution, false otherwise.
processCloudletPackets
void processCloudletPackets(Cloudlet cloudlet, double currentTime)Process the packets to be sent from or received by a Cloudlet inside the vm.
Parameters
• cloudlet – the Cloudlet to process packets
• currentTime – current simulation time
338 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setVm
void setVm(Vm vm)Sets the Vm that the PacketScheduler will sent packets from or receive packets to. It is not required to manuallyset a Vm for the PacketScheduler, since the NetworkHost does it when it creates a Vm.
Parameters
• vm – the Vm to set
1.21.2 PacketSchedulerNull
final class PacketSchedulerNull implements PacketSchedulerA class that implements the Null Object Design Pattern for PacketScheduler class.
Author Manoel Campos da Silva Filho
See also: PacketScheduler.NULL
Methods
addPacketToListOfPacketsSentFromVm
public boolean addPacketToListOfPacketsSentFromVm(VmPacket pkt)
clearVmPacketsToSend
public void clearVmPacketsToSend()
getVm
public Vm getVm()
getVmPacketsToSend
public List<VmPacket> getVmPacketsToSend()
isTimeToUpdateCloudletProcessing
public boolean isTimeToUpdateCloudletProcessing(Cloudlet cloudlet)@inheritDoc
Parameters
• cloudlet – @inheritDoc
Returns always returns true to indicate that if this NULL Object is being used, no network packetswill be processed by the CloudletScheduler that this object is assigned to. By this way,the processing of Cloudlets must be always updated because the Cloudlet doesn’t have to waitfor packets dispatch or reception.
1.21. org.cloudbus.cloudsim.schedulers.cloudlet.network 339
CloudSim Plus Documentation, Release 1.0.0
processCloudletPackets
public void processCloudletPackets(Cloudlet cloudlet, double currentTime)
setVm
public void setVm(Vm vm)
1.21.3 PacketSchedulerSimple
public class PacketSchedulerSimple implements PacketSchedulerImplements a policy of scheduling performed by a virtual machine to process network packets to be sent orreceived by its NetworkCloudlet’s. It also schedules the network communication among the cloudlets,managing the time a cloudlet stays blocked waiting the response of a network package sent to another cloudlet.
Author Saurabh Kumar Garg, Manoel Campos da Silva Filho
Constructors
PacketSchedulerSimple
public PacketSchedulerSimple()Creates a PacketSchedulerSimple object.
Methods
addPacketToListOfPacketsSentFromVm
public boolean addPacketToListOfPacketsSentFromVm(VmPacket pkt)
clearVmPacketsToSend
public void clearVmPacketsToSend()
getVm
public Vm getVm()
getVmPacketsToSend
public List<VmPacket> getVmPacketsToSend()
isTimeToUpdateCloudletProcessing
public boolean isTimeToUpdateCloudletProcessing(Cloudlet cloudlet)
340 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
processCloudletPackets
public void processCloudletPackets(Cloudlet cloudlet, double currentTime)
setVm
public void setVm(Vm vm)
1.22 org.cloudbus.cloudsim.schedulers.vm
Provides org.cloudbus.cloudsim.schedulers.vm.VmScheduler implementations that are used toschedule the execution of multiple org.cloudbus.cloudsim.vms.Vm inside a given org.cloudbus.cloudsim.hosts.Host.
For more general information, see the package org.cloudbus.cloudsim.schedulers at the upper level.
author Manoel Campos da Silva Filho
1.22.1 VmScheduler
public interface VmSchedulerAn interface that represents the policy used by a Virtual Machine Monitor (VMM) to share processing powerof a PM among VMs running in a host. Each host has to use is own instance of a VmScheduler that will soschedule the allocation of host’s PEs for VMs running on it.
It also implements the Null Object Design Pattern in order to start avoiding NullPointerException whenusing the VmScheduler.NULL object instead of attributing null to VmScheduler variables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
VmScheduler NULLAn attribute that implements the Null Object Design Pattern for VmScheduler objects.
Methods
allocatePesForVm
boolean allocatePesForVm(Vm vm, List<Double> requestedMips)Requests the allocation of PEs for a VM.
Parameters
• vm – the vm to allocate PEs to
• requestedMips – the list of MIPS share to be allocated to a VM
Returns true if the PEs were allocated to the VM, false otherwise
1.22. org.cloudbus.cloudsim.schedulers.vm 341
CloudSim Plus Documentation, Release 1.0.0
allocatePesForVm
boolean allocatePesForVm(Vm vm)Requests the allocation of PEs for a VM, according to the number of PEs and MIPS defined by VM attributes.
Parameters
• vm – the vm to allocate PEs to
Returns true if the PEs were allocated to the VM, false otherwise
deallocatePesForAllVms
void deallocatePesForAllVms()Releases PEs allocated to all the VMs of the host the VmScheduler is associated to. After that, all PEs will beavailable to be used on demand for requesting VMs.
deallocatePesFromVm
void deallocatePesFromVm(Vm vm)Releases all PEs allocated to a VM. After that, the PEs may be used on demand by other VMs.
Parameters
• vm – the vm to deallocate PEs from
deallocatePesFromVm
void deallocatePesFromVm(Vm vm, int pesToRemove)Releases a given number of PEs from a VM. After that, the PEs may be used on demand by other VMs.
Parameters
• vm – the vm to deallocate PEs from
• pesToRemove – number of PEs to deallocate
getAllocatedMips
List<Double> getAllocatedMips(Vm vm)Gets the MIPS share of each host’s Pe that is allocated to a given VM.
Parameters
• vm – the vm to get the MIPS share
getAvailableMips
double getAvailableMips()Gets the total amount of MIPS that is currently free. If there are VMs migrating into the Host, their requestedMIPS will already be allocated, reducing the total available MIPS.
342 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getHost
Host getHost()Gets the host that the VmScheduler get the list of PEs to allocate to VMs.
getMaxAvailableMips
double getMaxAvailableMips()Gets the maximum available MIPS among all the host’s PEs.
getMaxCpuUsagePercentDuringOutMigration
double getMaxCpuUsagePercentDuringOutMigration()Gets the max percentage of CPU a VM migrating out of this Host can use. Since there may be an overheadassociated to the migration process (if the CPU overhead for VM migration is greater than 0), duringthe migration, the amount of MIPS the VM can use is reduced due to this overhead.
Returns the max percentage of CPU usage during migration (in scale from [0 to 1], where 1 is100%)
getPeCapacity
long getPeCapacity()Gets PE capacity in MIPS.
getRequestedMips
List<Double> getRequestedMips(Vm vm)Gets a copy of the List of MIPS requested by a VM, avoiding the original list to be changed.
Parameters
• vm – the VM to get the List of requested MIPS
getTotalAllocatedMipsForVm
double getTotalAllocatedMipsForVm(Vm vm)Gets the actual total allocated MIPS for a VM along all its allocated PEs. If the VM is migrating into theHost, then just a fraction of the requested MIPS is actually allocated, representing the overhead of the migrationprocess.
The MIPS requested by the VM are just actually allocated after the migration is completed.
Parameters
• vm – the VM to get the total allocated MIPS
See also: .getVmMigrationCpuOverhead()
1.22. org.cloudbus.cloudsim.schedulers.vm 343
CloudSim Plus Documentation, Release 1.0.0
getVmMigrationCpuOverhead
double getVmMigrationCpuOverhead()Defines the percentage of Host’s CPU usage increase when a VM is migrating in or out of the Host. The valueis in scale from 0 to 1 (where 1 is 100%).
Returns the Host’s CPU migration overhead percentage.
getWorkingPeList
<T extends Pe> List<T> getWorkingPeList()Gets the list of working PEs from the Host, which excludes failed PEs.
Parameters
• <T> – the generic type
isAllowedToAllocateMips
boolean isAllowedToAllocateMips(List<Double> vmRequestedMipsShare)Checks if a list of MIPS requested by a VM is allowed to be allocated or not. Depending on the VmSchedulerimplementation, the return value of this method may have different effects:
• true: requested MIPS will be allocated, partial or totally, depending on the available MIPS and theVmScheduler implementation;
• false: requested MIPS will not be allocated because there is no availability at all or there is just a par-tial amount of the requested MIPS available and the VmScheduler implementation doesn’t allow al-locating less than the VM is requesting. If less than the required MIPS is allocated to a VM, it willcause performance degradation. Such situation defines an over-subscription situation which just specificVmSchedulers accept.
Parameters
• vmRequestedMipsShare – a list of MIPS requested by a VM
Returns true if the requested MIPS List is allowed to be allocated to the VM, false otherwise
isSuitableForVm
boolean isSuitableForVm(Vm vm)Checks if the PM using this scheduler has enough MIPS capacity to host a given VM.
Parameters
• vm – the vm to check if there is enough available resource on the PM to host it
Returns true, if it is possible to allocate the the VM into the host; false otherwise
isSuitableForVm
boolean isSuitableForVm(List<Double> vmMipsList)Checks if the PM using this scheduler has enough MIPS capacity to host a given VM.
Parameters
344 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• vmMipsList – a List with the MIPS capacity required by each VM PE
Returns true, if it is possible to allocate the the VM into the host; false otherwise
setHost
VmScheduler setHost(Host host)Sets the host that the VmScheduler get the list of PEs to allocate to VMs. A host for the VmScheduler is setwhen the VmScheduler is set to a given host. Thus, the host is in charge to set itself to a VmScheduler.
Parameters
• host – the host to be set
Throws
• IllegalArgumentException – when the scheduler already is assigned to anotherHost, since each Host must have its own scheduler
• NullPointerException – when the host parameter is null
1.22.2 VmSchedulerAbstract
public abstract class VmSchedulerAbstract implements VmSchedulerAn abstract class for implementation of VmSchedulers.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
DEFAULT_VM_MIGRATION_CPU_OVERHEAD
public static final double DEFAULT_VM_MIGRATION_CPU_OVERHEADThe default percentage to define the CPU overhead of VM migration if one is not explicitly set.
See also: .getVmMigrationCpuOverhead()
Constructors
VmSchedulerAbstract
public VmSchedulerAbstract(double vmMigrationCpuOverhead)Creates a VmScheduler, defining a CPU overhead for VM migration.
Parameters
• vmMigrationCpuOverhead – the percentage of Host’s CPU usage increase when aVM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).
Methods
allocatePesForVm
public final boolean allocatePesForVm(Vm vm)
1.22. org.cloudbus.cloudsim.schedulers.vm 345
CloudSim Plus Documentation, Release 1.0.0
allocatePesForVm
public final boolean allocatePesForVm(Vm vm, List<Double> requestedMips)
allocatePesForVmInternal
protected abstract boolean allocatePesForVmInternal(Vm vm, List<Double> mipsShareRequested)
deallocatePesForAllVms
public void deallocatePesForAllVms()
deallocatePesFromVm
public void deallocatePesFromVm(Vm vm)
deallocatePesFromVm
public void deallocatePesFromVm(Vm vm, int pesToRemove)
deallocatePesFromVmInternal
protected abstract void deallocatePesFromVmInternal(Vm vm, int pesToRemove)
getAllocatedMips
public List<Double> getAllocatedMips(Vm vm)
getAllocatedMipsMap
protected Map<Vm, List<Double>> getAllocatedMipsMap()Gets the map of VMs to MIPS, were each key is a VM and each value is the List of currently allocated MIPSfrom the respective physical PEs which are being used by such a VM.
Returns the mips map
See also: .getAllocatedMips(Vm)
getAvailableMips
public double getAvailableMips()
getHost
public Host getHost()
346 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getMaxAvailableMips
public double getMaxAvailableMips()
getMaxCpuUsagePercentDuringOutMigration
public double getMaxCpuUsagePercentDuringOutMigration()
getMipsShareRequestedReduced
protected List<Double> getMipsShareRequestedReduced(Vm vm, List<Double> mipsShar-eRequested)
Gets an adjusted List of MIPS requested by a VM, reducing every MIPS which is higher than the capacityof each physical PE to that value.
Parameters
• vm – the VM to get the MIPS requested
• mipsShareRequested – the VM requested MIPS List
Returns the VM requested MIPS List without MIPS higher than the PE capacity.
getPeCapacity
public long getPeCapacity()
getRequestedMips
public List<Double> getRequestedMips(Vm vm)
getRequestedMipsMap
protected Map<Vm, List<Double>> getRequestedMipsMap()Gets a map of MIPS requested by each VM, where each key is a VM and each value is a list of MIPS requestedby that VM.
getTotalAllocatedMipsForVm
public double getTotalAllocatedMipsForVm(Vm vm)
getVmMigrationCpuOverhead
public double getVmMigrationCpuOverhead()
getWorkingPeList
public final List<Pe> getWorkingPeList()
1.22. org.cloudbus.cloudsim.schedulers.vm 347
CloudSim Plus Documentation, Release 1.0.0
isAllowedToAllocateMips
public boolean isAllowedToAllocateMips(List<Double> vmRequestedMipsShare)Checks if the requested amount of MIPS is available to be allocated to a VM.
Parameters
• vmRequestedMipsShare – a list of MIPS requested by a VM
Returns true if the requested MIPS List is available, false otherwise
isSuitableForVm
public final boolean isSuitableForVm(Vm vm)
percentOfMipsToRequest
protected double percentOfMipsToRequest(Vm vm)Gets the percentage of the MIPS requested by a VM that will be in fact requested to the Host, according to theVM migration status:
• VM is migrating out of this Host: the MIPS requested by VM will be reduced according to the CPUmigration overhead. The number of MIPS corresponding to the CPU overhead is used by the Hostto perform the migration;
• VM is migrating into this Host: only a fraction of its requested MIPS will be in fact requested to the Host.This amount is computed by reducing the CPU migration overhead;
• VM is not in migration: 100% of its requested MIPS will be in fact requested to the Host
Parameters
• vm – the VM that is requesting MIPS from the Host
Returns the percentage of MIPS requested by the VM that will be in fact requested to the Host (inscale from [0 to 1], where is 100%)
removePesFromMap
protected <T> int removePesFromMap(Vm vm, Map<Vm, List<T>> map, int pesToRemove)Remove a given number of PEs from a given Vm -> List<PE> Map, where each PE in the List associatedto each Vm may be an actual Pe object or just its capacity in MIPS (Double).
In other words, the map can be Map<Vm, List<Double>> or Map<Vm, List<Pe>>.
Parameters
• <T> – the type of the elements into the List associated to each map key, which can be aMIPS number (Double) or an actual Pe object.
• vm – the VM to remove PEs from
• map – the map where the PEs will be removed
• pesToRemove – the number of PEs to remove from the List of PEs associated to the Vm
Returns the number of removed PEs
348 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setHost
public VmScheduler setHost(Host host)
1.22.3 VmSchedulerNull
final class VmSchedulerNull implements VmSchedulerA class that implements the Null Object Design Pattern for VmScheduler class.
Author Manoel Campos da Silva Filho
See also: VmScheduler.NULL
Methods
allocatePesForVm
public boolean allocatePesForVm(Vm vm, List<Double> requestedMips)
allocatePesForVm
public boolean allocatePesForVm(Vm vm)
deallocatePesForAllVms
public void deallocatePesForAllVms()
deallocatePesFromVm
public void deallocatePesFromVm(Vm vm)
deallocatePesFromVm
public void deallocatePesFromVm(Vm vm, int pesToRemove)
getAllocatedMips
public List<Double> getAllocatedMips(Vm vm)
getAvailableMips
public double getAvailableMips()
getHost
public Host getHost()
1.22. org.cloudbus.cloudsim.schedulers.vm 349
CloudSim Plus Documentation, Release 1.0.0
getMaxAvailableMips
public double getMaxAvailableMips()
getMaxCpuUsagePercentDuringOutMigration
public double getMaxCpuUsagePercentDuringOutMigration()
getPeCapacity
public long getPeCapacity()
getRequestedMips
public List<Double> getRequestedMips(Vm vm)
getTotalAllocatedMipsForVm
public double getTotalAllocatedMipsForVm(Vm vm)
getVmMigrationCpuOverhead
public double getVmMigrationCpuOverhead()
getWorkingPeList
public <T extends Pe> List<T> getWorkingPeList()
isAllowedToAllocateMips
public boolean isAllowedToAllocateMips(List<Double> vmRequestedMipsShare)
isSuitableForVm
public boolean isSuitableForVm(Vm vm)
isSuitableForVm
public boolean isSuitableForVm(List<Double> vmMipsList)
setHost
public VmScheduler setHost(Host host)
350 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.22.4 VmSchedulerSpaceShared
public class VmSchedulerSpaceShared extends VmSchedulerAbstractVmSchedulerSpaceShared is a VMM allocation policy that allocates one or more PEs from a host to a VirtualMachine Monitor (VMM), and doesn’t allow sharing of PEs. The allocated PEs will be used until the VMfinishes running. If there is no enough free PEs as required by a VM, or whether the available PEs doesn’t haveenough capacity, the allocation fails. In the case of fail, no PE is allocated to the requesting VM.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmSchedulerSpaceShared
public VmSchedulerSpaceShared()Creates a space-shared VM scheduler.
VmSchedulerSpaceShared
public VmSchedulerSpaceShared(double vmMigrationCpuOverhead)Creates a space-shared VM scheduler, defining a CPU overhead for VM migration.
Parameters
• vmMigrationCpuOverhead – the percentage of Host’s CPU usage increase when aVM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).
Methods
allocatePesForVmInternal
public boolean allocatePesForVmInternal(Vm vm, List<Double> requestedMips)
deallocatePesFromVmInternal
protected void deallocatePesFromVmInternal(Vm vm, int pesToRemove)
isSuitableForVm
public boolean isSuitableForVm(List<Double> vmMipsList)
setHost
public VmScheduler setHost(Host host)
1.22. org.cloudbus.cloudsim.schedulers.vm 351
CloudSim Plus Documentation, Release 1.0.0
1.22.5 VmSchedulerTimeShared
public class VmSchedulerTimeShared extends VmSchedulerAbstractVmSchedulerTimeShared is a Virtual Machine Monitor (VMM), also called Hypervisor, that defines a policyto allocate one or more PEs from a PM to a VM, and allows sharing of PEs by multiple VMs. This class alsoimplements 10% performance degradation due to VM migration. It does not support over-subscription.
Each host has to use is own instance of a VmScheduler that will so schedule the allocation of host’s PEs forVMs running on it.
It does not perform a preemption process in order to move running VMs to the waiting list in order to make roomfor other already waiting VMs to run. It just imposes there is not waiting VMs, oversimplifying the scheduling,considering that for a given simulation second t, the total processing capacity of the processor cores (in MIPS)is equally divided by the VMs that are using them.
In processors enabled with Hyper-threading technology (HT), it is possible to run up to 2 processes at the samephysical CPU core. However, this scheduler implementation oversimplifies a possible HT feature by allowingseveral VMs to use a fraction of the MIPS capacity from physical PEs, until that the total capacity of the virtualPE is allocated. Consider that a virtual PE is requiring 1000 MIPS but there is no physical PE with such acapacity. The scheduler will allocate these 1000 MIPS across several physical PEs, for instance, by allocating500 MIPS from PE 0, 300 from PE 1 and 200 from PE 2, totaling the 1000 MIPS required by the virtual PE.
In a real hypervisor in a Host that has Hyper-threading CPU cores, two virtual PEs can be allocated to the samephysical PE, but a single virtual PE must be allocated to just one physical PE.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
VmSchedulerTimeShared
public VmSchedulerTimeShared()Creates a time-shared VM scheduler.
VmSchedulerTimeShared
public VmSchedulerTimeShared(double vmMigrationCpuOverhead)Creates a time-shared VM scheduler, defining a CPU overhead for VM migration.
Parameters
• vmMigrationCpuOverhead – the percentage of Host’s CPU usage increase when aVM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).
Methods
allocateMipsShareForVm
protected void allocateMipsShareForVm(Vm vm, List<Double> requestedMipsReduced)Performs the allocation of a MIPS List to a given VM. The actual MIPS to be allocated to the VM may bereduced if the VM is in migration, due to migration overhead.
Parameters
• vm – the VM to allocate MIPS to
352 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• requestedMipsReduced – the list of MIPS to allocate to the VM, after it being adjustedby the getMipsShareRequestedReduced(Vm,List) method.
See also: .getMipsShareRequestedReduced(Vm,List)
allocatePesForVmInternal
public boolean allocatePesForVmInternal(Vm vm, List<Double> requestedMips)
deallocatePesForAllVms
public void deallocatePesForAllVms()Releases PEs allocated to all the VMs.
deallocatePesFromVmInternal
protected void deallocatePesFromVmInternal(Vm vm, int pesToRemove)
getMipsShareToAllocate
protected List<Double> getMipsShareToAllocate(Vm vm, List<Double> requestedMips)Gets the actual MIPS that will be allocated to each vPE (Virtual PE), considering the VM migration status. Ifthe VM is in migration, this will cause overhead, reducing the amount of MIPS allocated to the VM.
Parameters
• vm – the VM requesting allocation of MIPS
• requestedMips – the list of MIPS requested for each vPE
Returns the List of MIPS allocated to the VM
getMipsShareToAllocate
protected List<Double> getMipsShareToAllocate(List<Double> requestedMips, double scalingFac-tor)
Gets the actual MIPS that will be allocated to each vPE (Virtual PE), considering the VM migration status. Ifthe VM is in migration, this will cause overhead, reducing the amount of MIPS allocated to the VM.
Parameters
• requestedMips – the list of MIPS requested for each vPE
• scalingFactor – the factor that will be used to reduce the amount of MIPS allocated toeach vPE (which is a percentage value between [0 .. 1]) in case the VM is in migration
Returns the List of MIPS allocated to the VM
isSuitableForVm
public boolean isSuitableForVm(List<Double> vmMipsList)
1.22. org.cloudbus.cloudsim.schedulers.vm 353
CloudSim Plus Documentation, Release 1.0.0
1.22.6 VmSchedulerTimeSharedOverSubscription
public class VmSchedulerTimeSharedOverSubscription extends VmSchedulerTimeSharedA Time-Shared VM Scheduler which allows over-subscription. In other words, the scheduler still enablesallocating into a Host, VMs which require more CPU MIPS than there is available. If the Host has at leastthe number of PEs a VM requires, the VM will be allowed to run into it.
The scheduler doesn’t in fact allocates more MIPS for Virtual PEs (vPEs) than there is in the physical PEs.It just reduces the allocated amount according to the available MIPS. This is an oversubscription, resulting inperformance degradation because less MIPS may be allocated than the required by a VM.
Author Anton Beloglazov, Rodrigo N. Calheiros, Manoel Campos da Silva Filho
Constructors
VmSchedulerTimeSharedOverSubscription
public VmSchedulerTimeSharedOverSubscription()Creates a time-shared over-subscription VM scheduler.
VmSchedulerTimeSharedOverSubscription
public VmSchedulerTimeSharedOverSubscription(double vmMigrationCpuOverhead)Creates a time-shared over-subscription VM scheduler, defining a CPU overhead for VM migration.
Parameters
• vmMigrationCpuOverhead – the percentage of Host’s CPU usage increase when aVM is migrating in or out of the Host. The value is in scale from 0 to 1 (where 1 is 100%).
Methods
allocateMipsShareForVm
protected void allocateMipsShareForVm(Vm vm, List<Double> requestedMipsReduced)
isAllowedToAllocateMips
public boolean isAllowedToAllocateMips(List<Double> vmRequestedMipsShare)Checks if a list of MIPS requested by a VM is allowed to be allocated or not. When there isn’t the amountof requested MIPS available, this VmScheduler allows to allocate what is available for the requesting VM,allocating less that is requested.
This way, the only situation when it will not allow the allocation of MIPS for a VM is when the number of PEsrequired is greater than the total number of physical PEs. Even when there is not available MIPS at all, it allowsthe allocation of MIPS for the VM by reducing the allocation of other VMs.
Parameters
• vmRequestedMipsShare – a list of MIPS requested by a VM
Returns true if the requested MIPS List is allowed to be allocated to the VM, false otherwise
See also: .allocateMipsShareForVm(Vm,List)
354 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.23 org.cloudbus.cloudsim.selectionpolicies.power
Provides org.cloudbus.cloudsim.selectionpolicies.power.PowerVmSelectionPolicy im-plementations that define policies to be used by a org.cloudbus.cloudsim.hosts.Host to select a org.cloudbus.cloudsim.vms.Vm to migrate from a list of VMs.
The order in which VMs are migrated may impact positive or negatively some SLA metric. For instance, migratingVMs that are requiring more bandwidth may reduce network congestion after such VMs are migrated and will makemore bandwidth available that will reduce the migration time for subsequent migrating VMs.
author Manoel Campos da Silva Filho
1.23.1 PowerVmSelectionPolicy
public abstract class PowerVmSelectionPolicyAn abstract VM selection policy used to select VMs from a list of migratable VMs. The selection is defined bysub classes. If you are using any algorithms, policies or workload included in the power package please cite thefollowing paper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getMigratableVms
protected List<Vm> getMigratableVms(Host host)Gets the list of migratable VMs from a given host.
Parameters
• host – the host to get VMs to migrate from
Returns the list of migratable VMs
getVmToMigrate
public abstract Vm getVmToMigrate(Host host)Gets a VM to migrate from a given host.
Parameters
• host – the host to get a Vm to migrate from
Returns the vm to migrate or Vm.NULL if there is not Vm to migrate
1.23. org.cloudbus.cloudsim.selectionpolicies.power 355
CloudSim Plus Documentation, Release 1.0.0
1.23.2 PowerVmSelectionPolicyMaximumCorrelation
public class PowerVmSelectionPolicyMaximumCorrelation extends PowerVmSelectionPolicyA VM selection policy that selects for migration the VM with the Maximum Correlation Coefficient (MCC)among a list of migratable VMs.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Constructors
PowerVmSelectionPolicyMaximumCorrelation
public PowerVmSelectionPolicyMaximumCorrelation(PowerVmSelectionPolicy fallbackPolicy)Instantiates a new PowerVmSelectionPolicyMaximumCorrelation.
Parameters
• fallbackPolicy – the fallback policy
Methods
getCorrelationCoefficients
protected List<Double> getCorrelationCoefficients(double[][] data)Gets the correlation coefficients.
Parameters
• data – the data
Returns the correlation coefficients
getFallbackPolicy
public PowerVmSelectionPolicy getFallbackPolicy()Gets the fallback policy.
Returns the fallback policy
getMinUtilizationHistorySize
protected int getMinUtilizationHistorySize(List<Vm> vmList)Gets the min CPU utilization percentage history size among a list of VMs.
Parameters
• vmList – the VM list
356 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Returns the min CPU utilization percentage history size of the VM list
getUtilizationMatrix
protected double[][] getUtilizationMatrix(List<Vm> vmList)Gets the CPU utilization percentage matrix for a given list of VMs.
Parameters
• vmList – the VM list
Returns the CPU utilization percentage matrix, where each line i is a VM and each column j is aCPU utilization percentage history for that VM.
getVmToMigrate
public Vm getVmToMigrate(Host host)
setFallbackPolicy
public final void setFallbackPolicy(PowerVmSelectionPolicy fallbackPolicy)Sets the fallback policy.
Parameters
• fallbackPolicy – the new fallback policy
1.23.3 PowerVmSelectionPolicyMinimumMigrationTime
public class PowerVmSelectionPolicyMinimumMigrationTime extends PowerVmSelectionPolicyA VM selection policy that selects for migration the VM with Minimum Migration Time (MMT). If you areusing any algorithms, policies or workload included in the power package please cite the following paper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getVmToMigrate
public Vm getVmToMigrate(Host host)
1.23. org.cloudbus.cloudsim.selectionpolicies.power 357
CloudSim Plus Documentation, Release 1.0.0
1.23.4 PowerVmSelectionPolicyMinimumUtilization
public class PowerVmSelectionPolicyMinimumUtilization extends PowerVmSelectionPolicyA VM selection policy that selects for migration the VM with Minimum Utilization (MU) of CPU.
If you are using any algorithms, policies or workload included in the power package please cite the followingpaper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Methods
getVmToMigrate
public Vm getVmToMigrate(Host host)
1.23.5 PowerVmSelectionPolicyRandomSelection
public class PowerVmSelectionPolicyRandomSelection extends PowerVmSelectionPolicyA VM selection policy that randomly select VMs to migrate from a host. If you are using any algorithms,policies or workload included in the power package please cite the following paper:
• Anton Beloglazov, and Rajkumar Buyya, “Optimal Online Deterministic Algorithms and Adaptive Heuris-tics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in Cloud DataCenters”, Concurrency and Computation: Practice and Experience (CCPE), Volume 24, Issue 13, Pages:1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
Author Anton Beloglazov
Constructors
PowerVmSelectionPolicyRandomSelection
public PowerVmSelectionPolicyRandomSelection()
Methods
getVmToMigrate
public Vm getVmToMigrate(Host host)
1.24 org.cloudbus.cloudsim.util
Provides general purpose, helper classes used internally by CloudSim Plus.
358 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.24.1 Conversion
public final class ConversionProvides a set of methods for unit conversion.
Author Manoel Campos da Silva Filho
Fields
GIBABYTE
public static final double GIBABYTEThe value of 1 GibaByte in Bytes.
See also: .MEGABYTE
HUNDRED_PERCENT
public static final double HUNDRED_PERCENTA value that represents 100% in a scale from 0 to 1.
KILOBYTE
public static final double KILOBYTEThe value of 1 KiloByte in Bytes. It is declared as double because such a value is commonly used in divisions.By this way, it avoids explicit double casts to ensure a double instead an integer division.
MEGABYTE
public static final double MEGABYTEThe value of 1 MegaByte in Bytes.
See also: .KILOBYTE
MILLION
public static final int MILLIONOne million in absolute value, usually used to convert to and from Number of Instructions (I) and MillionInstructions (MI) units.
Methods
bitesToBytes
public static double bitesToBytes(double bits)Converts any value in bits to bytes, doesn’t matter if the unit is Kilobites (Kb), Megabites (Mb), Gigabites (Gb),etc.
Parameters
1.24. org.cloudbus.cloudsim.util 359
CloudSim Plus Documentation, Release 1.0.0
• bits – the value in bites, Kb, Mb, Gb, etc
Returns the value in bites, Kbytes, Mbytes, Gbytes and so on, according to the given value
bytesToBits
public static double bytesToBits(double bytes)Converts any value in bytes to bits, doesn’t matter if the unit is Kilobytes (KB), Megabytes (MB), Gigabytes(GB), etc.
Parameters
• bytes – the value in bytes, KB, MB, GB, etc
Returns the value in bites, Kbits, Mbits, Gbits and so on, according to the given value
bytesToMegaBits
public static double bytesToMegaBits(double bytes)Converts a value in bytes to Megabites (Mb)
Parameters
• bytes – the value in bytes
Returns the value in Megabites (Mb)
bytesToMegaBytes
public static double bytesToMegaBytes(double bytes)Converts a value in bytes to MegaBytes (MB)
Parameters
• bytes – the value in bytes
Returns the value in MegaBytes (MB)
1.24.2 DataCloudTags
public final class DataCloudTagsContains additional tags for DataCloud features, such as file information retrieval, file transfers, and storageinfo.
Author Uros Cibej, Anthony Sulistio
Fields
CTLG_BASE
public static final int CTLG_BASEBase value for catalogue tags.
360 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
CTLG_DELETE_MASTER
public static final int CTLG_DELETE_MASTERDenotes the request to de-register / delete a master file from the Replica Catalogue.
The format of this request is Object[2] = String lfn, Integer resourceID.
The reply tag name is CTLG_DELETE_MASTER_RESULT.
CTLG_DELETE_MASTER_RESULT
public static final int CTLG_DELETE_MASTER_RESULTSends the result of de-registering a master file back to sender.
The format of the reply is Object[2] = String lfn, Integer resultID.
NOTE: The result id is in the form of CTLG_DELETE_MASTER_XXXX where XXXX means the er-ror/success message
DEFAULT_MTU
public static final int DEFAULT_MTUDefault Maximum Transmission Unit (MTU) of a link in bytes.
FILE_ADD_ERROR_EMPTY
public static final int FILE_ADD_ERROR_EMPTYDenotes that file addition is failed because the given file is empty.
FILE_ADD_ERROR_EXIST_READ_ONLY
public static final int FILE_ADD_ERROR_EXIST_READ_ONLYDenotes that file addition is failed because the file already exists in the catalogue and it is read-only file.
FILE_ADD_ERROR_STORAGE_FULL
public static final int FILE_ADD_ERROR_STORAGE_FULLDenotes that file addition is failed because the storage is full.
FILE_ADD_SUCCESSFUL
public static final int FILE_ADD_SUCCESSFULDenotes that file addition is successful.
FILE_DELETE_ERROR
public static final int FILE_DELETE_ERRORDenotes that file deletion is failed due to an unknown error.
1.24. org.cloudbus.cloudsim.util 361
CloudSim Plus Documentation, Release 1.0.0
FILE_DELETE_MASTER_RESULT
public static final int FILE_DELETE_MASTER_RESULTSends the result of deleting a master file back to sender.
The format of the reply is Object[2] = String lfn, Integer resultID.
NOTE: The result id is in the form of FILE_DELETE_XXXX where XXXX means the error/success message
FILE_DELETE_SUCCESSFUL
public static final int FILE_DELETE_SUCCESSFULDenotes that file deletion is successful.
MASTERFILE_ADD_RESULT
public static final int MASTERFILE_ADD_RESULTSends the result of adding a master file back to sender.
The format of the reply is Object[3] = String lfn, Integer uniqueID, Integer resultID.
NOTE: The result id is in the form of FILE_ADD_XXXX where XXXX means the error/success message.
PKT_SIZE
public static final int PKT_SIZEThe default packet size (in byte) for sending events to other entity.
RM_BASE
public static final int RM_BASEBase value used for Replica Manager tags.
1.24.3 ExecutionTimeMeasurer
public final class ExecutionTimeMeasurerMeasurement of execution times of CloudSim’s methods.
Author Anton Beloglazov
Methods
end
public static double end(String name)Finalizes measuring the execution time of a method/process.
Parameters
• name – the name of the method/process being measured.
Returns the time the method/process spent in execution (in seconds)
362 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
See also: .getExecutionStartTimes()
getExecutionStartTime
protected static Long getExecutionStartTime(String name)
getExecutionStartTimes
protected static Map<String, Long> getExecutionStartTimes()Gets map the execution times.
Returns the execution times map
See also: .executionStartTimes
start
public static void start(String name)Starts measuring the execution time of a method/process. Usually this method has to be called at the first line ofthe method that has to be its execution time measured.
Parameters
• name – the name of the method/process being measured.
See also: .getExecutionStartTimes()
1.24.4 Log
public final class LogLogger used for performing logging of the simulation process. It provides the ability to substitute the outputstream by any OutputStream subclass.
Author Anton Beloglazov
Methods
disable
public static void disable()Disables the output.
enable
public static void enable()Enables the output.
1.24. org.cloudbus.cloudsim.util 363
CloudSim Plus Documentation, Release 1.0.0
getOutput
public static OutputStream getOutput()Gets the output stream.
Returns the output
isDebug
public static boolean isDebug()
isDisabled
public static boolean isDisabled()Checks if the output is disabled.
Returns true, if it is disable
isEnabled
public static boolean isEnabled()Checks if the output is enabled.
Returns true, if it is enable
public static void print(String message)Prints a message.
Parameters
• message – the message
public static void print(Object message)Prints the message passed as a non-String object.
Parameters
• message – the message
printConcatLine
public static void printConcatLine(Object... messages)Prints the concatenated text representation of the arguments and a new line.
Parameters
• messages – the messages to print
364 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
printFormatted
public static void printFormatted(String format, Object... args)Prints a string formatted as in String.printFormatted().
Parameters
• format – the printFormatted
• args – the args
printFormattedLine
public static void printFormattedLine(String format, Object... args)Prints a string formatted as in String.printFormatted(), followed by a new line.
Parameters
• format – the printFormatted
• args – the args
printLine
public static void printLine(String message)Prints a message and a new line.
Parameters
• message – the message
printLine
public static void printLine()Prints an empty line.
printLine
public static void printLine(Object message)Prints the message passed as a non-String object and a new line.
Parameters
• message – the message
println
public static void println(Level level, Class klass, double time, String format, Object... args)Prints a string formatted as in String.printFormatted(), followed by a new line, that will be printed only accordingto the specified level
Parameters
• level – the level that define the kind of message
1.24. org.cloudbus.cloudsim.util 365
CloudSim Plus Documentation, Release 1.0.0
• klass – Class that is asking to print a message (where the print method is being called)
• time – current simulation time
• format – the printFormatted
• args – the args
setDisabled
public static void setDisabled(boolean disable)Sets the disable output flag.
Parameters
• disable – the new disabled
setOutput
public static void setOutput(OutputStream newOutput)Sets the output stream.
Parameters
• newOutput – the new output
1.24.5 Log.Level
public enum LevelAn enum that may be used to define the level (type) of a log message.
Enum Constants
DEBUG
public static final Log.Level DEBUGA log level for messages that will be shown only when the application is run in debug mode.
ERROR
public static final Log.Level ERROR
INFO
public static final Log.Level INFO
366 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.24.6 MathUtil
public final class MathUtilA class containing multiple convenient math functions.
Author Anton Beloglazov
Fields
HUNDRED_PERCENT
public static final double HUNDRED_PERCENT100% represented in scale [0 .. 1].
Methods
abs
public static double[] abs(double... data)Gets the absolute values of an array of values
Parameters
• data – the array of values
Returns a new array with the absolute value of each element in the given array.
countNonZeroBeginning
public static int countNonZeroBeginning(double... data)Counts the number of values different of zero at the beginning of an array.
Parameters
• data – the array of numbers
Returns the number of values different of zero at the beginning of the array
createLinearRegression
public static SimpleRegression createLinearRegression(double[] x, double[] y)
createLinearRegression
public static OLSMultipleLinearRegression createLinearRegression(double[][] x, double[] y)
1.24. org.cloudbus.cloudsim.util 367
CloudSim Plus Documentation, Release 1.0.0
doubleToInt
public static int doubleToInt(double d)Converts a double value to an int, using an appropriate rounding function. If the double is negative, it appliesMath.floor(double) to round the number down. If it’ a positive value, it applies Math.ceil(double)to round the number up. This way, a negative double will be converted to a negative int and a positive doublewill be converted to a positive int.
It’s different from using: Math.round(double) which always rounds to the next positive integer; Math.floor(double)which always rounds down; or Math.ceil(double)which always rounds up. It appliesfloor for negative values and ceil for positive ones.
This method is useful to be used by Comparators which rely on a double attribute to compare a list ofobjects. Since the Comparator.compare(Object,Object) method must return an int, the methodbeing implemented here converts a double to an int value which can be used by a Comparator.
Parameters
• d – the double value to convert
Returns zero if the double value is zero, a negative int if the double is negative, or a positive int ifthe double is positive.
getLoessParameterEstimates
public static double[] getLoessParameterEstimates(double... y)Gets the Local Regression (Loess) parameter estimates.
Parameters
• y – the y array
Returns the Loess parameter estimates
getRobustLoessParameterEstimates
public static double[] getRobustLoessParameterEstimates(double... y)Gets the robust loess parameter estimates.
Parameters
• y – the y array
Returns the robust loess parameter estimates
getStatistics
public static DescriptiveStatistics getStatistics(List<Double> list)Gets an object to compute descriptive statistics for an list of numbers.
Parameters
• list – the list of numbers. Must not be null.
Returns descriptive statistics for the list of numbers.
368 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getStatistics
public static DescriptiveStatistics getStatistics(double... list)Gets an object to compute descriptive statistics for an array of numbers.
Parameters
• list – the array of numbers. Must not be null.
Returns descriptive statistics for the array of numbers.
getTricubeBisquareWeights
public static double[] getTricubeBisquareWeights(double... residuals)Gets the tricube bisquare weigths.
Parameters
• residuals – the residuals array
Returns the tricube bisquare weigths
getTricubeWeights
public static double[] getTricubeWeights(int n)Gets the tricube weigths.
Parameters
• n – the number of weights
Returns an array of tricube weigths with n elements
iqr
public static double iqr(double... data)Gets the Interquartile Range (IQR) from an array of numbers.
Parameters
• data – the array of numbers
Returns the IQR
mad
public static double mad(double... data)Gets the Median absolute deviation (MAD) from a array of numbers.
Parameters
• data – the array of numbers
Returns the mad
1.24. org.cloudbus.cloudsim.util 369
CloudSim Plus Documentation, Release 1.0.0
mean
public static double mean(List<Double> list)Gets the average from a list of numbers. If the list is empty or contains just zeros, returns 0.
Parameters
• list – the list of numbers
Returns the average
median
public static double median(List<Double> list)Gets the median from a list of numbers.
Parameters
• list – the list of numbers
Returns the median
median
public static double median(double... list)Gets the median from an array of numbers.
Parameters
• list – the array of numbers
Returns the median
stDev
public static double stDev(List<Double> list)Gets the standard deviation from a list of numbers.
Parameters
• list – the list of numbers
Returns the standard deviation
sum
public static double sum(List<? extends Number> list)Sums a list of numbers.
Parameters
• list – the list of numbers
Returns the double
370 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
variance
public static double variance(List<Double> list)Gets the Variance from a list of numbers.
Parameters
• list – the list of numbers
Returns the variance
1.24.7 ResourceLoader
public final class ResourceLoaderLoads a resource file/directory that is contained inside the directory of a given class.
Author Manoel Campos da Silva Filho
Methods
getBufferedReader
public static BufferedReader getBufferedReader(Class klass, String resourceName)Gets a BufferedReader to read a resource (a file or sub-directory inside the resources directory) from itsabsolute path.
Parameters
• klass – a class from the project that will be used just to assist in getting the path of thegiven resource
• resourceName – the name of the resource to get a BufferedReader for it
Throws
• FileNotFoundException – when the file doesn’t exist
Returns a BufferedReader to read the resource
getFileReader
public static FileReader getFileReader(String filePath)Gets a FileReader
Parameters
• filePath – the path to the file
Returns the FileReader instance.
getInputStream
public static InputStream getInputStream(Class klass, String resourceName)Try to load the resource from a jar file, in case the user is running simulations from a jar instead of directly fromthe IDE. If the input is null, the simulation is not being executed from a jar file, so try to load the resource froma directory in the filesystem.
1.24. org.cloudbus.cloudsim.util 371
CloudSim Plus Documentation, Release 1.0.0
Parameters
• klass – a class from the project that will be used just to assist in getting the path of thegiven resource
• resourceName – the name of the resource to get a BufferedReader for it
Throws
• UncheckedIOException – when the file cannot be accessed (such as when it doesn’texist)
Returns a InputStream to read the resource
getResourceList
public static List<String> getResourceList(Class klass, String resourceDir)Gets the list of files contained inside a given resource directory.
Parameters
• klass – a class from the project which will be used just to assist in getting the path of thegiven resource. It can can any class inside the project where a resource you are trying to getfrom the resources directory
• resourceDir – the name of the resource directory to get the list of files from
getResourcePath
public static String getResourcePath(Class klass, String name)Gets the absolute path of a resource (a file or sub-directory) inside the resources directory.
Parameters
• klass – a class from the project which will be used just to assist in getting the path of thegiven resource. It can can any class inside the project where a resource you are trying to getfrom the resources directory
• name – the name of the resource to get its path (that can be a file or a sub-directory insidethe resources directory)
Returns the absolute path of the resource
getResourceUrl
public static URL getResourceUrl(Class klass, String name)Gets the URL of a resource (a file or sub-directory) inside the resources directory.
Parameters
• klass – a class from the project which will be used just to assist in getting the path of thegiven resource. It can can any class inside the project where a resource you are trying to getfrom the resources directory
• name – the name of the resource to get its path (that can be a file or a sub-directory insidethe resources directory)
Returns the URL of the resource
372 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.24.8 WorkloadFileReader
public class WorkloadFileReader implements WorkloadReaderReads resource traces from a reader and creates a list of (Cloudlets) (jobs). By default, it follows the StandardWorkload Format (*.swf files) from The Hebrew University of Jerusalem. However, you can use other formatsby calling the methods below before running the simulation:
• setComment(String)
• setField(int,int,int,int,int)
NOTES:
• This class can only take one trace reader of the following format: ASCII text, zip, gz.
• If you need to load multiple trace files, then you need to create multiple instances of this class eachwith a unique entity name.
• If size of the trace reader is huge or contains lots of traces, please increase the JVM heap size accordinglyby using java -Xmx option when running the simulation.
• The default Cloudlet reader size for sending to and receiving from a Datacenter isDataCloudTags.DEFAULT_MTU . However, you can specify the reader size by using Cloudlet.setFileSize(long).
• A job run time is only for 1 PE not the total number of allocated PEs. Therefore, a Cloudlet length is alsocalculated for 1 PE. For example, job #1 in the trace has a run time of 100 seconds for 2 processors. Thismeans each processor runs job #1 for 100 seconds, if the processors have the same specification.
Author Anthony Sulistio, Marcos Dias de Assuncao
See also: WorkloadReader
Constructors
WorkloadFileReader
public WorkloadFileReader(String filePath, int mips)Create a new WorkloadFileReader object.
Parameters
• filePath – the workload trace file path in one of the following formats: ASCII text, zip,gz.
• mips – the MIPS capacity of the PEs from the VM where each created Cloudlet is sup-posed to run. Considering the workload reader provides the run time for each applicationregistered inside the reader, the MIPS value will be used to compute the length of theCloudlet (in MI) so that it’s expected to execute, inside the VM with the given MIPScapacity, for the same time as specified into the workload reader.
Throws
• IllegalArgumentException – when the workload trace file name is null or empty;or the resource PE mips <= 0
• FileNotFoundException –
See also: .getInstance(String,int)
1.24. org.cloudbus.cloudsim.util 373
CloudSim Plus Documentation, Release 1.0.0
Methods
generateWorkload
public List<Cloudlet> generateWorkload()
getInstance
public static WorkloadFileReader getInstance(String fileName, int mips)Gets a WorkloadFileReader instance from a workload file inside the application’s resource directory.Use the available constructors if you want to load a file outside the resource directory.
Parameters
• fileName – the workload trace relative file name in one of the following formats: ASCIItext, zip, gz.
• mips – the MIPS capacity of the PEs from the VM where each created Cloudlet is sup-posed to run. Considering the workload reader provides the run time for each applicationregistered inside the reader, the MIPS value will be used to compute the length of theCloudlet (in MI) so that it’s expected to execute, inside the VM with the given MIPScapacity, for the same time as specified into the workload reader.
Throws
• IllegalArgumentException – when the workload trace file name is null or empty;or the resource PE mips <= 0
• UncheckedIOException – when the file cannot be accessed (such as when it doesn’texist)
getMaxLinesToRead
public int getMaxLinesToRead()Gets the maximum number of lines of the workload reader that will be read. The value -1 indicates that all lineswill be read, creating a cloudlet from every one.
getMips
public int getMips()Gets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Consideringthe workload reader provides the run time for each application registered inside the reader, the MIPS value willbe used to compute the length of the Cloudlet (in MI) so that it’s expected to execute, inside theVM with the given MIPS capacity, for the same time as specified into the workload reader.
readGZIPFile
protected void readGZIPFile(InputStream inputStream)Reads traces from a gzip reader, one line at a time.
Parameters
• inputStream – a InputStream to read the file
374 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Throws
• IOException – if the there was any error reading the reader
Returns true if successful; false otherwise.
readTextFile
protected void readTextFile(InputStream inputStream)Reads traces from a text reader, usually with the swf extension, one line at a time.
Parameters
• inputStream – a reader name
Throws
• IOException – if the there was any error reading the reader
Returns true if successful, false otherwise.
readZipFile
protected boolean readZipFile(InputStream inputStream)Reads a set of trace files inside a Zip reader.
Parameters
• inputStream – a InputStream to read the file
Throws
• IOException – if the there was any error reading the reader
Returns true if reading a reader is successful; false otherwise.
setComment
public boolean setComment(String comment)Sets the string that identifies the start of a comment line.
Parameters
• comment – a character that denotes the start of a comment, e.g. “;” or “#”
Returns true if it is successful, false otherwise
setField
public void setField(int maxField, int jobNum, int submitTime, int runTime, int numProc)Tells this class what to look in the trace reader. This method should be called before the start of the simulation.
By default, this class follows the standard workload format as specified in http://www.cs.huji.ac.il/labs/parallel/workload/ However, you can use other format by calling this method.
The parameters must be a positive integer number starting from 1. A special case is where jobNum ==,meaning the job or cloudlet ID will be generate by the Workload class, instead of reading from the trace reader.
Parameters
1.24. org.cloudbus.cloudsim.util 375
CloudSim Plus Documentation, Release 1.0.0
• maxField – max. number of field/column in one row
• jobNum – field/column number for locating the job ID
• submitTime – field/column number for locating the job submit time
• runTime – field/column number for locating the job run time
• numProc – field/column number for locating the number of PEs required to run a job
Throws
• IllegalArgumentException – if any of the arguments are not within the acceptableranges
setMaxLinesToRead
public void setMaxLinesToRead(int maxLinesToRead)Sets the maximum number of lines of the workload reader that will be read. The value -1 indicates that all lineswill be read, creating a cloudlet from every one.
Parameters
• maxLinesToRead – the maximum number of lines to set
setMips
public final WorkloadFileReader setMips(int mips)Sets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Consideringthe workload reader provides the run time for each application registered inside the reader, the MIPS value willbe used to compute the length of the Cloudlet (in MI) so that it’s expected to execute, inside theVM with the given MIPS capacity, for the same time as specified into the workload reader.
Parameters
• mips – the MIPS value to set
setPredicate
public WorkloadReader setPredicate(Predicate<Cloudlet> predicate)
1.24.9 WorkloadReader
public interface WorkloadReaderProvides methods to be implemented by classes that generate a list of (Cloudlets) (jobs) to be submitted toa DatacenterBroker for execution inside some VMs. Such Cloudlets can be generated from different sourcessuch as XML or CSV files containing Cloudlets configurations or from different formats of Datacenter tracefiles containing execution logs of real applications that can be used to mimic the behaviour of these applicationin a simulation environment.
Author Marcos Dias de Assuncao
See also: WorkloadFileReader
376 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
generateWorkload
List<Cloudlet> generateWorkload()Generates a list of jobs (Cloudlets) to be executed.
Returns a generated Cloudlet list
setPredicate
WorkloadReader setPredicate(Predicate<Cloudlet> predicate)Defines a Predicate which indicates when a Cloudlet must be created from a trace line read from theworkload file. If a Predicate is not set, a Cloudlet will be created for any line read.
Parameters
• predicate – the predicate to define when a Cloudlet must be created from a line readfrom the workload file
1.25 org.cloudbus.cloudsim.utilizationmodels
Provides classes that model utilization of resources such as CPU , org.cloudbus.cloudsim.resources.Ramand org.cloudbus.cloudsim.resources.Bandwidth, defining how a given resource is used by a org.cloudbus.cloudsim.cloudlets.Cloudlet along the simulation time.
The most basic utilization model that can be used for any of the mentioned resources is the org.cloudbus.cloudsim.utilizationmodels.UtilizationModelFull.
author Manoel Campos da Silva Filho
1.25.1 UtilizationModel
public interface UtilizationModelThe UtilizationModel interface needs to be implemented in order to provide a fine-grained control over re-source usage by a Cloudlet. It also implements the Null Object Design Pattern in order to start avoid-ing NullPointerException when using the UtilizationModel.NULL object instead of attributingnull to UtilizationModel variables.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
UtilizationModel NULLAn attribute that implements the Null Object Design Pattern for UtilizationModel objects using a LambdaExpression.
1.25. org.cloudbus.cloudsim.utilizationmodels 377
CloudSim Plus Documentation, Release 1.0.0
Methods
getSimulation
Simulation getSimulation()Gets the simulation that this UtilizationModel belongs to.
getUnit
Unit getUnit()Gets the Unit in which the resource utilization is defined.
getUtilization
double getUtilization(double time)Gets the expected utilization of resource at a given simulation time. Such a value can be a percentage in scalefrom [0 to 1] or an absolute value, depending on the getUnit().
It is an expected usage value because the actual resource usage depends on the available resource.
Parameters
• time – the time to get the resource usage.
Returns the resource utilization at the given time
See also: .getUnit()
getUtilization
double getUtilization()Gets the expected utilization of resource at the current simulation time. Such a value can be a percentage inscale from [0 to 1] or an absolute value, depending on the getUnit().
It is an expected usage value because the actual resource usage depends on the available resource.
Returns the current resource utilization
See also: .getUnit()
setSimulation
UtilizationModel setSimulation(Simulation simulation)Sets the simulation that this UtilizationModel belongs to.
Parameters
• simulation – the Simulation instance to set
1.25.2 UtilizationModel.Unit
enum UnitDefines the unit of the resource utilization.
378 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Enum Constants
ABSOLUTE
public static final UtilizationModel.Unit ABSOLUTEIndicate that the resource utilization is defined in absolute values.
PERCENTAGE
public static final UtilizationModel.Unit PERCENTAGEIndicate that the resource utilization is defined in percentage values in scale from 0 to 1 (where 1 is 100%).
1.25.3 UtilizationModelAbstract
public abstract class UtilizationModelAbstract implements UtilizationModelAn abstract implementation of UtilizationModel.
Author Manoel Campos da Silva Filho
Fields
ALMOST_ZERO
public static final double ALMOST_ZEROA constant which indicates that values lower or equal to this value will be considered as zero.
Constructors
UtilizationModelAbstract
public UtilizationModelAbstract()
UtilizationModelAbstract
public UtilizationModelAbstract(Unit unit)
Methods
getSimulation
public Simulation getSimulation()
getUnit
public Unit getUnit()
1.25. org.cloudbus.cloudsim.utilizationmodels 379
CloudSim Plus Documentation, Release 1.0.0
getUtilization
public double getUtilization()
setSimulation
public UtilizationModel setSimulation(Simulation simulation)
setUnit
protected final UtilizationModel setUnit(Unit unit)Sets the Unit in which the resource utilization is defined.
Parameters
• unit – Unit to set
validateUtilizationField
protected void validateUtilizationField(String fieldName, double fieldValue)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 invalid
• fieldValue – the current value of the field
validateUtilizationField
protected void validateUtilizationField(String fieldName, double fieldValue, double minValue)
1.25.4 UtilizationModelDynamic
public class UtilizationModelDynamic extends UtilizationModelAbstractA Cloudlet UtilizationModel that allows to increase the utilization of the related resource along the sim-ulation time. It accepts a Lambda Expression that defines how the utilization increment must behave. By thisway, the class enables the developer to define such a behaviour when instantiating objects of this class.
For instance, it is possible to use the class to arithmetically or geometrically increment resource us-age, but any kind of increment as logarithmic or exponential is possible. For more details, see thesetUtilizationUpdateFunction(Function).
Author Manoel Campos da Silva Filho
Constructors
UtilizationModelDynamic
public UtilizationModelDynamic()Creates a UtilizationModelDynamic with no initial utilization and resource utilization unit defined in Unit.PERCENTAGE.
380 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
The utilization will not be dynamically incremented until an increment function is defined by the .
See also: .setUtilizationUpdateFunction(Function)
UtilizationModelDynamic
public UtilizationModelDynamic(Unit unit)Creates a UtilizationModelDynamic with no initial utilization and resource utilization Unit be defined accord-ing to the given parameter.
The utilization will not be dynamically incremented until that an increment function is defined by the .
Parameters
• unit – the Unit that determines how the resource is used (for instance, if resource usageis defined in percentage of the Vm resource or in absolute values)
UtilizationModelDynamic
public UtilizationModelDynamic(double initialUtilizationPercent)Creates a UtilizationModelDynamic that the initial resource utilization will be defined according to the givenparameter and the Unit will be set as Unit.PERCENTAGE.
The utilization will not be dynamically incremented until that an increment function is defined by the .
Parameters
• initialUtilizationPercent – the initial percentage of resource utilization
UtilizationModelDynamic
public UtilizationModelDynamic(Unit unit, double initialUtilization)Creates a UtilizationModelDynamic that the initial resource utilization and the Unit will be defined accordingto the given parameters.
The utilization will not be dynamically incremented until that an increment function is defined by the .
Parameters
• unit – the Unit that determines how the resource is used (for instance, if resource usageis defined in percentage of the Vm resource or in absolute values)
• initialUtilization – the initial of resource utilization, that the unit depends on theunit parameter
UtilizationModelDynamic
protected UtilizationModelDynamic(UtilizationModelDynamic source)A copy constructor that creates a read-only UtilizationModelDynamic based on a source object.
Parameters
• source – the source UtilizationModelDynamic to create an instance from
1.25. org.cloudbus.cloudsim.utilizationmodels 381
CloudSim Plus Documentation, Release 1.0.0
Methods
getMaxResourceUtilization
public double getMaxResourceUtilization()Gets the maximum amount of resource that will be used.
Such a value can be a percentage in scale from [0 to 1] or an absolute value, depending on the getUnit().
Returns the maximum resource utilization
getTimeSpan
public double getTimeSpan()Gets the time difference from the current simulation time to the last time the resource utilization was updated.
getUtilization
public double getUtilization(double time)@inheritDoc
It will automatically increment the getUtilization() by applying the increment function.
Parameters
• time – @inheritDoc
Returns @inheritDoc
getUtilization
public double getUtilization()
setMaxResourceUtilization
public final UtilizationModelDynamic setMaxResourceUtilization(double maxResourceUsagePer-centage)
Sets the maximum amount of resource of resource that will be used.
Such a value can be a percentage in scale from [0 to 1] or an absolute value, depending on the getUnit().
Parameters
• maxResourceUsagePercentage – the maximum resource usage
setUtilizationUpdateFunction
public final UtilizationModelDynamic setUtilizationUpdateFunction(Function<UtilizationModelDynamic,Double> utilizationUpdate-Function)
Sets the function defining how the resource utilization will be incremented or decremented along the time.
Such a function must require one UtilizationModelDynamic parameter and return the new resourceutilization. When this function is called internally by this UtilizationModel, it receives a read-only
382 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
UtilizationModelDynamic instance and allow the developer using this UtilizationModel to de-fine how the utilization must be updated.
For instance, to define an arithmetic increment, a Lambda function to be given to this setter could be defined asbelow:
um -> um.getUtilization() + um.getTimeSpan()*0.1
Considering the UtilizationModel Unit was defined in Unit.PERCENTAGE, such a Lambda Expres-sion will increment the usage in 10% for each second that has passed since the last time the utilization wascomputed.
The value returned by the given Lambda Expression will be automatically validated to avoid negative utilizationor utilization over 100% (when the UtilizationModel unit is defined in percentage). The function wouldbe defined to decrement the utilization along the time, by just changing the plus to a minus signal.
Defining a geometric progression for the resource utilization is as simple as changing the plus signal to a multi-plication signal.
Parameters
• utilizationUpdateFunction – the utilization increment function to set, that willreceive the UtilizationModel instance and must return the new utilization value based on theprevious utilization.
1.25.5 UtilizationModelFull
public class UtilizationModelFull extends UtilizationModelAbstractA UtilizationModel that according to which, a Cloudlet always utilizes a given allocated resource fromits Vm at 100%, all the time.
Author Anton Beloglazov
Methods
getUtilization
public double getUtilization(double time)Gets the utilization percentage (in scale from [0 to 1]) of resource at a given simulation time.
Parameters
• time – the time to get the resource usage.
Returns Always return 1 (100% of utilization), independent of the time.
getUtilization
public double getUtilization()Gets the utilization percentage (in scale from [0 to 1]) of resource at the current simulation time.
Returns Always return 1 (100% of utilization), independent of the time.
1.25. org.cloudbus.cloudsim.utilizationmodels 383
CloudSim Plus Documentation, Release 1.0.0
1.25.6 UtilizationModelNull
final class UtilizationModelNull implements UtilizationModelA class that implements the Null Object Design Pattern for UtilizationModel class.
Author Manoel Campos da Silva Filho
See also: UtilizationModel.NULL
Methods
getSimulation
public Simulation getSimulation()
getUnit
public Unit getUnit()
getUtilization
public double getUtilization(double time)
getUtilization
public double getUtilization()
setSimulation
public UtilizationModel setSimulation(Simulation simulation)
1.25.7 UtilizationModelPlanetLab
public class UtilizationModelPlanetLab extends UtilizationModelAbstractDefines the resource utilization model based on a PlanetLab Datacenter workload (trace) file.
Constructors
UtilizationModelPlanetLab
public UtilizationModelPlanetLab(String workloadFilePath, double schedulingInterval)Instantiates a new PlanetLab resource utilization model from a trace file.
Parameters
• workloadFilePath – The path of a PlanetLab Datacenter workload file.
• schedulingInterval – the scheduling interval that defines the time interval in whichprecise utilization is be got
384 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Throws
• NumberFormatException – the number format exception
See also: .getSchedulingInterval()
UtilizationModelPlanetLab
public UtilizationModelPlanetLab(String workloadFilePath, double schedulingInterval, intdataSamples)
Instantiates a new PlanetLab resource utilization model with variable utilization samples from a workload file.
Parameters
• workloadFilePath – The path of a PlanetLab Datacenter workload file.
• schedulingInterval – the scheduling interval that defines the time interval in whichprecise utilization is be got
• dataSamples – number of samples to read from the workload file
Throws
• NumberFormatException – the number format exception
See also: .setSchedulingInterval(double)
Methods
getInstance
public static UtilizationModelPlanetLab getInstance(String traceFilePath, double schedulingInterval)Instantiates a new PlanetLab resource utilization model from a trace file inside the application’s resourcedirectory.
Parameters
• traceFilePath – The relative path of a PlanetLab Datacenter trace file.
• schedulingInterval – the scheduling interval that defines the time interval in whichprecise utilization is be got
Throws
• NumberFormatException – the number format exception
See also: .getSchedulingInterval()
getSchedulingInterval
public double getSchedulingInterval()Gets the time interval (in seconds) in which precise utilization can be got from the workload file.
That means if the getUtilization(double) is called passing any time that is multiple of this schedulinginterval, the utilization returned will be the value stored for that specific time. Otherwise, the value will be anarithmetic mean of the beginning and the ending of the interval in which the given time is.
Returns the scheduling interval in seconds
1.25. org.cloudbus.cloudsim.utilizationmodels 385
CloudSim Plus Documentation, Release 1.0.0
getUtilization
public double getUtilization(double time)
setSchedulingInterval
public final void setSchedulingInterval(double schedulingInterval)Sets the scheduling interval.
Parameters
• schedulingInterval – the scheduling interval to set
See also: .getSchedulingInterval()
1.25.8 UtilizationModelStochastic
public class UtilizationModelStochastic extends UtilizationModelAbstractImplements a model, according to which a Cloudlet generates random resource utilization every time frame.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Constructors
UtilizationModelStochastic
public UtilizationModelStochastic()Instantiates a new utilization model stochastic that defines the resource utilization in percentage.
UtilizationModelStochastic
public UtilizationModelStochastic(Unit unit)Instantiates a new utilization model stochastic where the resource utilization is defined in the given unit.
Parameters
• unit – the Unit that determines how the resource is used (for instance, if resource usageis defined in percentage of the Vm resource or in absolute values)
UtilizationModelStochastic
public UtilizationModelStochastic(Unit unit, long seed)Instantiates a new utilization model stochastic using a given seed and where the resource utilization is definedin the given unit.
Parameters
• unit – the Unit that determines how the resource is used (for instance, if resource usageis defined in percentage of the Vm resource or in absolute values)
• seed – the seed to generate the pseudo random utilization values
386 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
UtilizationModelStochastic
public UtilizationModelStochastic(long seed)Instantiates a new utilization model stochastic.
Parameters
• seed – the seed to generate the pseudo random utilization values
Methods
getHistory
protected Map<Double, Double> getHistory()Gets the utilization history map, where each key is a time and each value is the resource utilization in that time.
Returns the utilization history
getRandomGenerator
public ContinuousDistribution getRandomGenerator()Gets the random number generator.
Returns the random number generator
getUtilization
public double getUtilization(double time)
loadHistory
public void loadHistory(String filename)Load an utilization history from a file.
Parameters
• filename – the filename
Throws
• Exception – the exception
saveHistory
public void saveHistory(String filename)Save the utilization history to a file.
Parameters
• filename – the filename
Throws
• Exception – the exception
1.25. org.cloudbus.cloudsim.utilizationmodels 387
CloudSim Plus Documentation, Release 1.0.0
setHistory
protected final void setHistory(Map<Double, Double> history)Sets the utilization history map, where each key is a time and each value is the resource utilization in that time.
Parameters
• history – the history to set
setRandomGenerator
public final void setRandomGenerator(ContinuousDistribution randomGenerator)Sets the random number generator.
Parameters
• randomGenerator – the new random number generator
1.26 org.cloudbus.cloudsim.vms
Provides implementations of Virtual Machines (org.cloudbus.cloudsim.vms.Vm) which are a software pack-age that emulate the architecture of a physical machine. Each VM is executed by a Host and it is used to run applica-tions (org.cloudbus.cloudsim.cloudlets.Cloudlet). Both VMs and Cloudlets are owned by a specificcloud customer (represented by a org.cloudbus.cloudsim.brokers.DatacenterBroker).
As each VM can run several Cloudlets, the scheduling of such Cloudlets on the VM’s CPU cores(org.cloudbus.cloudsim.resources.Pe) is defined by a org.cloudbus.cloudsim.schedulers.cloudlet.CloudletScheduler.
The most basic Vm implementation is the org.cloudbus.cloudsim.vms.VmSimple.
Specific Vm implementations can be power- or network-aware, enabling the simulation of power consumption andnetwork communication. For more information see org.cloudbus.cloudsim.datacenters package docu-mentation.
author Manoel Campos da Silva Filho
1.26.1 UtilizationHistory
public interface UtilizationHistoryStores resource utilization data for a specific Machine.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Fields
DEF_MAX_HISTORY_ENTRIES
int DEF_MAX_HISTORY_ENTRIESThe maximum number of entries that will be stored.
388 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
NULL
UtilizationHistory NULLAn attribute that implements the Null Object Design Pattern for UtilizationHistory objects.
Methods
addUtilizationHistory
void addUtilizationHistory(double time)Adds a CPU utilization percentage history value related to the current simulation time, to the beginning of theHistory List. The value is added only if the utilization history .
Parameters
• time – the current simulation time
disable
void disable()Disables the history to avoid utilization data to be added to it. That allows to reduce memory usage since noutilization data will be collected.
enable
void enable()Enables the history so that utilization data can be added to it.
getHistory
List<Double> getHistory()Gets a read-only CPU utilization percentage history (between [0 and 1], where 1 is 100%). Each valueinto the returned array is the CPU utilization percentage for a time interval equal to the Datacenter.getSchedulingInterval().
The values are stored in the reverse chronological order.
getMaxHistoryEntries
int getMaxHistoryEntries()Gets the maximum number of entries to store in the history.
getPreviousTime
double getPreviousTime()Gets the previous time that cloudlets were processed.
1.26. org.cloudbus.cloudsim.vms 389
CloudSim Plus Documentation, Release 1.0.0
getUtilizationMad
double getUtilizationMad()Gets the utilization Median Absolute Deviation (MAD) in MIPS.
getUtilizationMean
double getUtilizationMean()Gets the utilization mean in MIPS.
getUtilizationVariance
double getUtilizationVariance()Gets the utilization variance in MIPS.
Returns the utilization variance in MIPS
isEnabled
boolean isEnabled()Checks if the object is enabled to add data to the history.
setMaxHistoryEntries
void setMaxHistoryEntries(int maxHistoryEntries)Sets the maximum number of entries to store in the history.
Parameters
• maxHistoryEntries – the value to set
setPreviousTime
void setPreviousTime(double previousTime)Sets the previous time that cloudlets were processed.
Parameters
• previousTime – the new previous time
1.26.2 UtilizationHistoryNull
final class UtilizationHistoryNull implements UtilizationHistoryA class that implements the Null Object Design Pattern for UtilizationHistory objects.
Author Manoel Campos da Silva Filho
See also: UtilizationHistory.NULL
390 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
addUtilizationHistory
public void addUtilizationHistory(double time)
disable
public void disable()
enable
public void enable()
getHistory
public List<Double> getHistory()
getMaxHistoryEntries
public int getMaxHistoryEntries()
getPreviousTime
public double getPreviousTime()
getUtilizationMad
public double getUtilizationMad()
getUtilizationMean
public double getUtilizationMean()
getUtilizationVariance
public double getUtilizationVariance()
isEnabled
public boolean isEnabled()
1.26. org.cloudbus.cloudsim.vms 391
CloudSim Plus Documentation, Release 1.0.0
setMaxHistoryEntries
public void setMaxHistoryEntries(int maxHistoryEntries)
setPreviousTime
public void setPreviousTime(double previousTime)
1.26.3 Vm
public interface Vm extends Machine, UniquelyIdentificable, Comparable<Vm>, CustomerEntityAn interface to be implemented by each class that provides basic features of Virtual Machines (VMs). Theinterface implements the Null Object Design Pattern in order to start avoiding NullPointerExceptionwhen using the Vm.NULL object instead of attributing null to Vm variables.
Author Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
Fields
NULL
Vm NULLAn attribute that implements the Null Object Design Pattern for Vm objects.
Methods
addOnCreationFailureListener
Vm addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)Adds a listener object that will be notified when the Vm fail in being placed for lack of a Host with enoughresources in a specific Datacenter.
The DatacenterBroker is accountable for receiving the notification from the Datacenter and notifying theListeners.
Parameters
• listener – the listener to add
See also: .updateProcessing(double,List)
addOnHostAllocationListener
Vm addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)Adds a listener object that will be notified when a Host is allocated to the Vm, that is, when the Vm is placedinto a given Host.
Parameters
• listener – the listener to add
392 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addOnHostDeallocationListener
Vm addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)Adds a listener object that will be notified when the Vm is moved/removed from a Host.
Parameters
• listener – the listener to add
addOnUpdateProcessingListener
Vm addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)Adds a listener object that will be notified every time when the processing of the Vm is updated in its Host.
Parameters
• listener – the listener to seaddt
See also: .updateProcessing(double,List)
addStateHistoryEntry
void addStateHistoryEntry(VmStateHistoryEntry entry)Adds a VM state history entry.
Parameters
• entry – the data about the state of the VM at given time
allocateResource
void allocateResource(Class<? extends ResourceManageable> resourceClass, long newTotalRe-sourceAmount)
Changes the allocation of a given resource for a VM. The old allocated amount will be changed to the new givenamount.
Parameters
• resourceClass – the class of the resource to change the allocation
• newTotalResourceAmount – the new amount to change the current allocation to
deallocateResource
void deallocateResource(Class<? extends ResourceManageable> resourceClass)Removes the entire amount of a given resource allocated to VM.
Parameters
• resourceClass – the class of the resource to deallocate from the VM
1.26. org.cloudbus.cloudsim.vms 393
CloudSim Plus Documentation, Release 1.0.0
getBroker
DatacenterBroker getBroker()Gets the DatacenterBroker that represents the owner of this Vm.
Returns the broker or if a broker has not been set yet
getBw
Resource getBw()Gets bandwidth resource assigned to the Vm, allowing to check its capacity (in Megabits/s) and usage.
Returns bandwidth resource.
getBwVerticalScaling
VerticalVmScaling getBwVerticalScaling()Gets a VerticalVmScaling that will check if the Vm’s Bandwidth is overloaded, based on some conditionsdefined by a Predicate given to the VerticalVmScaling, and then request the BW up scaling.
getCloudletScheduler
CloudletScheduler getCloudletScheduler()Gets the the Cloudlet scheduler the VM uses to schedule cloudlets execution.
Returns the cloudlet scheduler
getCpuPercentUsage
double getCpuPercentUsage(double time)Gets the CPU utilization percentage of all Clouddlets running on this VM at the given time.
Parameters
• time – the time
Returns total utilization percentage
getCpuPercentUsage
double getCpuPercentUsage()Gets the current CPU utilization percentage (in scale from 0 to 1) of all Cloudlets running on this VM.
Returns total utilization percentage for the current time, in scale from 0 to 1
getCurrentAllocatedBw
long getCurrentAllocatedBw()Gets the current allocated bw.
Returns the current allocated bw
394 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCurrentAllocatedRam
long getCurrentAllocatedRam()Gets the current allocated ram.
Returns the current allocated ram
getCurrentAllocatedSize
long getCurrentAllocatedSize()Gets the current allocated storage size.
Returns the current allocated size
See also: .getStorage()
getCurrentRequestedBw
long getCurrentRequestedBw()Gets the current requested bw.
Returns the current requested bw
getCurrentRequestedMaxMips
double getCurrentRequestedMaxMips()Gets the current requested max MIPS among all virtual PEs.
Returns the current requested max MIPS
getCurrentRequestedMips
List<Double> getCurrentRequestedMips()Gets a copy list of current requested MIPS of each virtual Pe, avoiding the original list to be changed.
Returns the current requested MIPS of each Pe
getCurrentRequestedRam
long getCurrentRequestedRam()Gets the current requested ram.
Returns the current requested ram
getCurrentRequestedTotalMips
double getCurrentRequestedTotalMips()Gets the current requested total MIPS. It is the sum of MIPS capacity requested for every virtual Pe.
Returns the current requested total MIPS
See also: .getCurrentRequestedMips()
1.26. org.cloudbus.cloudsim.vms 395
CloudSim Plus Documentation, Release 1.0.0
getDescription
String getDescription()Gets the Vm description, which is an optional text which one can use to provide details about this of this VM.
getHorizontalScaling
HorizontalVmScaling getHorizontalScaling()Gets a HorizontalVmScaling that will check if the Vm is overloaded, based on some conditions definedby a Predicate given to the HorizontalVmScaling, and then request the creation of new VMs to horizontallyscale the Vm.
If no HorizontalVmScaling is set, the Broker will not dynamically create VMs to balance arrived Cloudlets.
getHost
Host getHost()Gets the Host where the Vm is or will be placed. To know if the Vm was already created inside this Host, callthe isCreated() method.
Returns the Host
See also: .isCreated()
getIdleInterval
double getIdleInterval()Gets the last interval the VM was idle (without running any Cloudlet).
Returns the last idle time interval (in seconds)
getLastBuzyTime
double getLastBuzyTime()Gets the last time the VM was running some Cloudlet.
Returns the last buzy time (in seconds)
getPeVerticalScaling
VerticalVmScaling getPeVerticalScaling()Gets a VerticalVmScaling that will check if the Vm’s Pe is overloaded, based on some conditions definedby a Predicate given to the VerticalVmScaling, and then request the RAM up scaling.
getProcessor
Processor getProcessor()Gets the Processor of this VM. It is its Virtual CPU which may be compounded of multiple Pes.
396 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getRam
Resource getRam()Gets the RAM resource assigned to the Vm, allowing to check its capacity (in Megabytes) and usage.
Returns the RAM resource
getRamVerticalScaling
VerticalVmScaling getRamVerticalScaling()Gets a VerticalVmScaling that will check if the Vm’s RAM is overloaded, based on some conditionsdefined by a Predicate given to the VerticalVmScaling, and then request the RAM up scaling.
getResources
List<ResourceManageable> getResources()@inheritDoc Such resources represent virtual resources corresponding to physical resources from the Hostwhere the VM is placed.
Returns @inheritDoc
getStartTime
double getStartTime()Gets the time the VM was created into some Host for the first time (in seconds). The value -1 means the VMwas not created yet.
getStateHistory
List<VmStateHistoryEntry> getStateHistory()Gets a read-only list with the history of requests and allocation of MIPS for this VM.
Returns the state history
getStopTime
double getStopTime()Gets the time the VM was destroyed into the last Host it executed (in seconds). The value -1 means the VM hasnot stopped or has not even started yet.
See also: .isCreated()
getStorage
Resource getStorage()Gets the storage device of the VM, which represents the VM image, allowing to check its capacity (inMegabytes) and usage.
Returns the storage resource
1.26. org.cloudbus.cloudsim.vms 397
CloudSim Plus Documentation, Release 1.0.0
getTotalCpuMipsUsage
double getTotalCpuMipsUsage(double time)Gets the total CPU MIPS utilization of all PEs from all cloudlets running on this VM at the given time.
Parameters
• time – the time to get the utilization
Returns total CPU utilization in MIPS
See also: .getCpuPercentUsage(double)
getTotalExecutionTime
double getTotalExecutionTime()Gets the total time (in seconds) the Vm spent executing. It considers the entire VM execution even if in differentHosts it has possibly migrated.
Returns the VM total execution time if the VM has stopped, the time executed so far if the VM isrunning yet, or 0 if it hasn’t started.
getUtilizationHistory
UtilizationHistory getUtilizationHistory()Gets the object containing CPU utilization percentage history (between [0 and 1], where 1 is 100%). The historycan be obtained by calling VmUtilizationHistory.getHistory(). Initially, the data collection isdisabled. To enable it call VmUtilizationHistory.enable().
Utilization history for Hosts, obtained by calling Host.getUtilizationHistory() is just available ifthe utilization history for its VM is enabled.
The time interval in which utilization is collected is defined by the Datacenter.getSchedulingInterval().
See also: UtilizationHistory.enable()
getVmm
String getVmm()Gets the Virtual Machine Monitor (VMM) that manages the VM.
Returns VMM
isCreated
boolean isCreated()Checks if the VM was created and placed inside the Host. If so, resources required by the Vm already wereprovisioned.
Returns true, if it was created inside the Host, false otherwise
398 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isFailed
boolean isFailed()Checks if the Vm is failed or not.
See also: .isWorking()
isInMigration
boolean isInMigration()Checks if the VM is in migration process or not, that is, if it is migrating in or out of a Host.
isWorking
boolean isWorking()Checks if the Vm is working or failed.
See also: .isFailed()
notifyOnCreationFailureListeners
void notifyOnCreationFailureListeners(Datacenter failedDatacenter)Notifies all registered listeners when the Vm fail in being placed for lack of a Host with enough resources in aspecific Datacenter.
This method is used just internally and must not be called directly.
Parameters
• failedDatacenter – the Datacenter where the VM creation failed
notifyOnHostAllocationListeners
void notifyOnHostAllocationListeners()Notifies all registered listeners when a Host is allocated to the Vm.
This method is used just internally and must not be called directly.
notifyOnHostDeallocationListeners
void notifyOnHostDeallocationListeners(Host deallocatedHost)Notifies all registered listeners when the Vm is moved/removed from a Host.
This method is used just internally and must not be called directly.
Parameters
• deallocatedHost – the Host the Vm was moved/removed from
1.26. org.cloudbus.cloudsim.vms 399
CloudSim Plus Documentation, Release 1.0.0
removeOnCreationFailureListener
boolean removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)Removes a listener from the onVmCreationFailureListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
removeOnHostAllocationListener
boolean removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)Removes a listener from the onHostAllocationListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
removeOnHostDeallocationListener
boolean removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)Removes a listener from the onHostDeallocationListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
removeOnUpdateProcessingListener
boolean removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)Removes a listener from the onUpdateVmProcessingListener List.
Parameters
• listener – the listener to remove
Returns true if the listener was found and removed, false otherwise
setBroker
Vm setBroker(DatacenterBroker broker)Sets a DatacenterBroker that represents the owner of this Vm.
Parameters
• broker – the DatacenterBroker to set
400 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setBw
Vm setBw(long bwCapacity)Sets the BW capacity
Parameters
• bwCapacity – new BW capacity
setBwVerticalScaling
Vm setBwVerticalScaling(VerticalVmScaling bwVerticalScaling)Sets a VerticalVmScaling that will check if the Vm’s Bandwidth is under or overloaded, based onsome conditions defined by Predicates given to the VerticalVmScaling, and then request the Bandwidth upor down scaling.
Parameters
• bwVerticalScaling – the VerticalVmScaling to set
Throws
• IllegalArgumentException – if the given VmScaling is already linked to a Vm.Each VM must have its own VerticalVmScaling objects or none at all.
setCloudletScheduler
Vm setCloudletScheduler(CloudletScheduler cloudletScheduler)Sets the Cloudlet scheduler the Vm uses to schedule cloudlets execution. It also sets the Vm itself to the givenscheduler.
Parameters
• cloudletScheduler – the cloudlet scheduler to set
setCreated
void setCreated(boolean created)Changes the created status of the Vm inside the Host.
Parameters
• created – true to indicate the VM was created inside the Host; false otherwise
See also: .isCreated()
setDescription
Vm setDescription(String description)Sets the VM description, which is an optional text which one can use to provide details about this of this VM.
Parameters
• description – the Vm description to set
1.26. org.cloudbus.cloudsim.vms 401
CloudSim Plus Documentation, Release 1.0.0
setFailed
void setFailed(boolean failed)Sets the status of VM to FAILED.
Parameters
• failed – true to indicate that the VM is failed, false to indicate it is working
setHorizontalScaling
Vm setHorizontalScaling(HorizontalVmScaling horizontalScaling)Sets a HorizontalVmScaling that will check if the Vm is overloaded, based on some conditions definedby a Predicate given to the HorizontalVmScaling, and then request the creation of new VMs to horizontallyscale the Vm.
Parameters
• horizontalScaling – the HorizontalVmScaling to set
Throws
• IllegalArgumentException – if the given VmScaling is already linked to a Vm.Each VM must have its own HorizontalVmScaling object or none at all.
setHost
void setHost(Host host)Sets the PM that hosts the VM.
Parameters
• host – Host to run the VM
setInMigration
void setInMigration(boolean inMigration)Defines if the VM is in migration process or not.
Parameters
• inMigration – true to indicate the VM is migrating into a Host, false otherwise
setPeVerticalScaling
Vm setPeVerticalScaling(VerticalVmScaling peVerticalScaling)Sets a VerticalVmScaling that will check if the Vm’s Pe is under or overloaded, based on some conditionsdefined by Predicates given to the VerticalVmScaling, and then request the Pe up or down scaling.
The Pe scaling is performed by adding or removing PEs to/from the VM. Added PEs will have the same MIPSthan the already existing ones.
Parameters
• peVerticalScaling – the VerticalVmScaling to set
Throws
402 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• IllegalArgumentException – if the given VmScaling is already linked to a Vm.Each VM must have its own VerticalVmScaling objects or none at all.
setRam
Vm setRam(long ramCapacity)Sets RAM capacity in Megabytes.
Parameters
• ramCapacity – new RAM capacity
setRamVerticalScaling
Vm setRamVerticalScaling(VerticalVmScaling ramVerticalScaling)Sets a VerticalVmScaling that will check if the Vm’s Ram is under or overloaded, based on some condi-tions defined by Predicates given to the VerticalVmScaling, and then request the RAM up or down scaling.
Parameters
• ramVerticalScaling – the VerticalVmScaling to set
Throws
• IllegalArgumentException – if the given VmScaling is already linked to a Vm.Each VM must have its own VerticalVmScaling objects or none at all.
setSize
Vm setSize(long size)Sets the storage size (capacity) of the VM image in Megabytes.
Parameters
• size – new storage size
setStartTime
Vm setStartTime(double startTime)Sets the time the VM was created into some Host for the first time. The value -1 means the VM was not createdyet.
Parameters
• startTime – the start time to set (in seconds)
setStopTime
Vm setStopTime(double stopTime)Sets the time the VM was destroyed into the last Host it executed (in seconds). The value -1 means the VM hasnot stopped or has not even started yet.
Parameters
• stopTime – the stop time to set (in seconds)
1.26. org.cloudbus.cloudsim.vms 403
CloudSim Plus Documentation, Release 1.0.0
See also: .isCreated()
updateProcessing
double updateProcessing(double currentTime, List<Double> mipsShare)Updates the processing of cloudlets running on this VM.
Parameters
• currentTime – current simulation time
• mipsShare – list with MIPS share of each Pe available to the scheduler
Returns the predicted completion time of the earliest finishing cloudlet (which is a relative delayfrom the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet toexecute
1.26.4 VmNull
final class VmNull implements VmA class that implements the Null Object Design Pattern for Vm objects.
Author Manoel Campos da Silva Filho
See also: Vm.NULL
Methods
addOnCreationFailureListener
public Vm addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
addOnHostAllocationListener
public Vm addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
addOnHostDeallocationListener
public Vm addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
addOnUpdateProcessingListener
public Vm addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
addStateHistoryEntry
public void addStateHistoryEntry(VmStateHistoryEntry entry)
404 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
allocateResource
public void allocateResource(Class<? extends ResourceManageable> c, long amount)
compareTo
public int compareTo(Vm o)
deallocateResource
public void deallocateResource(Class<? extends ResourceManageable> c)
getBroker
public DatacenterBroker getBroker()
getBw
public Resource getBw()
getBwVerticalScaling
public VerticalVmScaling getBwVerticalScaling()
getCloudletScheduler
public CloudletScheduler getCloudletScheduler()
getCpuPercentUsage
public double getCpuPercentUsage(double time)
getCpuPercentUsage
public double getCpuPercentUsage()
getCurrentAllocatedBw
public long getCurrentAllocatedBw()
getCurrentAllocatedRam
public long getCurrentAllocatedRam()
1.26. org.cloudbus.cloudsim.vms 405
CloudSim Plus Documentation, Release 1.0.0
getCurrentAllocatedSize
public long getCurrentAllocatedSize()
getCurrentRequestedBw
public long getCurrentRequestedBw()
getCurrentRequestedMaxMips
public double getCurrentRequestedMaxMips()
getCurrentRequestedMips
public List<Double> getCurrentRequestedMips()
getCurrentRequestedRam
public long getCurrentRequestedRam()
getCurrentRequestedTotalMips
public double getCurrentRequestedTotalMips()
getDescription
public String getDescription()
getHorizontalScaling
public HorizontalVmScaling getHorizontalScaling()
getHost
public Host getHost()
getId
public int getId()
getIdleInterval
public double getIdleInterval()
406 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getLastBuzyTime
public double getLastBuzyTime()
getMips
public double getMips()
getNumberOfPes
public long getNumberOfPes()
getPeVerticalScaling
public VerticalVmScaling getPeVerticalScaling()
getProcessor
public Processor getProcessor()
getRam
public Resource getRam()
getRamVerticalScaling
public VerticalVmScaling getRamVerticalScaling()
getResources
public List<ResourceManageable> getResources()
getSimulation
public Simulation getSimulation()
getStartTime
public double getStartTime()
getStateHistory
public List<VmStateHistoryEntry> getStateHistory()
1.26. org.cloudbus.cloudsim.vms 407
CloudSim Plus Documentation, Release 1.0.0
getStopTime
public double getStopTime()
getStorage
public Resource getStorage()
getSubmissionDelay
public double getSubmissionDelay()
getTotalCpuMipsUsage
public double getTotalCpuMipsUsage(double time)
getTotalExecutionTime
public double getTotalExecutionTime()
getTotalMipsCapacity
public double getTotalMipsCapacity()
getUid
public String getUid()
getUtilizationHistory
public UtilizationHistory getUtilizationHistory()
getVmm
public String getVmm()
isCreated
public boolean isCreated()
isFailed
public boolean isFailed()
408 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isInMigration
public boolean isInMigration()
isWorking
public boolean isWorking()
notifyOnCreationFailureListeners
public void notifyOnCreationFailureListeners(Datacenter failedDatacenter)
notifyOnHostAllocationListeners
public void notifyOnHostAllocationListeners()
notifyOnHostDeallocationListeners
public void notifyOnHostDeallocationListeners(Host deallocatedHost)
removeOnCreationFailureListener
public boolean removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo>listener)
removeOnHostAllocationListener
public boolean removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
removeOnHostDeallocationListener
public boolean removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
setBroker
public Vm setBroker(DatacenterBroker broker)
setBw
public Vm setBw(long bwCapacity)
1.26. org.cloudbus.cloudsim.vms 409
CloudSim Plus Documentation, Release 1.0.0
setBwVerticalScaling
public Vm setBwVerticalScaling(VerticalVmScaling v)
setCloudletScheduler
public Vm setCloudletScheduler(CloudletScheduler cloudletScheduler)
setCreated
public void setCreated(boolean created)
setDescription
public Vm setDescription(String description)
setFailed
public void setFailed(boolean failed)
setHorizontalScaling
public Vm setHorizontalScaling(HorizontalVmScaling h)
setHost
public void setHost(Host host)
setId
public void setId(int id)
setInMigration
public void setInMigration(boolean inMigration)
setPeVerticalScaling
public Vm setPeVerticalScaling(VerticalVmScaling peVerticalScaling)
setRam
public Vm setRam(long ramCapacity)
410 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setRamVerticalScaling
public Vm setRamVerticalScaling(VerticalVmScaling v)
setSize
public Vm setSize(long size)
setStartTime
public Vm setStartTime(double startTime)
setStopTime
public Vm setStopTime(double stopTime)
setSubmissionDelay
public void setSubmissionDelay(double submissionDelay)
toString
public String toString()
updateProcessing
public double updateProcessing(double currentTime, List<Double> mipsShare)
1.26.5 VmSimple
public class VmSimple implements VmImplements the basic features of a Virtual Machine (VM) that runs inside a Host that may be shared amongother VMs. It processes cloudlets. This processing happens according to a policy, defined by theCloudletScheduler. Each VM has a owner (user), which can submit cloudlets to the VM to executethem.
Author Rodrigo N. Calheiros, Anton Beloglazov
Fields
utilizationHistory
protected final UtilizationHistory utilizationHistorySee also: .getUtilizationHistory()
1.26. org.cloudbus.cloudsim.vms 411
CloudSim Plus Documentation, Release 1.0.0
Constructors
VmSimple
public VmSimple(int id, long mipsCapacity, long numberOfPes)Creates a Vm with 1024 MEGABYTE of RAM, 1000 Megabits/s of Bandwidth and 1024 MEGABYTE ofStorage Size. To change these values, use the respective setters. While the Vm is being instantiated,such values can be changed freely.
Parameters
• id – unique ID of the VM
• mipsCapacity – the mips capacity of each Vm Pe
• numberOfPes – amount of Pe (CPU cores)
VmSimple
public VmSimple(long mipsCapacity, long numberOfPes)Creates a Vm with 1024 MEGABYTE of RAM, 1000 Megabits/s of Bandwidth and 1024 MEGABYTEof Storage Size. It is not defined an id for the Vm. The id is defined when the Vm is submitted to aDatacenterBroker. To change these values, use the respective setters. While the Vm is beinginstantiated, such values can be changed freely.
Parameters
• mipsCapacity – the mips capacity of each Vm Pe
• numberOfPes – amount of Pe (CPU cores)
VmSimple
public VmSimple(int id, double mipsCapacity, long numberOfPes)Creates a Vm with 1024 MEGABYTE of RAM, 1000 Megabits/s of Bandwidth and 1024 MEGABYTE ofStorage Size. To change these values, use the respective setters. While the Vm is being instantiated,such values can be changed freely.
It receives the amount of MIPS as a double value but converts it internally to a long. The method is just providedas a handy-way to create a Vm using a double value for MIPS that usually is generated from some computations.
Parameters
• id – unique ID of the VM
• mipsCapacity – the mips capacity of each Vm Pe
• numberOfPes – amount of Pe (CPU cores)
Methods
addOnCreationFailureListener
public Vm addOnCreationFailureListener(EventListener<VmDatacenterEventInfo> listener)
412 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addOnHostAllocationListener
public Vm addOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
addOnHostDeallocationListener
public Vm addOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
addOnUpdateProcessingListener
public Vm addOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
addStateHistoryEntry
public void addStateHistoryEntry(VmStateHistoryEntry entry)
allocateResource
public void allocateResource(Class<? extends ResourceManageable> resourceClass, long newTotalRe-sourceAmount)
compareTo
public int compareTo(Vm o)Compare this Vm with another one based on getTotalMipsCapacity().
Parameters
• o – the Vm to compare to
Returns @inheritDoc
deallocateResource
public void deallocateResource(Class<? extends ResourceManageable> resourceClass)
equals
public boolean equals(Object o)
getBroker
public DatacenterBroker getBroker()
1.26. org.cloudbus.cloudsim.vms 413
CloudSim Plus Documentation, Release 1.0.0
getBw
public Resource getBw()
getBwVerticalScaling
public VerticalVmScaling getBwVerticalScaling()
getCloudletScheduler
public CloudletScheduler getCloudletScheduler()
getCpuPercentUsage
public double getCpuPercentUsage()
getCpuPercentUsage
public double getCpuPercentUsage(double time)
getCurrentAllocatedBw
public long getCurrentAllocatedBw()
getCurrentAllocatedRam
public long getCurrentAllocatedRam()
getCurrentAllocatedSize
public long getCurrentAllocatedSize()Gets the current allocated storage size.
Returns the current allocated size
See also: Vm.getStorage()
getCurrentRequestedBw
public long getCurrentRequestedBw()
getCurrentRequestedMaxMips
public double getCurrentRequestedMaxMips()
414 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCurrentRequestedMips
public List<Double> getCurrentRequestedMips()
getCurrentRequestedRam
public long getCurrentRequestedRam()
getCurrentRequestedTotalMips
public double getCurrentRequestedTotalMips()
getDescription
public String getDescription()
getHorizontalScaling
public HorizontalVmScaling getHorizontalScaling()
getHost
public Host getHost()
getId
public int getId()
getIdleInterval
public double getIdleInterval()
getLastBuzyTime
public double getLastBuzyTime()
getMips
public double getMips()
getNumberOfPes
public long getNumberOfPes()
1.26. org.cloudbus.cloudsim.vms 415
CloudSim Plus Documentation, Release 1.0.0
getPeVerticalScaling
public VerticalVmScaling getPeVerticalScaling()
getProcessor
public Processor getProcessor()
getRam
public Resource getRam()
getRamVerticalScaling
public VerticalVmScaling getRamVerticalScaling()
getResources
public List<ResourceManageable> getResources()
getSimulation
public Simulation getSimulation()
getStartTime
public double getStartTime()
getStateHistory
public List<VmStateHistoryEntry> getStateHistory()
getStopTime
public double getStopTime()
getStorage
public Resource getStorage()
getSubmissionDelay
public double getSubmissionDelay()
416 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getTotalCpuMipsUsage
public double getTotalCpuMipsUsage(double time)
getTotalExecutionTime
public double getTotalExecutionTime()
getTotalMipsCapacity
public double getTotalMipsCapacity()
getUid
public String getUid()
getUtilizationHistory
public UtilizationHistory getUtilizationHistory()
getVmm
public String getVmm()
hashCode
public int hashCode()
isCreated
public final boolean isCreated()
isFailed
public boolean isFailed()
isInMigration
public boolean isInMigration()
isWorking
public boolean isWorking()
1.26. org.cloudbus.cloudsim.vms 417
CloudSim Plus Documentation, Release 1.0.0
notifyOnCreationFailureListeners
public void notifyOnCreationFailureListeners(Datacenter failedDatacenter)
notifyOnHostAllocationListeners
public void notifyOnHostAllocationListeners()
notifyOnHostDeallocationListeners
public void notifyOnHostDeallocationListeners(Host deallocatedHost)
notifyOnUpdateProcessingListeners
public void notifyOnUpdateProcessingListeners()Notifies all registered listeners when the processing of the Vm is updated in its Host.
removeOnCreationFailureListener
public boolean removeOnCreationFailureListener(EventListener<VmDatacenterEventInfo>listener)
removeOnHostAllocationListener
public boolean removeOnHostAllocationListener(EventListener<VmHostEventInfo> listener)
removeOnHostDeallocationListener
public boolean removeOnHostDeallocationListener(EventListener<VmHostEventInfo> listener)
removeOnUpdateProcessingListener
public boolean removeOnUpdateProcessingListener(EventListener<VmHostEventInfo> listener)
setBroker
public final Vm setBroker(DatacenterBroker broker)
setBw
public final Vm setBw(long bwCapacity)
418 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setBwVerticalScaling
public final Vm setBwVerticalScaling(VerticalVmScaling bwVerticalScaling)
setCloudletScheduler
public final Vm setCloudletScheduler(CloudletScheduler cloudletScheduler)
setCreated
public final void setCreated(boolean created)
setDescription
public Vm setDescription(String description)
setFailed
public void setFailed(boolean failed)
setHorizontalScaling
public final Vm setHorizontalScaling(HorizontalVmScaling horizontalScaling)
setHost
public final void setHost(Host host)
setId
public final void setId(int id)Sets the VM id.
Parameters
• id – the new VM id, that has to be unique for the current broker
setInMigration
public final void setInMigration(boolean inMigration)
1.26. org.cloudbus.cloudsim.vms 419
CloudSim Plus Documentation, Release 1.0.0
setMips
protected final void setMips(double mips)Sets the individual MIPS capacity of any VM’s PE, considering that all PEs have the same capacity.
Parameters
• mips – the new mips for every VM’s PE
setPeVerticalScaling
public final Vm setPeVerticalScaling(VerticalVmScaling peVerticalScaling)
setRam
public final Vm setRam(long ramCapacity)
setRamVerticalScaling
public final Vm setRamVerticalScaling(VerticalVmScaling ramVerticalScaling)
setSize
public final Vm setSize(long size)
setStartTime
public Vm setStartTime(double startTime)
setStopTime
public Vm setStopTime(double stopTime)
setSubmissionDelay
public final void setSubmissionDelay(double submissionDelay)
setVmm
protected final void setVmm(String vmm)Sets the Virtual Machine Monitor (VMM) that manages the VM.
Parameters
• vmm – the new VMM
420 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
toString
public String toString()
updateProcessing
public double updateProcessing(double currentTime, List<Double> mipsShare)
1.26.6 VmStateHistoryEntry
public class VmStateHistoryEntryHistoric data about requests and allocation of MIPS for a given VM over the time.
Author Anton Beloglazov
Constructors
VmStateHistoryEntry
public VmStateHistoryEntry(double time, double allocatedMips, double requestedMips, boolean inMi-gration)
Instantiates a new VmStateHistoryEntry
Parameters
• time – the time
• allocatedMips – the allocated mips
• requestedMips – the requested mips
• inMigration – the is in migration
Methods
equals
public boolean equals(Object obj)
getAllocatedMips
public double getAllocatedMips()Gets the allocated mips.
Returns the allocated mips
getRequestedMips
public double getRequestedMips()Gets the requested mips.
Returns the requested mips
1.26. org.cloudbus.cloudsim.vms 421
CloudSim Plus Documentation, Release 1.0.0
getTime
public double getTime()Gets the time.
Returns the time
hashCode
public int hashCode()
isInMigration
public boolean isInMigration()Checks if the Vm is in migration for the current history.
Returns true if the Vm is in migration, false otherwise
setAllocatedMips
protected final void setAllocatedMips(double allocatedMips)Sets the allocated mips.
Parameters
• allocatedMips – the new allocated mips
setInMigration
protected final void setInMigration(boolean inMigration)Defines if the Vm is in migration for the current history.
Parameters
• inMigration – true if the Vm is in migration, false otherwise
setRequestedMips
protected final void setRequestedMips(double requestedMips)Sets the requested mips.
Parameters
• requestedMips – the new requested mips
setTime
protected final void setTime(double time)Sets the time.
Parameters
• time – the new time
422 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.26.7 VmUtilizationHistory
public class VmUtilizationHistory implements UtilizationHistoryStores resource utilization data for a specific Vm.
Author Anton Beloglazov, Manoel Campos da Silva Filho
Fields
history
public final List<Double> historySee also: .getHistory()
previousTime
public double previousTimeSee also: .getPreviousTime()
Constructors
VmUtilizationHistory
public VmUtilizationHistory(Vm vm, boolean enabled)Instantiates the class to store resource utilization history for a specific Vm.
Parameters
• vm – the vm to instantiates the object to store utilization history
• enabled – true if the history must be enabled by default, enabling usage history to becollected and stored; false if it must be disabled to avoid storing any history, in order toreduce memory usage
VmUtilizationHistory
public VmUtilizationHistory(Vm vm)
Methods
addUtilizationHistory
public void addUtilizationHistory(double time)
disable
public void disable()
1.26. org.cloudbus.cloudsim.vms 423
CloudSim Plus Documentation, Release 1.0.0
enable
public void enable()
getHistory
public List<Double> getHistory()
getMaxHistoryEntries
public int getMaxHistoryEntries()
getPreviousTime
public double getPreviousTime()
getUtilizationMad
public double getUtilizationMad()
getUtilizationMean
public double getUtilizationMean()
getUtilizationVariance
public double getUtilizationVariance()
isEnabled
public boolean isEnabled()
setMaxHistoryEntries
public void setMaxHistoryEntries(int maxHistoryEntries)
setPreviousTime
public void setPreviousTime(double previousTime)
424 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.27 org.cloudbus.cloudsim.vms.network
Provides network-enabled org.cloudbus.cloudsim.vms.Vm implementations. For more general information,see the package org.cloudbus.cloudsim.vms at the upper level.
author Manoel Campos da Silva Filho
1.27.1 NetworkVm
public class NetworkVm extends VmSimpleNetworkVm class extends VmSimple to support simulation of networked datacenters. It executes actionsrelated to management of packets (sent and received).
Please refer to following publication for more details:
• Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in CloudSimulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud Computing(UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
Author Saurabh Kumar Garg
Constructors
NetworkVm
public NetworkVm(int id, long mipsCapacity, int numberOfPes)Creates a NetworkVm with 1024 MEGABYTE of RAM, 1000 Megabits/s of Bandwidth and 1024 MEGABYTEof Storage Size. To change these values, use the respective setters. While the Vm is not createdinside a Host, such values can be changed freely.
Parameters
• id – unique ID of the VM
• mipsCapacity – the mips capacity of each Vm Pe
• numberOfPes – amount of Pe (CPU cores)
NetworkVm
public NetworkVm(int id, DatacenterBroker broker, long mipsCapacity, int numberOfPes, int ramCapacity,long bwCapacity, long size, String vmm, CloudletScheduler cloudletScheduler)
Creates a NetworkVm with the given parameters.
Parameters
• id – unique ID of the VM
• broker – ID of the VM’s owner, that is represented by the id of the DatacenterBroker
• mipsCapacity – the mips capacity of each Vm Pe
• numberOfPes – amount of Pe (CPU cores)
• ramCapacity – amount of ram in Megabytes
• bwCapacity – amount of bandwidth to be allocated to the VM (in Megabits/s)
1.27. org.cloudbus.cloudsim.vms.network 425
CloudSim Plus Documentation, Release 1.0.0
• size – size the VM image in Megabytes (the amount of storage it will use, at least initially).
• vmm – Virtual Machine Monitor that manages the VM lifecycle
• cloudletScheduler – scheduler that defines the execution policy for Cloudlets insidethis Vm
Methods
compareTo
public int compareTo(Vm o)
getCloudletList
public List<NetworkCloudlet> getCloudletList()List of NetworkCloudlet of the VM.
getFinishTime
public double getFinishTime()The time when the VM finished to process its cloudlets.
getReceivedPacketList
public List<VmPacket> getReceivedPacketList()List of packets received by the VM.
isFree
public boolean isFree()Indicates if the VM is free or not.
setCloudletList
public void setCloudletList(List<NetworkCloudlet> cloudletList)
setFinishTime
public void setFinishTime(double finishTime)
setFree
public void setFree(boolean free)
426 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setReceivedPacketList
public void setReceivedPacketList(List<VmPacket> receivedPacketList)
1.28 org.cloudsimplus.autoscaling
Provides classes to enable horizontal and vertical scaling of VMs in order to, respectively, adapt resource requirementsto current workload and to balance load across different VMs.
These scaling mechanisms define a java.util.function.Predicate that define the condition to fire the scal-ing mechanism. The org.cloudbus.cloudsim.brokers.DatacenterBroker that the VM belongs to isaccountable to evaluate the predicate and then request the scaling mechanism to act.
author Manoel Campos da Silva Filho
1.28.1 HorizontalVmScaling
public interface HorizontalVmScaling extends VmScalingA Vm Horizontal Scaling mechanism used by a DatacenterBroker to dynamically create VMs accordingto the arrival of Cloudlets, in order to enable load balancing.
Since Cloudlets can be created and submitted to a broker in runtime, the number of arrived Cloudlets can beto much to existing VMs, requiring the creation of new VMs to balance the load. A HorizontalVmScalingimplementation performs such up scaling by creating VMs as needed.
To enable horizontal down scaling to destroy idle VMs, the DatacenterBroker has to be used bysetting a DatacenterBroker.getVmDestructionDelayFunction(). Since there is no Cloudletmigration mechanism (and it isn’t intended to have), if a VM becomes underloaded, there is nothingthat can be done until all Cloudlets finish executing. When that happens, the DatacenterBroker.getVmDestructionDelayFunction() will handle such a situation.
Author Manoel Campos da Silva Filho
Fields
FALSE_PREDICATE
Predicate<Vm> FALSE_PREDICATE
NULL
HorizontalVmScaling NULLAn attribute that implements the Null Object Design Pattern for HorizontalVmScaling objects.
Methods
getOverloadPredicate
Predicate<Vm> getOverloadPredicate()Gets a Predicate that defines when Vm is overloaded or not, that will make the Vm’s DatacenterBroker
1.28. org.cloudsimplus.autoscaling 427
CloudSim Plus Documentation, Release 1.0.0
to up scale the VM. The up scaling is performed by creating new VMs to attend new arrived Cloudlets and thenbalance the load.
See also: .setOverloadPredicate(Predicate)
getVmSupplier
Supplier<Vm> getVmSupplier()Gets a Supplier that will be used to create VMs when the Load Balancer detects that the current Broker’sVMs are overloaded.
requestUpScalingIfPredicateMatches
boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)Requests a horizontal scale if the Vm is overloaded, according to the getOverloadPredicate() predicate.The scaling is performed by creating a new Vm using the getVmSupplier() method and submitting it tothe broker.
The time interval in which it will be checked if the Vm is overloaded depends on the Datacenter.getSchedulingInterval() value. Make sure to set such a value to enable the periodic overload veri-fication.
The method will check the need to create a new VM at the time interval defined by the . A VM creation requestis only sent when the VM is overloaded and new Cloudlets were submitted to the broker.
Parameters
• evt – current simulation time
Returns @inheritDoc
setOverloadPredicate
VmScaling setOverloadPredicate(Predicate<Vm> predicate)Sets a Predicate that defines when the Vm is overloaded or not, making the DatacenterBroker to upscale the VM. The up scaling is performed by creating new VMs to attend new arrived Cloudlets in order tobalance the load.
Parameters
• predicate – a predicate that checks certain conditions to define a Vm as overloaded.The predicate receives the Vm that has to be checked. Such a condition can be defined,for instance, based on Vm’s Vm.getCpuPercentUsage(double) CPU usage and/orany other VM resource usage. Despite the VmScaling already is already linked to a Vm, theVm parameter for the Predicate enables reusing the same predicate to detect overloadof different VMs.
setVmSupplier
HorizontalVmScaling setVmSupplier(Supplier<Vm> supplier)Sets a Supplier that will be used to create VMs when the Load Balancer detects that Broker’s VMs areoverloaded.
Parameters
428 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• supplier – the supplier to set
1.28.2 HorizontalVmScalingNull
final class HorizontalVmScalingNull implements HorizontalVmScalingA class that implements the Null Object Design Pattern for HorizontalVmScaling class.
Author Manoel Campos da Silva Filho
See also: HorizontalVmScaling.NULL
Methods
getOverloadPredicate
public Predicate<Vm> getOverloadPredicate()
getVm
public Vm getVm()
getVmSupplier
public Supplier<Vm> getVmSupplier()
requestUpScalingIfPredicateMatches
public boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
setOverloadPredicate
public VmScaling setOverloadPredicate(Predicate<Vm> predicate)
setVm
public VmScaling setVm(Vm vm)
setVmSupplier
public HorizontalVmScaling setVmSupplier(Supplier<Vm> supplier)
1.28. org.cloudsimplus.autoscaling 429
CloudSim Plus Documentation, Release 1.0.0
1.28.3 HorizontalVmScalingSimple
public class HorizontalVmScalingSimple extends VmScalingAbstract implements HorizontalVmScalingA HorizontalVmScaling implementation that allows defining the condition to identify an over-loaded VM, based on any desired criteria, such as current RAM, CPU and/or Bandwidth utilization. ADatacenterBroker monitors the VMs that have an HorizontalVmScaling object in order to create or destroyVMs on demand.
The overload condition has to be defined by providing a Predicate using thesetOverloadPredicate(Predicate) method. Check the HorizontalVmScaling documen-tation for details on how to enable horizontal down scaling using the DatacenterBroker.
Author Manoel Campos da Silva Filho
See also: HorizontalVmScaling
Constructors
HorizontalVmScalingSimple
public HorizontalVmScalingSimple()
Methods
getOverloadPredicate
public Predicate<Vm> getOverloadPredicate()
getVmSupplier
public Supplier<Vm> getVmSupplier()
requestUpScaling
protected boolean requestUpScaling(double time)
requestUpScalingIfPredicateMatches
public final boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
setOverloadPredicate
public VmScaling setOverloadPredicate(Predicate<Vm> predicate)
setVmSupplier
public final HorizontalVmScaling setVmSupplier(Supplier<Vm> supplier)
430 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.28.4 VerticalVmScaling
public interface VerticalVmScaling extends VmScalingA Vm Vertical Scaling mechanism used by a DatacenterBroker to request the dynamic scale of VMresources up or down, according to the current resource usage. For each resource supposed to be scaled, adifferent VerticalVmScaling instance should be provided. If a scaling object is going to be set to a Vm, ithas to be exclusive of that Vm. Different Vms must have different instances of a scaling object.
A Vm runs a set of Cloudlets. When a VerticalVmScaling object is attached to a Vm, it’s required todefine which resource will be scaled (Ram, Bandwidth, etc) when it’s under or overloaded.
The scaling request follows this path:
• a Vm that has a VerticalVmScaling object set monitors its own resource usage using anEventListener, to check if an under or overload condition is met;
• if any of these conditions is met, the Vm uses the VerticalVmScaling to send a scaling request to itsDatacenterBroker;
• the DatacenterBroker fowards the request to the Datacenter where the Vm is hosted;
• the Datacenter delegates the task to its VmAllocationPolicy;
• the VmAllocationPolicy checks if there is resource availability and then finally scale the Vm.
WARNING
Make sure that the UtilizationModel of some of these Cloudlets is defined as ABSOLUTE. Defin-ing the UtilizationModel of all Cloudlets running inside the Vm as PERCENTAGE causes theseCloudlets to automatically increase/decrease their resource usage when the Vm resource is vertically scaled.This is not a CloudSim Plus issue, but the natural and maybe surprising effect that may trap researchers tryingto implement and assess VM scaling policies.
Consider the following example: a VerticalVmScaling is attached to a Vm to double its Ram whenits usage reaches 50%. The Vm has 10GB of RAM. All Cloudlets running inside this Vm have aUtilizationModel for their RAM utilization define in PERCENTAGE. When the RAM utilization of allthese Cloudlets reach the 50% (5GB), the Vm Ram will be doubled. However, as the RAM usage of therunning Cloudlets is defined in percentage, they will continue to use 50% of Vm’s RAM, that now represents10GB from the 20GB capacity. This way, the vertical scaling will have no real benefit.
Author Manoel Campos da Silva Filho
Fields
NULL
VerticalVmScaling NULLAn attribute that implements the Null Object Design Pattern for VerticalVmScaling objects.
Methods
getAllocatedResource
long getAllocatedResource()Gets the current amount allocated to the resource managed by this scaling object. It is just a shortcut togetVmResourceToScale.getAllocatedResource().
Returns the amount of allocated resource
1.28. org.cloudsimplus.autoscaling 431
CloudSim Plus Documentation, Release 1.0.0
getLowerThresholdFunction
Function<Vm, Double> getLowerThresholdFunction()Gets a Function that defines the lower utilization threshold for a Vm which indicates if it is underloaded ornot. If it is underloaded, the Vm’s DatacenterBroker will request to down scale the VM. The down scalingis performed by decreasing the amount of the resource the scaling is associated to.
This function must receive a Vm and return the lower utilization threshold for it as a percentage value between0 and 1 (where 1 is 100%). The VM will be defined as underloaded if the utilization of the Resource thisscaling object is related to is lower than the value returned by the Function returned by this method.
See also: .setLowerThresholdFunction(Function)
getResource
Resource getResource()Gets the actual Vm Resource this scaling object is in charge of scaling. This resource is defined after callingthe setResourceClass(Class).
getResourceAmountToScale
double getResourceAmountToScale()Gets the absolute amount of the Vm resource which has to be scaled up or down, based on the scalingfactor.
Returns the absolute amount of the Vm resource to scale
See also: .getResourceClass()
getResourceClass
Class<? extends ResourceManageable> getResourceClass()Gets the class of Vm resource this scaling object will request up or down scaling. Such a class can be Ram.class,Bandwidth.class or Pe.class.
See also: .getResource()
getResourceUsageThresholdFunction
Function<Vm, Double> getResourceUsageThresholdFunction()Gets the lower or upper resource utilization threshold Function, depending if the Vm resource is under oroverloaded, respectively.
Returns the lower resource utilization threshold function if the Vm resource is underloaded, upperresource utilization threshold function if the Vm resource is overloaded, or a function that alwaysreturns 0 if the Vm isn’t in any of these conditions.
See also: .getLowerThresholdFunction(), .getUpperThresholdFunction()
432 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getScalingFactor
double getScalingFactor()Gets the factor that will be used to scale a Vm resource up or down, whether such a resource is over or under-loaded, according to the defined predicates.
If the resource to scale is a Pe, this is the number of PEs to request adding or removing when the VM is overor underloaded, respectively. For any other kind of resource, this is a percentage value in scale from 0 to 1.Every time the VM needs to be scaled up or down, this factor will be applied to increase or reduce a specificVM allocated resource.
Returns the scaling factor to set which may be an absolute value (for Pe scaling) or percentage (forscaling other resources)
See also: .getUpperThresholdFunction()
getUpperThresholdFunction
Function<Vm, Double> getUpperThresholdFunction()Gets a Function that defines the upper utilization threshold for a Vm which indicates if it is overloaded ornot. If it is overloaded, the Vm’s DatacenterBroker will request to up scale the VM. The up scaling isperformed by increasing the amount of the resource the scaling is associated to.
This function must receive a Vm and return the upper utilization threshold for it as a percentage value between 0and 1 (where 1 is 100%). The VM will be defined as overloaded if the utilization of the Resource this scalingobject is related to is higher than the value returned by the Function returned by this method.
See also: .setUpperThresholdFunction(Function)
isVmOverloaded
boolean isVmOverloaded()Checks if the Vm is overloaded or not, based on the getUpperThresholdFunction().
Returns true if the Vm is overloaded, false otherwise
isVmUnderloaded
boolean isVmUnderloaded()Checks if the Vm is underloaded or not, based on the getLowerThresholdFunction().
Returns true if the Vm is underloaded, false otherwise
requestUpScalingIfPredicateMatches
boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)Performs the vertical scale if the Vm is overloaded, according to the getUpperThresholdFunction()predicate, increasing the Vm resource to which the scaling object is linked to (that may be RAM, CPU, BW,etc), by the factor defined a scaling factor.
The time interval in which it will be checked if the Vm is overloaded depends on the Datacenter.getSchedulingInterval() value. Make sure to set such a value to enable the periodic overload veri-fication.
1.28. org.cloudsimplus.autoscaling 433
CloudSim Plus Documentation, Release 1.0.0
Parameters
• evt – current simulation time
See also: .getScalingFactor()
setLowerThresholdFunction
VerticalVmScaling setLowerThresholdFunction(Function<Vm, Double> lowerThresholdFunction)Sets a Function that defines the lower utilization threshold for a Vm which indicates if it is underloaded ornot. If it is underloaded, the Vm’s DatacenterBroker will request to down scale the VM. The down scalingis performed by decreasing the amount of the resource the scaling is associated to.
This function must receive a Vm and return the lower utilization threshold for it as a percentage value between 0and 1 (where 1 is 100%).
By setting the lower threshold as a Function instead of a directly storing a Double value which representthe threshold, it is possible to define the threshold dynamically instead of using a static value. Furthermore, thethreshold function can be reused for scaling objects of different VMs.
Parameters
• lowerThresholdFunction – the lower utilization threshold function to set. The VMwill be defined as underloaded if the utilization of the Resource this scaling object isrelated to is lower than the value returned by this Function.
setResourceClass
VerticalVmScaling setResourceClass(Class<? extends ResourceManageable> resourceClass)Sets the class of Vm resource that this scaling object will request up or down scaling. Such a class can beRam.class, Bandwidth.class or Pe.class.
Parameters
• resourceClass – the resource class to set
setResourceScaling
VerticalVmScaling setResourceScaling(ResourceScaling resourceScaling)Sets the ResourceScaling that defines how the resource has to be resized.
Parameters
• resourceScaling – the ResourceScaling to set
setScalingFactor
VerticalVmScaling setScalingFactor(double scalingFactor)Sets the factor that will be used to scale a Vm resource up or down, whether such a resource is over or under-loaded, according to the defined predicates.
If the resource to scale is a Pe, this is the number of PEs to request adding or removing when the VM is overor underloaded, respectively. For any other kind of resource, this is a percentage value in scale from 0 to 1.Every time the VM needs to be scaled up or down, this factor will be applied to increase or reduce a specificVM allocated resource.
434 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• scalingFactor – the scaling factor to set which may be an absolute value (for Pe scal-ing) or percentage (for scaling other resources)
See also: .getUpperThresholdFunction()
setUpperThresholdFunction
VerticalVmScaling setUpperThresholdFunction(Function<Vm, Double> upperThresholdFunction)Sets a Function that defines the upper utilization threshold for a Vm which indicates if it is overloaded ornot. If it is overloaded, the Vm’s DatacenterBroker will request to up scale the VM. The up scaling isperformed by increasing the amount of the resource the scaling is associated to.
This function must receive a Vm and return the upper utilization threshold for it as a percentage value between 0and 1 (where 1 is 100%).
By setting the upper threshold as a Function instead of a directly storing a Double value which representthe threshold, it is possible to define the threshold dynamically instead of using a static value. Furthermore, thethreshold function can be reused for scaling objects of different VMs.
Parameters
• upperThresholdFunction – the upper utilization threshold function to set. The VMwill be defined as overloaded if the utilization of the Resource this scaling object is relatedto is higher than the value returned by this Function.
1.28.5 VerticalVmScalingNull
final class VerticalVmScalingNull implements VerticalVmScalingA class that implements the Null Object Design Pattern for VerticalVmScaling class.
Author Manoel Campos da Silva Filho
See also: VerticalVmScaling.NULL
Methods
getAllocatedResource
public long getAllocatedResource()
getLowerThresholdFunction
public Function<Vm, Double> getLowerThresholdFunction()
getResource
public Resource getResource()
1.28. org.cloudsimplus.autoscaling 435
CloudSim Plus Documentation, Release 1.0.0
getResourceAmountToScale
public double getResourceAmountToScale()
getResourceClass
public Class<? extends ResourceManageable> getResourceClass()
getResourceUsageThresholdFunction
public Function<Vm, Double> getResourceUsageThresholdFunction()
getScalingFactor
public double getScalingFactor()
getUpperThresholdFunction
public Function<Vm, Double> getUpperThresholdFunction()
getVm
public Vm getVm()
isVmOverloaded
public boolean isVmOverloaded()
isVmUnderloaded
public boolean isVmUnderloaded()
requestUpScalingIfPredicateMatches
public boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
setLowerThresholdFunction
public VerticalVmScaling setLowerThresholdFunction(Function<Vm, Double> lowerThresholdFunc-tion)
setResourceClass
public VerticalVmScaling setResourceClass(Class<? extends ResourceManageable> resourceClass)
436 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setResourceScaling
public VerticalVmScaling setResourceScaling(ResourceScaling resourceScaling)
setScalingFactor
public VerticalVmScaling setScalingFactor(double scalingFactor)
setUpperThresholdFunction
public VerticalVmScaling setUpperThresholdFunction(Function<Vm, Double> upperThresholdFunc-tion)
setVm
public VmScaling setVm(Vm vm)
1.28.6 VerticalVmScalingSimple
public class VerticalVmScalingSimple extends VmScalingAbstract implements VerticalVmScalingA VerticalVmScaling implementation which allows a DatacenterBroker to perform on demand upor down scaling for some Vm resource, such as Ram, Pe or Bandwidth.
For each resource that is required to be scaled, a distinct VerticalVmScaling instance must be assigned tothe VM to be scaled.
Author Manoel Campos da Silva Filho
Constructors
VerticalVmScalingSimple
public VerticalVmScalingSimple(Class<? extends ResourceManageable> resourceClassToScale, dou-ble scalingFactor)
Creates a VerticalVmScalingSimple with a ResourceScalingGradual scaling type.
Parameters
• resourceClassToScale – the class of Vm resource that this scaling object will requestup or down scaling (such as Ram.class, Bandwidth.class or Processor.class).
• scalingFactor – the factor (a percentage value in scale from 0 to 1) that will be used toscale a Vm resource up or down, whether such a resource is over or underloaded, accordingto the defined predicates. In the case of up scaling, the value 1 will scale the resource in100%, doubling its capacity.
See also: VerticalVmScaling.setResourceScaling(ResourceScaling)
1.28. org.cloudsimplus.autoscaling 437
CloudSim Plus Documentation, Release 1.0.0
Methods
getAllocatedResource
public long getAllocatedResource()
getLowerThresholdFunction
public Function<Vm, Double> getLowerThresholdFunction()
getResource
public Resource getResource()
getResourceAmountToScale
public double getResourceAmountToScale()@inheritDoc
If a ResourceScaling implementation such as ResourceScalingGradual orResourceScalingInstantaneous are used, it will rely on the getScalingFactor() to com-pute the amount of resource to scale. Other implementations may use the scaling factor by it is up tothem.
NOTE: The return of this method is rounded up to avoid values between ]0 and 1[. For instance, up scalingthe number of CPUs in 0.5 means that half of a CPU should be added to the VM. Since number of CPUs is aninteger value, this 0.5 will be converted to zero, causing no effect. For other resources such as RAM, adding 0.5MB has not practical advantages either. This way, the value is always rounded up.
Returns @inheritDoc
getResourceClass
public Class<? extends ResourceManageable> getResourceClass()
getResourceUsageThresholdFunction
public Function<Vm, Double> getResourceUsageThresholdFunction()
getScalingFactor
public double getScalingFactor()
getUpperThresholdFunction
public Function<Vm, Double> getUpperThresholdFunction()
438 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isVmOverloaded
public boolean isVmOverloaded()
isVmUnderloaded
public boolean isVmUnderloaded()
requestUpScaling
protected boolean requestUpScaling(double time)
requestUpScalingIfPredicateMatches
public final boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
setLowerThresholdFunction
public final VerticalVmScaling setLowerThresholdFunction(Function<Vm, Double> lowerThreshold-Function)
setResourceClass
public final VerticalVmScaling setResourceClass(Class<? extends ResourceManageable> resource-Class)
setResourceScaling
public final VerticalVmScaling setResourceScaling(ResourceScaling resourceScaling)@inheritDoc
This class’s constructors define a ResourceScalingGradual as the default ResourceScaling.
Parameters
• resourceScaling – @inheritDoc
Returns @inheritDoc
setScalingFactor
public final VerticalVmScaling setScalingFactor(double scalingFactor)
setUpperThresholdFunction
public final VerticalVmScaling setUpperThresholdFunction(Function<Vm, Double> upperThreshold-Function)
1.28. org.cloudsimplus.autoscaling 439
CloudSim Plus Documentation, Release 1.0.0
1.28.7 VmScaling
public interface VmScalingAn interface to allow implementing horizontal and vertical scaling of Vms.
Author Manoel Campos da Silva Filho
Fields
NULL
VmScaling NULLAn attribute that implements the Null Object Design Pattern for VmScaling objects.
Methods
getVm
Vm getVm()Gets the Vm that this Load Balancer is linked to.
requestUpScalingIfPredicateMatches
boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)Requests the Vm to be scaled up or down if it is over or underloaded, respectively. The scaling request will besent to the DatacenterBroker only if the under or overload condition is met, that depends of the imple-mentation of the scaling mechanisms.
The Vm to which this scaling object is related to, creates an UpdateProcessingListener that will callthis method to check if it time to perform an down or up scaling, every time the Vm processing is updated.
Parameters
• evt – event information, including the current simulation time and the VM to be scaled
Returns true if the Vm is over or underloaded and up or down scaling request was sent to the broker,false otherwise
setVm
VmScaling setVm(Vm vm)Sets a Vm to this Load Balancer. The broker will call this Load Balancer in order to balance load when its Vmis over utilized.
When the VmScaling is assigned to a Vm, the Vm sets itself to the VmScaling object, creating an associationbetween the two objects.
Parameters
• vm – the Vm to set
440 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.28.8 VmScalingAbstract
public abstract class VmScalingAbstract implements VmScalingA base class for implementing HorizontalVmScaling and VerticalVmScaling.
Author Manoel Campos da Silva Filho
Constructors
VmScalingAbstract
protected VmScalingAbstract()
Methods
getVm
public Vm getVm()
isTimeToCheckPredicate
protected boolean isTimeToCheckPredicate(double time)Checks if it is time to evaluate weather the Vm is under or overloaded.
Parameters
• time – current simulation time
Returns true if it’s time to check weather the Vm is over and underloaded, false otherwise
requestUpScaling
protected abstract boolean requestUpScaling(double time)Performs the actual request to scale the Vm up or down, depending if it is over or underloaded, respectively. Thismethod is automatically called by VmScaling.requestUpScalingIfPredicateMatches(org.cloudsimplus.listeners.VmHostEventInfo) when it is verified that the Vm is over or under-loaded.
Parameters
• time – current simulation time
Returns true if the request was actually sent, false otherwise
setLastProcessingTime
protected void setLastProcessingTime(double lastProcessingTime)Sets the last time the scheduler checked for VM overload.
Parameters
• lastProcessingTime – the processing time to set
1.28. org.cloudsimplus.autoscaling 441
CloudSim Plus Documentation, Release 1.0.0
setVm
public final VmScaling setVm(Vm vm)
1.28.9 VmScalingNull
final class VmScalingNull implements VmScalingA class that implements the Null Object Design Pattern for VmScaling class.
Author Manoel Campos da Silva Filho
See also: VmScaling.NULL
Methods
getVm
public Vm getVm()
requestUpScalingIfPredicateMatches
public boolean requestUpScalingIfPredicateMatches(VmHostEventInfo evt)
setVm
public VmScaling setVm(Vm vm)
1.29 org.cloudsimplus.autoscaling.resources
Provides org.cloudsimplus.autoscaling.resources.ResourceScaling classes that are used bya org.cloudsimplus.autoscaling.VerticalVmScaling to define how the scaling of a org.cloudbus.cloudsim.resources.Resource it is in charge will be performed.
author Manoel Campos da Silva Filho
1.29.1 ResourceScaling
public interface ResourceScalingA FunctionalInterface to define how the capacity of the resource to be scaled by aVerticalVmScaling will be resized, according to the defined scaling factor.
The interval in which the under and overload conditions are checked is defined by the Datacenter.getSchedulingInterval(). This way, during one interval and another, there may be some SLA violationif the resource is overloaded between these intervals.
There are some implementations of this functional interface such as ResourceScalingGradual andResourceScalingInstantaneous. New ones can be defined using Lambda Expressions.
Author Manoel Campos da Silva Filho
See also: ResourceScalingGradual, ResourceScalingInstantaneous
442 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Fields
NULL
ResourceScaling NULLAn attribute that implements the Null Object Design Pattern for ResourceScaling objects.
Methods
getResourceAmountToScale
double getResourceAmountToScale(VerticalVmScaling vmScaling)Computes the amount of resource to scale up or down, depending if the resource is over or underloaded, respec-tively.
Parameters
• vmScaling – the VerticalVmScaling object that is in charge to scale a resource.
1.29.2 ResourceScalingGradual
public class ResourceScalingGradual implements ResourceScalingA ResourceScaling for which the capacity of the resource to be scaled will be gradually resized accordingto the defined scaling factor. This scaling type may not automatically move a Vm from an under oroverload state, since it will increase or decrease the resource capacity the specified fraction at a time.
This gradual resize may give the opportunity for the Vm workload to return to the normal state, without requiringfurther scaling. However, if the workload doesn’t return quickly to the normal and expected state, that may causelonger SLA violation time.
This is the default type of scaling in case one is not defined.
Author Manoel Campos da Silva Filho
Methods
getResourceAmountToScale
public double getResourceAmountToScale(VerticalVmScaling vmScaling)
1.29.3 ResourceScalingInstantaneous
public class ResourceScalingInstantaneous implements ResourceScalingA ResourceScaling for which the capacity of the resource to be scaled will be instantaneously resized tomove the Vm from the under or overload state. This way, the SLA violation time will be reduced.
This scaling type will resize the resource capacity in the following way:
• in underload conditions: it decreases the resource capacity to be equal to the current load of the resourcebeing scaled;
• in overload conditions: it increases the resource capacity to be equal to the current load of the resourcebeing scaled.
1.29. org.cloudsimplus.autoscaling.resources 443
CloudSim Plus Documentation, Release 1.0.0
Finally it adds an extra amount of resource, defined by the scaling factor, for safety. This extra amountadded is to enable the resource usage to grow up to the scaling factor without needing to resize the resourceagain. If it grows up to the scaling factor, a new up scaling request will be sent.
If the scaling factor for this type of scaling is zero, it means that the scaling object will always resize the resourceto the exact amount that is being used.
Author Manoel Campos da Silva Filho
Methods
getResourceAmountToScale
public double getResourceAmountToScale(VerticalVmScaling vmScaling)
1.30 org.cloudsimplus.builders
Provides org.cloudsimplus.builders.Builder classes that implement the Builder Design Pattern to allowinstantiating multiple simulation objects more easily.
Since that creating and setting up some simulation objects such as a org.cloudbus.cloudsim.datacenters.Datacenter requires a considerable amount of code, that usually becomes duplicated along dif-ferent simulations, the builder classes work as object factories that make it easier to create multiple simulation objectswith the same configuration.
The builders allow to set the parameters for creating a given object such as a Host, and then, after all parameters areset, a single class can create as many objects with the same configuration as desired.
author Manoel Campos da Silva Filho
1.30.1 BrokerBuilder
public class BrokerBuilder extends Builder implements BrokerBuilderInterfaceA Builder class to createBroker DatacenterBrokerSimple objects.
Author Manoel Campos da Silva Filho
Constructors
BrokerBuilder
public BrokerBuilder(SimulationScenarioBuilder scenario)
Methods
createBroker
public BrokerBuilderDecorator createBroker()
444 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
findBroker
public DatacenterBroker findBroker(int id)
get
public DatacenterBroker get(int index)
getBrokers
public List<DatacenterBroker> getBrokers()
1.30.2 BrokerBuilderDecorator
public class BrokerBuilderDecorator implements BrokerBuilderInterfaceA class that implements the Decorator Design Pattern in order to include features in a existing class. It is usedto ensure that specific methods are called only after a given method is called.
For instance, the methods getVmBuilder() and getCloudletBuilder() can only be called after someDatacenterBrokerSimple was created by calling the method createBroker(). By this way, after themethod is called, it returns an instance of this decorator that allow chained call to the specific decorator methodsas the following example:
• createBroker().getVmBuilder()
Author Manoel Campos da Silva Filho
Constructors
BrokerBuilderDecorator
public BrokerBuilderDecorator(BrokerBuilder builder, DatacenterBrokerSimple broker)
Methods
createBroker
public BrokerBuilderDecorator createBroker()
findBroker
public DatacenterBroker findBroker(int id)
get
public DatacenterBroker get(int index)
1.30. org.cloudsimplus.builders 445
CloudSim Plus Documentation, Release 1.0.0
getBroker
public DatacenterBroker getBroker()
Returns the latest created broker
getBrokers
public List<DatacenterBroker> getBrokers()
getCloudletBuilder
public CloudletBuilder getCloudletBuilder()
Returns the CloudletBuilder in charge of creating Cloudlets to the latest DatacenterBroker createdby this BrokerBuilder
getVmBuilder
public VmBuilder getVmBuilder()
Returns the VmBuilder in charge of creating VMs to the latest DatacenterBroker created by thisBrokerBuilder
1.30.3 BrokerBuilderInterface
public interface BrokerBuilderInterfaceAn interface to classes that build DatacenterBrokerSimple objects.
Author Manoel Campos da Silva Filho
Methods
createBroker
BrokerBuilderDecorator createBroker()
findBroker
DatacenterBroker findBroker(int id)
get
DatacenterBroker get(int index)
getBrokers
List<DatacenterBroker> getBrokers()
446 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.30.4 Builder
public abstract class BuilderAn abstract Builder for creation of CloudSim objects, such as Datacenter, Host, VmDatacenterBroker and Cloudlet. The builders helps in the creation of such objects, by allowingto set standard attribute’s values in order to create several objects with the same characteristics.
Author Manoel Campos da Silva Filho
Methods
validateAmount
public void validateAmount(double amount)
1.30.5 CloudletBuilder
public class CloudletBuilder extends BuilderA Builder class to create Cloudlet objects.
Author Manoel Campos da Silva Filho
Constructors
CloudletBuilder
public CloudletBuilder(BrokerBuilderDecorator brokerBuilder, DatacenterBrokerSimple broker)
Methods
createAndSubmitCloudlets
public CloudletBuilder createAndSubmitCloudlets(int amount)
createAndSubmitCloudlets
public CloudletBuilder createAndSubmitCloudlets(int amount, int initialId)
createCloudlets
public CloudletBuilder createCloudlets(int amount, int initialId)
createCloudlets
public CloudletBuilder createCloudlets(int amount)
1.30. org.cloudsimplus.builders 447
CloudSim Plus Documentation, Release 1.0.0
getBrokerBuilder
public BrokerBuilderDecorator getBrokerBuilder()
getCloudlets
public List<Cloudlet> getCloudlets()
getFileSize
public long getFileSize()
getLength
public long getLength()
getOutputSize
public long getOutputSize()
getPes
public int getPes()
setFileSize
public CloudletBuilder setFileSize(long defaultFileSize)
setLength
public CloudletBuilder setLength(long defaultLength)
setOnCloudletFinishEventListener
public CloudletBuilder setOnCloudletFinishEventListener(EventListener<CloudletVmEventInfo>defaultOnCloudletFinishEventLis-tener)
setOutputSize
public CloudletBuilder setOutputSize(long defaultOutputSize)
448 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setPEs
public CloudletBuilder setPEs(int defaultPEs)
setRequiredFiles
public CloudletBuilder setRequiredFiles(List<String> requiredFiles)
setUtilizationModelBw
public CloudletBuilder setUtilizationModelBw(UtilizationModel utilizationModelBw)
setUtilizationModelCpu
public CloudletBuilder setUtilizationModelCpu(UtilizationModel utilizationModelCpu)
setUtilizationModelCpuRamAndBw
public final CloudletBuilder setUtilizationModelCpuRamAndBw(UtilizationModel utilizationModel)Sets the same utilization model for CPU, RAM and BW. By this way, at a time t, every one of the 3 resourceswill use the same percentage of its capacity.
Parameters
• utilizationModel – the utilization model to set
setUtilizationModelRam
public CloudletBuilder setUtilizationModelRam(UtilizationModel utilizationModelRam)
setVm
public CloudletBuilder setVm(Vm defaultVm)
submitCloudlets
public CloudletBuilder submitCloudlets()Submits the list of created cloudlets to the latest created broker.
Returns the CloudletBuilder instance
1.30.6 DatacenterBuilder
public class DatacenterBuilder extends BuilderA Builder class to createDatacenter DatacenterSimple objects.
Author Manoel Campos da Silva Filho
1.30. org.cloudsimplus.builders 449
CloudSim Plus Documentation, Release 1.0.0
Constructors
DatacenterBuilder
public DatacenterBuilder(SimulationScenarioBuilder scenario)
Methods
addStorageToList
public DatacenterBuilder addStorageToList(FileStorage storage)
createDatacenter
public DatacenterBuilder createDatacenter(List<Host> hosts)
get
public Datacenter get(int index)
getCostPerBwMegabit
public double getCostPerBwMegabit()
getCostPerCpuSecond
public double getCostPerCpuSecond()
getCostPerMem
public double getCostPerMem()
getCostPerStorage
public double getCostPerStorage()
getDatacenters
public List<Datacenter> getDatacenters()
getFirstHostFromFirstDatacenter
public Host getFirstHostFromFirstDatacenter()
450 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getHostOfDatacenter
public Host getHostOfDatacenter(int hostIndex, int datacenterIndex)
getSchedulingInterval
public double getSchedulingInterval()
getTimezone
public double getTimezone()
setCostPerBwMegabit
public DatacenterBuilder setCostPerBwMegabit(double defaultCostPerBwByte)
setCostPerCpuSecond
public DatacenterBuilder setCostPerCpuSecond(double defaultCostPerCpuSecond)
setCostPerMem
public DatacenterBuilder setCostPerMem(double defaultCostPerMem)
setCostPerStorage
public DatacenterBuilder setCostPerStorage(double defaultCostPerStorage)
setSchedulingInterval
public DatacenterBuilder setSchedulingInterval(double schedulingInterval)
setStorageList
public DatacenterBuilder setStorageList(List<FileStorage> storageList)
setTimezone
public DatacenterBuilder setTimezone(double defaultTimezone)
1.30. org.cloudsimplus.builders 451
CloudSim Plus Documentation, Release 1.0.0
1.30.7 HostBuilder
public class HostBuilder extends BuilderA Builder class to create Host objects.
Author Manoel Campos da Silva Filho
Constructors
HostBuilder
public HostBuilder()
Methods
createHosts
public HostBuilder createHosts(int amount)
createOneHost
public HostBuilder createOneHost()
getBw
public long getBw()
getHosts
public List<Host> getHosts()
getMips
public double getMips()
getOnUpdateVmsProcessingListener
public EventListener<HostUpdatesVmsProcessingEventInfo> getOnUpdateVmsProcessingListener()
getPes
public int getPes()
getRam
public long getRam()
452 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getStorage
public long getStorage()
getVmSchedulerClass
public Class<? extends VmSchedulerAbstract> getVmSchedulerClass()
setBw
public HostBuilder setBw(long defaultBw)
setMips
public HostBuilder setMips(double defaultMIPS)
setOnUpdateVmsProcessingListener
public HostBuilder setOnUpdateVmsProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo>onUpdateVmsProcessingListener)
setPes
public HostBuilder setPes(int defaultPEs)
setRam
public HostBuilder setRam(int defaultRam)
setStorage
public HostBuilder setStorage(long defaultStorage)
setVmSchedulerClass
public HostBuilder setVmSchedulerClass(Class<? extends VmSchedulerAbstract> defaultVmSched-ulerClass)
1.30.8 PeBuilder
public class PeBuilder extends BuilderA Builder class to create PeSimple objects.
Author Manoel Campos da Silva Filho
1.30. org.cloudsimplus.builders 453
CloudSim Plus Documentation, Release 1.0.0
Methods
create
public List<Pe> create(double amount, double mipsOfEachPe)
getProvisionerClass
public Class<? extends PeProvisioner> getProvisionerClass()
setProvisioner
public PeBuilder setProvisioner(Class<? extends PeProvisioner> defaultProvisioner)
1.30.9 SimulationScenarioBuilder
public class SimulationScenarioBuilderAn builder to help getting instance of other CloudSim object builders.
Author Manoel Campos da Silva Filho
Constructors
SimulationScenarioBuilder
public SimulationScenarioBuilder(CloudSim simulation)
Methods
getBrokerBuilder
public BrokerBuilder getBrokerBuilder()
getDatacenterBuilder
public DatacenterBuilder getDatacenterBuilder()
getFirstHostFromFirstDatacenter
public Host getFirstHostFromFirstDatacenter()
getFirstVmFromFirstBroker
public Vm getFirstVmFromFirstBroker()
454 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getHostOfDatacenter
public Host getHostOfDatacenter(int hostIndex, int datacenterIndex)
getSimulation
public CloudSim getSimulation()
getVmFromBroker
public Vm getVmFromBroker(int vmIndex, int brokerIndex)
1.30.10 VmBuilder
public class VmBuilderA Builder class to create Vm objects.
Author Manoel Campos da Silva Filho
Constructors
VmBuilder
public VmBuilder(DatacenterBrokerSimple broker)
Methods
createAndSubmitOneVm
public VmBuilder createAndSubmitOneVm()
createAndSubmitVms
public VmBuilder createAndSubmitVms(int amount)
getBw
public long getBw()
getMips
public double getMips()
1.30. org.cloudsimplus.builders 455
CloudSim Plus Documentation, Release 1.0.0
getOnUpdateVmProcessingListener
public EventListener<VmHostEventInfo> getOnUpdateVmProcessingListener()
getPes
public int getPes()
getRam
public long getRam()
getSize
public long getSize()
getVmById
public Vm getVmById(int id)
getVms
public List<Vm> getVms()
setBw
public VmBuilder setBw(long defaultBW)
setCloudletSchedulerSupplier
public VmBuilder setCloudletSchedulerSupplier(Supplier<CloudletScheduler> cloudletScheduler-Supplier)
Sets a Supplier that is accountable to create CloudletScheduler for requested VMs.
Parameters
• cloudletSchedulerSupplier – the CloudletScheduler Supplier to set
setMips
public VmBuilder setMips(double defaultMIPS)
setOnHostAllocationListener
public VmBuilder setOnHostAllocationListener(EventListener<VmHostEventInfo> onHostAlloca-tionListener)
456 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setOnHostDeallocationListener
public VmBuilder setOnHostDeallocationListener(EventListener<VmHostEventInfo> onHost-DeallocationListener)
setOnUpdateVmProcessingListener
public VmBuilder setOnUpdateVmProcessingListener(EventListener<VmHostEventInfo> onUpdat-eVmProcessing)
setOnVmCreationFilatureListenerForAllVms
public VmBuilder setOnVmCreationFilatureListenerForAllVms(EventListener<VmDatacenterEventInfo>onVmCreationFailureLis-tener)
setPes
public VmBuilder setPes(int defaultPEs)
setRam
public VmBuilder setRam(int defaultRAM)
setSize
public VmBuilder setSize(long defaultSize)
1.31 org.cloudsimplus.builders.tables
Provides org.cloudsimplus.builders.tables.TableBuilder classes that are used to format simula-tion results in different and structured ways such as ASCII, CSV or HTML tables. Such tables can even be used byexternal softwares to process simulation results.
All the examples use some org.cloudsimplus.builders.tables.TableBuilder implementation toprint simulation results.
The classes and interfaces provided allow creating custom TableBuilders to add, change or remove columns from theresults, to sort rows, to filter, and so on.
author Manoel Campos da Silva Filho
1.31.1 AbstractTableBuilder
public abstract class AbstractTableBuilder implements TableBuilderAn abstract base class for implementing table builders.
Author Manoel Campos da Silva Filho
1.31. org.cloudsimplus.builders.tables 457
CloudSim Plus Documentation, Release 1.0.0
Constructors
AbstractTableBuilder
public AbstractTableBuilder()
AbstractTableBuilder
public AbstractTableBuilder(String title)Creates an TableBuilder
Parameters
• title – Title of the table
Methods
addColumn
public final TableColumn addColumn(String columnTitle)
addColumn
public final TableColumn addColumn(String columnTitle, String columnSubTitle)
addColumn
public final TableColumn addColumn(int index, TableColumn column)
addColumn
public final TableColumn addColumn(TableColumn column)
addColumnList
public final TableBuilder addColumnList(String... columnTitles)
getColumnSeparator
public String getColumnSeparator()
getColumns
public List<TableColumn> getColumns()
Returns the list of columns of the table
458 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getRows
protected List<List<Object>> getRows()
Returns The data to be printed, where each row contains a list of data columns.
getTitle
public String getTitle()
newRow
public List<Object> newRow()
public void print()
printColumnHeaders
protected void printColumnHeaders()
printRowClosing
protected abstract void printRowClosing()Prints the string to close a row.
printRowOpening
protected abstract void printRowOpening()Prints the string that has to precede each printed row.
printTableClosing
protected abstract void printTableClosing()Prints the string to close the table.
printTableOpening
protected abstract void printTableOpening()Prints the string to open the table.
printTitle
protected abstract void printTitle()Prints the table title.
1.31. org.cloudsimplus.builders.tables 459
CloudSim Plus Documentation, Release 1.0.0
setColumnSeparator
public final TableBuilder setColumnSeparator(String columnSeparator)
setTitle
public final TableBuilder setTitle(String title)
1.31.2 AbstractTableColumn
public abstract class AbstractTableColumn implements TableColumnA column of a table to be generated using a TableBuilder class.
Author Manoel Campos da Silva Filho
Constructors
AbstractTableColumn
public AbstractTableColumn(TableBuilder table, String title)Creates a column with a specific title.
Parameters
• table – The table that the column belongs to.
• title – The column title.
AbstractTableColumn
public AbstractTableColumn(String title, String subTitle)Creates a column with a specific title and sub-title.
Parameters
• title – The column title.
• subTitle – The column sub-title.
AbstractTableColumn
public AbstractTableColumn(TableBuilder table, String title, String subTitle)Creates a column with a specific title and sub-title for a given table.
Parameters
• title – The column title.
• subTitle – The column sub-title.
460 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
generateData
public String generateData(Object data)Generates the string that represents the data of the column, formatted according to the format.
Parameters
• data – The data of the column to be formatted
Returns a string containing the formatted column data
generateHeader
protected abstract String generateHeader(String str)Generates a header for the column, either for the title or subtitle header.
Parameters
• str – header title or subtitle
Returns the generated header string
generateSubtitleHeader
public String generateSubtitleHeader()
generateTitleHeader
public String generateTitleHeader()
getFormat
public String getFormat()
Returns The format to be used to display the content of the column, according to the String.format(java.lang.String,java.lang.Object...) (optional).
getIndex
protected int getIndex()
Returns The index of the current column into the column list of the TableBuilder.
getSubTitle
public String getSubTitle()
Returns The subtitle to be displayed below the title of the column (optional).
1.31. org.cloudsimplus.builders.tables 461
CloudSim Plus Documentation, Release 1.0.0
getTable
public TableBuilder getTable()
Returns The table that the column belongs to.
getTitle
public String getTitle()
Returns The title to be displayed at the top of the column.
isLastColumn
protected boolean isLastColumn()Indicates if the current column is the last one in the column list of the TableBuilder.
Returns true if it is the last column, false otherwise.
setFormat
public final AbstractTableColumn setFormat(String format)
setSubTitle
public AbstractTableColumn setSubTitle(String subTitle)
setTable
public AbstractTableColumn setTable(TableBuilder table)
setTitle
public AbstractTableColumn setTitle(String title)
toString
public String toString()
1.31.3 CloudletsTableBuilder
public class CloudletsTableBuilderBuilds a table for printing simulation results from a list of Cloudlets. It defines a set of default columns but newones can be added dynamically using the addColumn() methods.
The basic usage of the class is by calling its constructor, giving a list of Cloudlets to be printed, and then callingthe build() method.
Author Manoel Campos da Silva Filho
462 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
CloudletsTableBuilder
public CloudletsTableBuilder(List<? extends Cloudlet> list)Creates new helper object to print the list of cloudlets using the a default TextTableBuilder. To use adifferent TableBuilder, use the alternative constructors.
Parameters
• list – the list of Cloudlets that the data will be included into the table to be printed
CloudletsTableBuilder
public CloudletsTableBuilder(List<? extends Cloudlet> list, TableBuilder table)Creates new helper object to print the list of cloudlets using the a given TableBuilder.
Parameters
• list – the list of Cloudlets that the data will be included into the table to be printed
• table – the TableBuilder used to build the table with Cloudlet Data
Methods
addColumn
public CloudletsTableBuilder addColumn(TableColumn col, Function<Cloudlet, Object> dataFunction)Dynamically adds a column to the end of the table to be built.
Parameters
• col – the column to add
• dataFunction – a function that receives a Cloudlet and returns the data to be printed forthe added column
addColumn
public CloudletsTableBuilder addColumn(int index, TableColumn col, Function<Cloudlet, Object> data-Function)
Dynamically adds a column to a specific position into the table to be built.
Parameters
• index – the position to insert the column.
• col – the column to add
• dataFunction – a function that receives a Cloudlet and returns the data to be printed forthe added column
1.31. org.cloudsimplus.builders.tables 463
CloudSim Plus Documentation, Release 1.0.0
addDataToRow
protected void addDataToRow(Cloudlet cloudlet, List<Object> row)Add data to a row of the table being generated.
Parameters
• cloudlet – The cloudlet to get to data to show in the row of the table
• row – The row to be added the data to
build
public void build()Builds the table with the data of the Cloudlet list and shows the results.
getTable
protected TableBuilder getTable()
setCloudletList
protected final CloudletsTableBuilder setCloudletList(List<? extends Cloudlet> cloudletList)
setTitle
public CloudletsTableBuilder setTitle(String title)
1.31.4 CsvTableBuilder
public class CsvTableBuilder extends AbstractTableBuilderPrints a table from a given data set, using a Comma Separated Text (CSV) format.
Author Manoel Campos da Silva Filho
Constructors
CsvTableBuilder
public CsvTableBuilder()
CsvTableBuilder
public CsvTableBuilder(String title)
464 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
addColumn
public TableColumn addColumn(int index, String columnTitle)
getLineSeparator
public String getLineSeparator()
printRowClosing
protected void printRowClosing()
printRowOpening
protected void printRowOpening()CSV files doesn’t have a row opening line.
printTableClosing
public void printTableClosing()CSV files doesn’t have a table closing line.
printTableOpening
public void printTableOpening()CSV files doesn’t have a table opening line.
printTitle
public void printTitle()CSV files doesn’t have a title.
1.31.5 CsvTableColumn
public class CsvTableColumn extends AbstractTableColumnA column of an CSV table. The class generates the CSV code that represents a column in a CSV table.
Author Manoel Campos da Silva Filho
1.31. org.cloudsimplus.builders.tables 465
CloudSim Plus Documentation, Release 1.0.0
Fields
DATA_COL_SEPARATOR_FORMAT
public static final String DATA_COL_SEPARATOR_FORMATA format used to print data followed by the column separator.
Constructors
CsvTableColumn
public CsvTableColumn(String title, String subTitle)
CsvTableColumn
public CsvTableColumn(String title)
CsvTableColumn
public CsvTableColumn(TableBuilder table, String title, String subTitle)
CsvTableColumn
public CsvTableColumn(TableBuilder table, String title)
Methods
generateData
public String generateData(Object data)
generateHeader
protected String generateHeader(String str)
1.31.6 HtmlTableBuilder
public class HtmlTableBuilder extends AbstractTableBuilderA generator of HTML tables.
Author Manoel Campos da Silva Filho
466 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
HtmlTableBuilder
public HtmlTableBuilder()
HtmlTableBuilder
public HtmlTableBuilder(String title)Creates an TableBuilder
Parameters
• title – Title of the table
Methods
addColumn
public TableColumn addColumn(int index, String columnTitle)
printRowClosing
protected void printRowClosing()
printRowOpening
protected void printRowOpening()
printTableClosing
protected void printTableClosing()
printTableOpening
protected void printTableOpening()
printTitle
protected void printTitle()
1.31.7 HtmlTableColumn
public class HtmlTableColumn extends AbstractTableColumnA column of an HTML table. The class generates the HTML code that represents a column in a HTML table.
Author Manoel Campos da Silva Filho
1.31. org.cloudsimplus.builders.tables 467
CloudSim Plus Documentation, Release 1.0.0
Constructors
HtmlTableColumn
public HtmlTableColumn(String title, String subTitle)
HtmlTableColumn
public HtmlTableColumn(String title)
HtmlTableColumn
public HtmlTableColumn(TableBuilder table, String title)
HtmlTableColumn
public HtmlTableColumn(TableBuilder table, String title, String subTitle)
Methods
generateData
public String generateData(Object data)
generateHeader
protected String generateHeader(String str)
1.31.8 TableBuilder
public interface TableBuilderAn interface for classes that generate tables from a given data set, following the Builder Design Pattern.
Author Manoel Campos da Silva Filho
Methods
addColumn
TableColumn addColumn(String columnTitle)Adds a column with a given to the end of the table’s columns to be printed.
Parameters
• columnTitle – The title of the column to be added.
Returns The created column.
468 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
addColumn
TableColumn addColumn(int index, String columnTitle)Adds a column with a given title to the end of the table’s columns to be printed.
Parameters
• index – the position to insert the column into the column’s list
• columnTitle – The title of the column to be added.
Returns the created column
addColumn
TableColumn addColumn(String columnTitle, String columnSubTitle)Adds a column with a given title and sub-title to the end of the table’s columns to be printed.
Parameters
• columnTitle – The title of the column to be added.
• columnSubTitle – The sub-title of the column to be added.
Returns the created column
addColumn
TableColumn addColumn(int index, TableColumn column)Adds a column object to a specific position of the table’s columns to be printed.
Parameters
• index – the position to insert the column into the column’s list
• column – The column to be added.
Returns the created column
addColumn
TableColumn addColumn(TableColumn column)Adds a column object to the end of the table’s columns to be printed.
Parameters
• column – The column to be added.
Returns the created column
addColumnList
TableBuilder addColumnList(String... columnTitles)Adds a list of columns (with given titles) to the end of the table’s columns to be printed, where the column datawill be printed without a specific format.
Parameters
1.31. org.cloudsimplus.builders.tables 469
CloudSim Plus Documentation, Release 1.0.0
• columnTitles – The titles of the columns
Returns the TableBuilder instance.
See also: .addColumn(String)
getColumnSeparator
String getColumnSeparator()Gets the string used to separate one column from another (optional).
getColumns
List<TableColumn> getColumns()
Returns the list of columns of the table
getTitle
String getTitle()
Returns the table title
newRow
List<Object> newRow()Adds a new row to the list of rows containing the data to be printed.
void print()Builds and prints the table.
setColumnSeparator
TableBuilder setColumnSeparator(String columnSeparator)Sets the string used to separate one column from another (optional).
Parameters
• columnSeparator – the separator to set
setTitle
TableBuilder setTitle(String title)
Parameters
• title – the table title to set
Returns The TableBuilder instance
470 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.31.9 TableColumn
public interface TableColumnAn interface that represents a column of a table generated using a TableBuilder.
Author Manoel Campos da Silva Filho
Methods
generateData
String generateData(Object data)Generates the string that represents the data of the column, formatted according to the format.
Parameters
• data – The data of the column to be formatted
Returns a string containing the formatted column data
generateSubtitleHeader
String generateSubtitleHeader()Generates the string that represents the sub-header of the column (if any), containing the column subtitle.
Returns the generated sub-header string
generateTitleHeader
String generateTitleHeader()Generates the string that represents the header of the column, containing the column title.
Returns the generated header string
getFormat
String getFormat()
Returns The format to be used to display the content of the column, according to the String.format(java.lang.String,java.lang.Object...) (optional).
getSubTitle
String getSubTitle()
Returns The subtitle to be displayed below the title of the column (optional).
getTable
TableBuilder getTable()
Returns The table that the column belongs to.
1.31. org.cloudsimplus.builders.tables 471
CloudSim Plus Documentation, Release 1.0.0
getTitle
String getTitle()
Returns The title to be displayed at the top of the column.
setFormat
TableColumn setFormat(String format)
setSubTitle
TableColumn setSubTitle(String subTitle)
setTable
TableColumn setTable(TableBuilder table)
setTitle
TableColumn setTitle(String title)
1.31.10 TextTableBuilder
public class TextTableBuilder extends CsvTableBuilderPrints a table from a given data set, using a simple delimited text format.
Author Manoel Campos da Silva Filho
Constructors
TextTableBuilder
public TextTableBuilder()
TextTableBuilder
public TextTableBuilder(String title)Creates an TableBuilder
Parameters
• title – Title of the table
472 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Methods
addColumn
public TableColumn addColumn(int index, String columnTitle)
getLineSeparator
public String getLineSeparator()
printColumnHeaders
protected void printColumnHeaders()
printTableClosing
public void printTableClosing()
printTableOpening
public void printTableOpening()
printTitle
public void printTitle()
1.31.11 TextTableColumn
public class TextTableColumn extends CsvTableColumnA column of an text (ASCII) table. The class generates the string that represents a column in a text table.
Author Manoel Campos da Silva Filho
Constructors
TextTableColumn
public TextTableColumn(String title, String subTitle)
TextTableColumn
public TextTableColumn(String title)
1.31. org.cloudsimplus.builders.tables 473
CloudSim Plus Documentation, Release 1.0.0
TextTableColumn
public TextTableColumn(TableBuilder table, String title, String subTitle)
TextTableColumn
public TextTableColumn(TableBuilder table, String title)
Methods
generateData
public String generateData(Object data)
generateSubtitleHeader
public String generateSubtitleHeader()
1.32 org.cloudsimplus.faultinjection
Provides classes to inject random faults during simulation runtime.
author raysaoliveira
See also: org.cloudsimplus.faultinjection.HostFaultInjection
1.32.1 HostFaultInjection
public class HostFaultInjection extends CloudSimEntityGenerates random failures for the Pe’s of Hosts inside a given Datacenter. A Fault Injection object usuallyhas to be created after the VMs are created, to make it easier to define a function to be used to clone failed VMs.The events happens in the following order:
1. a time to inject a Host failure is generated using a given Random Number Generator;
2. a Host is randomly selected to fail at that time using an internal Uniform Random Number Generator withthe same seed of the given generator;
3. the number of Host PEs to fail is randomly generated using the internal generator;
4. failed physical PEs are removed from affected VMs, VMs with no remaining PEs and destroying andclones of them are submitted to the DatacenterBroker of the failed VMs;
5. another failure is scheduled for a future time using the given generator;
6. the process repeats until the end of the simulation.
When Host’s PEs fail, if there are more available PEs than the required by its running VMs, no VM will beaffected.
Considering that X is the number of failed PEs and it is lower than the total available PEs. In this case, the XPEs will be removed cyclically, 1 by 1, from running VMs. This way, some VMs may continue running with
474 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
less PEs than they requested initially. On the other hand, if after the failure the number of Host working PEs islower than the required to run all VMs, some VMs will be destroyed.
If all PEs are removed from a VM, it is automatically destroyed and a snapshot (clone) from it is taken andsubmitted to the broker, so that the clone can start executing into another host. In this case, all the cloudletswhich were running inside the VM yet, will be cloned to and restart executing from the beginning.
If a cloudlet running inside a VM which was affected by a PE failure requires Y PEs but the VMs doesn’t havesuch PEs anymore, the Cloudlet will continue executing, but it will spend more time to finish. For instance, if aCloudlet requires 2 PEs but after the failure the VM was left with just 1 PE, the Cloudlet will spend the doubleof the time to finish.
NOTES:
• Host PEs failures may happen after all its VMs have finished executing. This way, the presented simulationresults may show that the number of PEs into a Host is lower than the required by its VMs. In this case,the VMs shown in the results finished executing before some failures have happened. Analysing the logsis easy to confirm that.
• Failures inter-arrivals are defined in minutes, since seconds is a too small time unit to define such value.Furthermore, it doesn’t make sense to define the number of failures per second. This way, the generator offailure arrival times given to the constructor considers the time in minutes, despite the simulation time unitis seconds. Since commonly Cloudlets just take some seconds to finish, mainly in simulation examples,failures may happen just after the cloudlets have finished. This way, one usually should make sure thatCloudlets’ length are large enough to allow failures to happen before they end.
Author raysaoliveira
See also: SAP Blog: Availability vs Reliability
Constructors
HostFaultInjection
public HostFaultInjection(Datacenter datacenter, ContinuousDistribution faultArrivalTimesGenera-torInHours)
Creates a fault injection mechanism for the Hosts of a given Datacenter. The failures are randomly injectedaccording to the given mean of failures to be generated per minute, which is also called event rate or rateparameter.
Parameters
• datacenter – the Datacenter to which failures will be randomly injected for its Hosts
• faultArrivalTimesGeneratorInHours – a Pseudo Random Number Generatorwhich generates the times (in hours) Hosts failures will occur. The values returned by thegenerator will be considered to be hours. Frequently it is used a PoissonDistr togenerate failure arrivals, but any ContinuousDistribution can be used.
Methods
addVmCloner
public void addVmCloner(DatacenterBroker broker, VmCloner cloner)Adds a VmCloner that creates a clone for the last failed Vm belonging to a given broker, when all VMs of thatbroker have failed.
1.32. org.cloudsimplus.faultinjection 475
CloudSim Plus Documentation, Release 1.0.0
This is optional. If a VmCloner is not set, VMs will not be recovered from failures.
Parameters
• broker – the broker to set the VM cloner Function to
• cloner – the VmCloner to set
availability
public double availability()Gets the Datacenter’s availability as a percentage value between 0 to 1, based on VMs’ downtime (the timesVMs took to be repaired).
availability
public double availability(DatacenterBroker broker)Gets the availability for a given broker as a percentage value between 0 to 1, based on VMs’ downtime (thetimes VMs took to be repaired).
Parameters
• broker – the broker to get the availability of its VMs
getDatacenter
public Datacenter getDatacenter()Gets the datacenter in which failures will be injected.
getLastFailedHost
public Host getLastFailedHost()Gets the last Host for which a failure was injected.
Returns the last failed Host or Host.NULL if not Host has failed yet.
getMaxTimeToGenerateFailureInHours
public double getMaxTimeToGenerateFailureInHours()Gets the max time to generate a failure (in hours)
getNumberOfFaults
public long getNumberOfFaults()Gets the total number of faults which affected all VMs from any broker.
476 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getNumberOfFaults
public long getNumberOfFaults(DatacenterBroker broker)Gets the total number of Host faults which affected all VMs from a given broker or VMs from all existingbrokers.
Parameters
• broker – the broker to get the number of Host faults affecting its VMs or null whether isto be counted Host faults affecting VMs from any broker
getNumberOfHostFaults
public int getNumberOfHostFaults()Gets the total number of faults happened for existing hosts. This isn’t the total number of failed hosts becauseone host may fail multiple times.
getRandomRecoveryTimeForVmInSecs
public double getRandomRecoveryTimeForVmInSecs()Gets a Pseudo Random Number used to give a recovery time (in seconds) for each VM that was failed.
meanTimeBetweenHostFaultsInMinutes
public double meanTimeBetweenHostFaultsInMinutes()Computes the current Mean Time Between host Failures (MTBF) in minutes. Since Hosts don’t actually recoverfrom failures, there aren’t recovery time to make easier the computation of MTBF for Host as it is directlycomputed for VMs.
Returns the current mean time (in minutes) between Host failures (MTBF) or zero if no failureshave happened yet
See also: .meanTimeBetweenVmFaultsInMinutes()
meanTimeBetweenVmFaultsInMinutes
public double meanTimeBetweenVmFaultsInMinutes()Computes the current Mean Time Between host Failures (MTBF) in minutes, which affected VMs from anybroker for the entire Datacenter. It uses a straightforward way to compute the MTBF. Since it’s stored the VMrecovery times, it’s possible to use such values to make easier the MTBF computation, different from the HostsMTBF.
Returns the current Mean Time Between host Failures (MTBF) in minutes or zero if no VM wasdestroyed due to Host failure
See also: .meanTimeBetweenHostFaultsInMinutes()
meanTimeBetweenVmFaultsInMinutes
public double meanTimeBetweenVmFaultsInMinutes(DatacenterBroker broker)Computes the current Mean Time Between host Failures (MTBF) in minutes, which affected VMs from a given
1.32. org.cloudsimplus.faultinjection 477
CloudSim Plus Documentation, Release 1.0.0
broker. It uses a straightforward way to compute the MTBF. Since it’s stored the VM recovery times, it’s possibleto use such values to make easier the MTBF computation, different from the Hosts MTBF.
Parameters
• broker – the broker to get the MTBF for
Returns the current mean time (in minutes) between Host failures (MTBF) or zero if no VM wasdestroyed due to Host failure
See also: .meanTimeBetweenHostFaultsInMinutes()
meanTimeToRepairVmFaultsInMinutes
public double meanTimeToRepairVmFaultsInMinutes()Computes the current Mean Time To Repair failures of VMs in minutes (MTTR) in the Datacenter, for allexisting brokers.
Returns the MTTR (in minutes) or zero if no VM was destroyed due to Host failure
meanTimeToRepairVmFaultsInMinutes
public double meanTimeToRepairVmFaultsInMinutes(DatacenterBroker broker)Computes the current Mean Time To Repair Failures of VMs in minutes (MTTR) belonging to given broker. Ifa null broker is given, computes the MTTR of all VMs for all existing brokers.
Parameters
• broker – the broker to get the MTTR for or null if the MTTR is to be computed for allbrokers
Returns the current MTTR (in minutes) or zero if no VM was destroyed due to Host failure
processEvent
public void processEvent(SimEvent ev)
setDatacenter
protected final void setDatacenter(Datacenter datacenter)Sets the datacenter in which failures will be injected.
Parameters
• datacenter – the datacenter to set
setMaxTimeToGenerateFailureInHours
public void setMaxTimeToGenerateFailureInHours(double maxTimeToGenerateFailureInHours)Sets the max time to generate a failure (in hours).
Parameters
• maxTimeToGenerateFailureInHours – the maximum time to set
478 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
shutdownEntity
public void shutdownEntity()
startEntity
protected void startEntity()
1.32.2 VmCloner
public interface VmClonerEnables cloning a Vm which was destroyed due to a Host Failure. It provides all the features to clone a Vm,simulating the creating of another Vm from an snapshot of the failed one. It also enables re-creating Cloudletswhich were running inside the failed VM.
Author raysaoliveira
Fields
NULL
VmCloner NULL
Methods
clone
Map.Entry<Vm, List<Cloudlet>> clone(Vm sourceVm)Clones a given Vm using the Vm Cloner Function and their Cloudlets using the Clodlets Cloner Function, bindingthe cloned Cloudlets to the cloned Vm.
Parameters
• sourceVm – the Vm to be cloned
Returns a Map.Entrywhere the key is the cloned Vm and the value is the List of cloned Cloudltes.
See also: .setVmClonerFunction(UnaryOperator), .setCloudletsClonerFunction(Function)
getClonedVmsNumber
int getClonedVmsNumber()Gets the number of VMs cloned so far.
getMaxClonesNumber
int getMaxClonesNumber()Gets the maximum number of Vm clones to create. For instance, if this value is equal to 2, it means if all VMsfrom a given broker are destroyed multiple times, a clone will be created only 2 times. If all VMs are destroyedagain for the 3rd time, no clone will be created. The default value is 1.
1.32. org.cloudsimplus.faultinjection 479
CloudSim Plus Documentation, Release 1.0.0
isMaxClonesNumberReached
boolean isMaxClonesNumberReached()Checks if the maximum number of Vm clones to be created was reached.
Returns true if the maximum number of clones was reached, false otherwise
setCloudletsClonerFunction
VmCloner setCloudletsClonerFunction(Function<Vm, List<Cloudlet>> cloudletsClonerFunction)Gets the Function to be used to clone Vm’s Cloudlets. When the given Function is called, creates a cloneof cloudlets which were running inside a specific Vm.
Such a Function is used to recreate those Cloudlets inside a clone of the failed VM. In this case, all the Cloudletsare recreated from scratch into the cloned VM. This way, when they are submitted to a broker, they re-startexecution from the beginning.
Parameters
• cloudletsClonerFunction – the Cloudlets cloner Function to set
setMaxClonesNumber
VmCloner setMaxClonesNumber(int maxClonesNumber)
setVmClonerFunction
VmCloner setVmClonerFunction(UnaryOperator<Vm> vmClonerFunction)Sets the UnaryOperator to be used to clone Vms. It is a Function which, when called, creates a clone of aspecific Vm.
Parameters
• vmClonerFunction – the Vm cloner Function to set
1.32.3 VmClonerSimple
public class VmClonerSimple implements VmClonerA basic implementation of a VmCloner.
Author raysaoliveira
Constructors
VmClonerSimple
public VmClonerSimple(UnaryOperator<Vm> vmClonerFunction, Function<Vm, List<Cloudlet>>cloudletsClonerFunction)
Creates a Vm cloner which makes the maximum of 1 Vm clone.
Parameters
• vmClonerFunction – the UnaryOperator to be used to clone Vms.
480 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• cloudletsClonerFunction – the Function to be used to clone Vm’s Cloudlets.
See also: .setMaxClonesNumber(int)
Methods
clone
public Map.Entry<Vm, List<Cloudlet>> clone(Vm sourceVm)
getClonedVmsNumber
public int getClonedVmsNumber()
getMaxClonesNumber
public int getMaxClonesNumber()
isMaxClonesNumberReached
public boolean isMaxClonesNumberReached()
setCloudletsClonerFunction
public final VmCloner setCloudletsClonerFunction(Function<Vm, List<Cloudlet>> cloudletsClon-erFunction)
setMaxClonesNumber
public VmCloner setMaxClonesNumber(int maxClonesNumber)
setVmClonerFunction
public final VmCloner setVmClonerFunction(UnaryOperator<Vm> vmClonerFunction)
1.33 org.cloudsimplus.heuristics
Provides a set of interfaces and classes to develop heuristics to find sub-optimal solutions for problems, consideringsome utility function that has to be minimized or maximized. Such a function is also called a fitness function and ashigher is the fitness better the found solution is.
Different heuristics include Simulated Annealing, Tabu Search and Ant Colony Optimization.
The first introduced heuristic is the org.cloudsimplus.heuristics.CloudletToVmMappingSimulatedAnnealing that is used by a org.cloudbus.cloudsim.brokers.DatacenterBrokerHeuristic to map Cloudlets to VMs.
author Manoel Campos da Silva Filho
1.33. org.cloudsimplus.heuristics 481
CloudSim Plus Documentation, Release 1.0.0
1.33.1 CloudletToVmMappingHeuristic
public interface CloudletToVmMappingHeuristic extends Heuristic<CloudletToVmMappingSolution>Provides the methods to be used for implementing a heuristic to get a sub-optimal solution for mapping Cloudletsto Vm’s.
Author Manoel Campos da Silva Filho
Fields
NULL
CloudletToVmMappingHeuristic NULLA property that implements the Null Object Design Pattern for Heuristic objects.
Methods
getCloudletList
List<Cloudlet> getCloudletList()
Returns the list of cloudlets to be mapped to available Vm's.
getVmList
List<Vm> getVmList()
Returns the list of available Vm’s to host Cloudlets.
setCloudletList
void setCloudletList(List<Cloudlet> cloudletList)Sets the list of Cloudlets to be mapped to available Vm's.
Parameters
• cloudletList – the list of Cloudlets to set
setVmList
void setVmList(List<Vm> vmList)Sets the list of available VMs to host Cloudlets.
Parameters
• vmList – the list of VMs to set
482 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.33.2 CloudletToVmMappingHeuristicNull
final class CloudletToVmMappingHeuristicNull extends HeuristicNull<CloudletToVmMappingSolution> implements CloudletToVmMappingHeuristicA class to allow the implementation of Null Object Design Pattern for CloudletToVmMappingHeuristicinterface and extensions of it.
Author Manoel Campos da Silva Filho
See also: CloudletToVmMappingHeuristic.NULL
Methods
getCloudletList
public List<Cloudlet> getCloudletList()
getVmList
public List<Vm> getVmList()
setCloudletList
public void setCloudletList(List<Cloudlet> cloudletList)
setVmList
public void setVmList(List<Vm> vmList)
1.33.3 CloudletToVmMappingSimulatedAnnealing
public class CloudletToVmMappingSimulatedAnnealing extends SimulatedAnnealing<CloudletToVmMappingSolution> implements CloudletToVmMappingHeuristicA heuristic that uses Simulated Annealing to find a sub-optimal mapping among a set of Cloudlets and VMs inorder to reduce the number of idle or overloaded Vm Pe’s.
Author Manoel Campos da Silva Filho
Constructors
CloudletToVmMappingSimulatedAnnealing
public CloudletToVmMappingSimulatedAnnealing(double initialTemperature, ContinuousDistri-bution random)
Creates a new Simulated Annealing Heuristic for solving Cloudlets to Vm’s mapping.
Parameters
• initialTemperature – the system initial temperature
• random – a random number generator
See also: .setColdTemperature(double), .setCoolingRate(double)
1.33. org.cloudsimplus.heuristics 483
CloudSim Plus Documentation, Release 1.0.0
Methods
createNeighbor
public CloudletToVmMappingSolution createNeighbor(CloudletToVmMappingSolution source)
getCloudletList
public List<Cloudlet> getCloudletList()
getInitialSolution
public CloudletToVmMappingSolution getInitialSolution()
getVmList
public List<Vm> getVmList()
setCloudletList
public void setCloudletList(List<Cloudlet> cloudletList)
setVmList
public void setVmList(List<Vm> vmList)
1.33.4 CloudletToVmMappingSolution
public class CloudletToVmMappingSolution implements HeuristicSolution<Map<Cloudlet, Vm>>A possible solution for mapping a set of Cloudlets to a set of Vm’s. It represents a solution generated using aHeuristic implementation.
Author Manoel Campos da Silva Filho
See also: Heuristic
Fields
MIN_DIFF
public static final double MIN_DIFFWhen two double values are subtracted to check if they are equal zero, there may be some precision issues. Thisvalue is used to check the absolute difference between the two values to avoid that solutions with little decimaldifference be considered different one of the other.
484 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
CloudletToVmMappingSolution
public CloudletToVmMappingSolution(Heuristic heuristic)Creates a new solution for mapping a set of cloudlets to VMs using a given heuristic implementation.
Parameters
• heuristic – the heuristic implementation used to find the solution being created.
CloudletToVmMappingSolution
public CloudletToVmMappingSolution(CloudletToVmMappingSolution solution)Clones a given solution.
Parameters
• solution – the solution to be cloned
Methods
bindCloudletToVm
public void bindCloudletToVm(Cloudlet cloudlet, Vm vm)Binds a cloudlet to be executed by a given Vm.
Parameters
• cloudlet – the cloudlet to be added to a Vm
• vm – the Vm to assign a cloudlet to
compareTo
public int compareTo(HeuristicSolution o)Compares this solution with another given one, based on the solution cost. The current object is considered tobe: equal to the given object if they have the same cost; greater than the given object if it has a lower cost; lowerthan the given object if it has a higher cost;
Parameters
• o – the solution to compare this instance to
Returns @inheritDoc
getCost
public double getCost()@inheritDoc It computes the cost of the entire mapping between Vm’s and Cloudlets.
Returns @inheritDoc
1.33. org.cloudsimplus.heuristics 485
CloudSim Plus Documentation, Release 1.0.0
getCost
public double getCost(boolean forceRecompute)It computes the costs of the entire mapping between Vm’s and cloudlets.
Parameters
• forceRecompute – indicate if the cost has to be recomputed anyway
Returns the cost of the entire mapping between Vm’s and cloudlets
See also: .getCost()
getHeuristic
public Heuristic<HeuristicSolution<Map<Cloudlet, Vm>>> getHeuristic()
getRandomMapEntries
protected List<Map.Entry<Cloudlet, Vm>> getRandomMapEntries()Try to get 2 randomly selected entries from the cloudletVmMap.
Returns a List with 2 entries from the cloudletVmMap if the map has at least 2 entries, an unitaryList if the map has only one entry, or an empty List if there is no entry.
See also: .swapVmsOfTwoMapEntries(List)
getResult
public Map<Cloudlet, Vm> getResult()
Returns the actual solution, providing the mapping between Cloudlets and Vm’s.
getVmCost
public double getVmCost(Map.Entry<Vm, List<Map.Entry<Cloudlet, Vm>>> entry)Computes the cost of all Cloudlets hosted by a given Vm. The cost is based on the number of PEs from the VMthat will be idle or overloaded.
Parameters
• entry – a Map Entry where the key is a VM hosting some Cloudlets and the value is theCloudlets hosted in this VM.
Returns the VM cost to host the Cloudlets
getVmCost
public double getVmCost(Vm vm, List<Cloudlet> cloudlets)Computes the cost of all Cloudlets hosted by a given Vm. The cost is based on the number of PEs from the VMthat will be idle or overloaded.
Parameters
• vm – the VM to compute the cost to host some Cloudlets
486 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
• cloudlets – the list of Cloudlets to be hosted by the VM in order to compute the cost
Returns the VM cost to host the Cloudlets
swapVmsOfTwoMapEntries
protected final boolean swapVmsOfTwoMapEntries(List<Map.Entry<Cloudlet, Vm>> entries)Swap the Vm’s of 2 randomly selected cloudlets in the cloudletVmMap in order to provide a neighborsolution. The method change the given Map entries, moving the cloudlet of the first entry to the Vm of thesecond entry and vice-versa.
Parameters
• entries – a List of 2 entries containing Cloudlets to swap their VMs. If the entries don’thave 2 elements, the method will return without performing any change in the entries.
Returns true if the VMs of the Cloudlets where swapped, false otherwise
swapVmsOfTwoRandomSelectedMapEntries
boolean swapVmsOfTwoRandomSelectedMapEntries()Swap the Vm’s of 2 randomly selected cloudlets in the cloudletVmMap in order to provide a neighborsolution. The method change the given Map entries, moving the cloudlet of the first entry to the Vm of thesecond entry and vice-versa.
Returns true if the Cloudlet’s VMs where swapped, false otherwise
See also: .swapVmsOfTwoMapEntries(List)
1.33.5 Heuristic
public interface Heuristic<S extends HeuristicSolution<?>>Provides the methods to be used for implementation of heuristics to find solution for complex problems wherethe solution space to search is large. These problems are usually NP-Hard ones which the time to find a solutionincreases, for instance, in exponential time. Such problems can be, for instance, mapping a set of VMs to existingHosts or mapping a set of Cloudlets to VMs. A heuristic implementation thus provides an approximation of anoptimal solution (a suboptimal solution).
Different heuristic can be implemented, such as Tabu search, Simulated annealing, Hill climbing or Ant colonyoptimization, to name a few.
Author Manoel Campos da Silva Filho
Parameters
• <S> – the class of solutions the heuristic will deal with
Fields
NULL
Heuristic NULLA property that implements the Null Object Design Pattern for Heuristic objects.
1.33. org.cloudsimplus.heuristics 487
CloudSim Plus Documentation, Release 1.0.0
Methods
createNeighbor
S createNeighbor(S source)Creates a neighbor solution cloning a source one and randomly changing some of its values. A neighbor solutionis one that is close to the current solution and has just little changes.
Parameters
• source – the source to create a neighbor solution
Returns the cloned and randomly changed solution that represents a neighbor solution
getAcceptanceProbability
double getAcceptanceProbability()Computes the acceptance probability to define if a neighbor solution has to be accepted or not, compared to thegetBestSolutionSoFar().
Returns the acceptance probability, in scale from [0 to 1] where 0 is to maintain the currentsolution, 1 is to accept the neighbor solution, while intermediate values defines the proba-bility that the neighbor solution will be randomly accepted.
getBestSolutionSoFar
S getBestSolutionSoFar()
Returns best solution found out up to now
getInitialSolution
S getInitialSolution()Gets the initial solution that the heuristic will start from in order to try to improve it. If not initial solution wasgenerated yet, one should be randomly generated.
Returns the initial randomly generated solution
getNeighborSolution
S getNeighborSolution()
Returns latest neighbor solution created
See also: .createNeighbor(HeuristicSolution)
getNumberOfNeighborhoodSearchesByIteration
int getNumberOfNeighborhoodSearchesByIteration()
Returns the number of times a neighbor solution will be searched at each iteration of the solutionfind.
488 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getRandomValue
int getRandomValue(int maxValue)Gets a random number between 0 (inclusive) and maxValue (exclusive).
Parameters
• maxValue – the max value to get a random number (exclusive)
Returns the random number
getSolveTime
double getSolveTime()
Returns the time taken to finish the solution search (in seconds).
See also: .solve()
isToStopSearch
boolean isToStopSearch()Checks if the solution search can be stopped.
Returns true if the solution search can be stopped, false otherwise.
setNumberOfNeighborhoodSearchesByIteration
void setNumberOfNeighborhoodSearchesByIteration(int numberOfNeighborhoodSearches)Sets the number of times a neighbor solution will be searched at each iteration of the solution find.
Parameters
• numberOfNeighborhoodSearches – number of neighbor searches to perform at eachiteration
solve
S solve()Starts the heuristic to find a suboptimal solution. After the method finishes, you can call thegetBestSolutionSoFar() to get the final solution.
Returns the final solution
See also: .getBestSolutionSoFar()
1.33.6 HeuristicAbstract
public abstract class HeuristicAbstract<S extends HeuristicSolution<?>> implements Heuristic<S>A base class for Heuristic implementations.
Author Manoel Campos da Silva Filho
Parameters
1.33. org.cloudsimplus.heuristics 489
CloudSim Plus Documentation, Release 1.0.0
• <S> – The class of solutions the heuristic will deal with. It start with an initialsolution (usually random, depending on each sub-class implementation) and executes thesolution search in order to find a satisfying solution (defined by a stop criteria)
Constructors
HeuristicAbstract
HeuristicAbstract(ContinuousDistribution random, Class<S> solutionClass)Creates a heuristic.
Parameters
• random – a random number generator
• solutionClass – reference to the generic class that will be used to instantiate heuristicsolutions
Methods
getBestSolutionSoFar
public S getBestSolutionSoFar()
getNeighborSolution
public S getNeighborSolution()
getNumberOfNeighborhoodSearchesByIteration
public int getNumberOfNeighborhoodSearchesByIteration()
getRandom
protected ContinuousDistribution getRandom()
Returns a random number generator
getRandomValue
public int getRandomValue(int maxValue)
getSolveTime
public double getSolveTime()
490 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setBestSolutionSoFar
protected final void setBestSolutionSoFar(S solution)Sets a solution as the current one.
Parameters
• solution – the solution to set as the current one.
setNeighborSolution
protected final void setNeighborSolution(S neighborSolution)Sets a solution as the neighbor one.
Parameters
• neighborSolution – the solution to set as the neighbor one.
setNumberOfNeighborhoodSearchesByIteration
public void setNumberOfNeighborhoodSearchesByIteration(int numberOfNeighborhood-Searches)
setSolveTime
protected void setSolveTime(double solveTime)Sets the time taken to solve the heuristic.
Parameters
• solveTime – the time to set (in seconds)
solve
public S solve()
updateSystemState
protected abstract void updateSystemState()Updates the state of the system in order to keep looking for a suboptimal solution.
1.33.7 HeuristicNull
class HeuristicNull<S extends HeuristicSolution<?>> implements Heuristic<S>A class to allow the implementation of Null Object Design Pattern for the Heuristic interface and extensionsof it.
Author Manoel Campos da Silva Filho
1.33. org.cloudsimplus.heuristics 491
CloudSim Plus Documentation, Release 1.0.0
Methods
createNeighbor
public S createNeighbor(S source)
getAcceptanceProbability
public double getAcceptanceProbability()
getBestSolutionSoFar
public S getBestSolutionSoFar()
getInitialSolution
public S getInitialSolution()
getNeighborSolution
public S getNeighborSolution()
getNumberOfNeighborhoodSearchesByIteration
public int getNumberOfNeighborhoodSearchesByIteration()
getRandomValue
public int getRandomValue(int maxValue)
getSolveTime
public double getSolveTime()
isToStopSearch
public boolean isToStopSearch()
setNumberOfNeighborhoodSearchesByIteration
public void setNumberOfNeighborhoodSearchesByIteration(int neighborhoodSearches)
492 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
solve
public S solve()
1.33.8 HeuristicSolution
public interface HeuristicSolution<T> extends Comparable<HeuristicSolution<T>>A solution for a complex problem found using a Heuristic implementation. A heuristic can generate multiplesolutions until find an optimal or suboptimal solution for the problem.
Author Manoel Campos da Silva Filho
Parameters
• <T> – the type used to store the result of the solution. Check getResult() for moredetails.
Fields
NULL
HeuristicSolution NULLAn attribute that implements the Null Object Design Pattern for HeuristicSolution objects.
Methods
getCost
double getCost()Defines the cost of using this solution. As higher is the cost, worse is a solution. How a solution cost is computedis totally dependent of the heuristic implementation being used to find a solution.
Returns the solution cost
See also: .getFitness()
getFitness
double getFitness()Defines how good the solution is and it the inverse of the getCost(). As higher is the fitness, better is asolution. How a solution fitness is computed is totally dependent of the heuristic implementation being used tofind a solution.
Returns the solution fitness
See also: .getCost()
getHeuristic
Heuristic<HeuristicSolution<T>> getHeuristic()
Returns the heuristic that generated this solution.
1.33. org.cloudsimplus.heuristics 493
CloudSim Plus Documentation, Release 1.0.0
getResult
T getResult()Gets the result of the solution. For instance, if a implementation of this interface aims to provide a mappingbetween Cloudlets and Vm’s, this type would be a Map<Cloudlet, Vm>, that will indicate which Vm willrun each Cloudlet. This way, the type T of the solution is totally dependent of the problem being solved by theheuristic implementation.
The result of solution is generated by a heuristic. Getting an optimal or sub-optimal solution is the final goal ofa heuristic.
Returns the object containing the result of the generated solution.
1.33.9 HeuristicSolutionNull
final class HeuristicSolutionNull implements HeuristicSolutionA class that implements the Null Object Design Pattern for HeuristicSolution class.
Author Manoel Campos da Silva Filho
See also: HeuristicSolution.NULL
Methods
compareTo
public int compareTo(Object o)
getCost
public double getCost()
getFitness
public double getFitness()
getHeuristic
public Heuristic getHeuristic()
getResult
public Object getResult()
494 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
1.33.10 SimulatedAnnealing
public abstract class SimulatedAnnealing<S extends HeuristicSolution<?>> extends HeuristicAbstract<S>A base class for implementation of Simulated Annealing algorithms used to find a suboptimal solution for aproblem defined by sub-classes of this one. The Simulated Annealing is a heuristic that starts with a randomsolution and iteratively generates a random neighbor solution that its fitness is assessed in order to reach a sub-optimal result. The algorithm try to avoid local maximums, randomly selecting worse solutions to get awayfrom being stuck in these locals.
The algorithm basically works as follows:
1. Starts generating a random solution as you wish;
2. Computes its fitness using some function defined by the developer implementing the heuristic;
3. Generates a neighbor random solution from the current solution and compute its fitness;
4. Assess the neighbor and the current solution:
• if neighbor.getFitness() > current.getFitness() then move to the new solution;
• if neighbor.getFitness() < current.getFitness() then randomly decide if moveto the new solution;
5. Repeat steps 3 to 4 until an aceptable solution is found or some number of iterations or time is reached.These conditions are defined by the developer implementing the heuristic.
Author Manoel Campos da Silva Filho
Parameters
• <S> – the class of solutions the heuristic will deal with, starting with a random solutionand execute the solution search in order to achieve a satisfying solution (defined by a stopcriteria)
See also: [1] R. A. Rutenbar, “Simulated Annealing Algorithms: An overview,” IEEE Circuits Devices Mag.,vol. 1, no. 5, pp. 19–26, 1989.
Constructors
SimulatedAnnealing
SimulatedAnnealing(ContinuousDistribution random, Class<S> solutionClass)Instantiates a simulated annealing heuristic.
Parameters
• random – a pseudo random number generator
• solutionClass – reference to the generic class that will be used to instantiate heuristicsolutions
Methods
getAcceptanceProbability
public double getAcceptanceProbability()@inheritDoc
1.33. org.cloudsimplus.heuristics 495
CloudSim Plus Documentation, Release 1.0.0
It is used the Boltzmann distribution to define the probability of a worse solution (considering its cost) to beaccepted or not in order to avoid local minima. The Boltzmann factor computed also ensures that better solutionsare always accepted. The Boltzmann Constant has different values depending of the used unit. In this case, itwas used the natural unit of information.
Returns @inheritDoc
See also: Boltzmann distribution, Boltzmann constant
getColdTemperature
public double getColdTemperature()
Returns the temperature that defines the system is cold enough and solution search may be stopped.
getCoolingRate
public double getCoolingRate()
Returns percentage rate in which the system will be cooled, in scale from [0 to 1[.
getCurrentTemperature
public double getCurrentTemperature()Gets the current system temperature that represents the system state at the time of the method call.
Returns the current system temperature
isToStopSearch
public boolean isToStopSearch()@inheritDoc
Returns true if the system is cold enough and solution search can be stopped, false otherwise
setColdTemperature
public void setColdTemperature(double coldTemperature)Sets the temperature that defines the system is cold enough and solution search may be stopped.
Parameters
• coldTemperature – the cold temperature to set
setCoolingRate
public void setCoolingRate(double coolingRate)Sets the percentage rate in which the system will be cooled, in scale from [0 to 1[.
Parameters
• coolingRate – the rate to set
496 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
setCurrentTemperature
protected void setCurrentTemperature(double currentTemperature)Sets the current system temperature.
Parameters
• currentTemperature – the temperature to set
updateSystemState
public void updateSystemState()@inheritDoc Cools the system at a the defined cooling rate.
See also: .getCurrentTemperature()()
1.34 org.cloudsimplus.listeners
Provides org.cloudsimplus.listeners.EventListener implementations to enable event notificationsduring simulation execution.
These notifications are related to changes in the state of simulation entities. The listeners enable, for instance, notifyingwhen:
• a Host updates the processing of its VMs, it is allocated to a Vm or it is deallocated from a Vm;
• a Vm has its processing updated or fails to be placed at a Host due to lack of resources;
• a Cloudlet has its processing updated, it finishes its execution inside a Vm;
• a simulation processes any kind of event.
These listeners were implemented using Java 8 functional interfaces, enabling the use of Lambda Expressions thatallow a function reference to be passed as parameter to another function. Such a reference will be used to automaticallycall the function every time the listened event is fired. Researchers developing using just Java 7 features can also usethese listeners in the old-way by passing an anonymous class to them.
Listeners allow developers to perform specific tasks when different events happen and can be largely used for moni-toring purposes, metrics collection and dynamic creation of objects, such as VMs and Cloudlets, at runtime.
author Manoel Campos da Silva Filho
1.34.1 CloudletEventInfo
public interface CloudletEventInfo extends EventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Cloudlet.
Author Manoel Campos da Silva Filho
See also: CloudletVmEventInfo
1.34. org.cloudsimplus.listeners 497
CloudSim Plus Documentation, Release 1.0.0
Methods
getCloudlet
Cloudlet getCloudlet()Gets the Cloudlet for which the event happened.
1.34.2 CloudletVmEventInfo
public interface CloudletVmEventInfo extends CloudletEventInfo, VmEventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Cloudlet running inside a Vm.
Author Manoel Campos da Silva Filho
See also: Cloudlet.addOnUpdateProcessingListener(EventListener), Cloudlet.addOnFinishListener(EventListener)
Methods
of
static CloudletVmEventInfo of(EventListener<? extends EventInfo> listener, Cloudlet cloudlet, Vm vm)Gets a CloudletVmEventInfo instance from the given parameters. The getTime() is the current simulationtime.
Parameters
• listener – the listener to be notified about the event
• cloudlet – the Cloudlet that fired the event
• vm – the Vm where the Cloudlet is or was running into, depending on the fired event, suchas the OnUpdateCloudletProcessing or OnCloudletFinish
of
static CloudletVmEventInfo of(EventListener<? extends EventInfo> listener, double time, Cloudlet cloudlet)Gets a CloudletVmEventInfo instance from the given parameters. The Vm attribute is defined as the Vm wherethe Cloudlet is running.
Parameters
• time – the time the event happened
• cloudlet – the Cloudlet that fired the event
See also: .of(EventListener,Cloudlet,Vm)
of
static CloudletVmEventInfo of(EventListener<? extends EventInfo> listener, Cloudlet cloudlet)Gets a CloudletVmEventInfo instance from the given parameters. The Vm attribute is defined as the Vm wherethe Cloudlet is running and the getTime() is the current simulation time.
498 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Parameters
• cloudlet – the Cloudlet that fired the event
See also: .of(EventListener,Cloudlet,Vm)
of
static CloudletVmEventInfo of(EventListener<? extends EventInfo> listener, double time, Cloudlet cloudlet,Vm vm)
Gets a CloudletVmEventInfo instance from the given parameters.
Parameters
• listener – the listener to be notified about the event
• time – the time the event happened
• cloudlet – the Cloudlet that fired the event
• vm – the Vm where the Cloudlet is or was running into, depending on the fired event, suchas the OnUpdateCloudletProcessing or OnCloudletFinish
1.34.3 DatacenterBrokerEventInfo
public interface DatacenterBrokerEventInfo extends EventInfoAn interface that represent data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given DatacenterBroker.
Author Manoel Campos da Silva Filho
Methods
getDatacenterBroker
DatacenterBroker getDatacenterBroker()Gets the DatacenterBroker for which the event happened.
of
static DatacenterBrokerEventInfo of(EventListener<? extends EventInfo> listener, DatacenterBroker broker)Gets a DatacenterBrokerEventInfo instance from the given parameters.
Parameters
• listener – the listener to be notified about the event
• broker – the DatacenterBroker where the event happened
1.34.4 DatacenterEventInfo
public interface DatacenterEventInfo extends EventInfoAn interface that represent data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Datacenter.
Author Manoel Campos da Silva Filho
1.34. org.cloudsimplus.listeners 499
CloudSim Plus Documentation, Release 1.0.0
Methods
getDatacenter
Datacenter getDatacenter()Gets the Datacenter for which the event happened.
1.34.5 EventInfo
public interface EventInfoA general interface that represents data to be passed to EventListener objects that are registered to benotified when some events happen for a given simulation entity such as a Datacenter, Host, Vm, Cloudletand so on.
There is not implementing class for such interfaces because instances of them are just Data Type Objects (DTO)that just store data and do not have business rules. Each interface that extends this one has a getInstance()method to create an object from that interface. Such method uses the JDK8 static methods for interfaces toprovide such a feature e reduce the number of classes, providing a simpler design.
Author Manoel Campos da Silva Filho
See also: DatacenterEventInfo, HostEventInfo, VmEventInfo, CloudletEventInfo
Methods
getListener
EventListener<? extends EventInfo> getListener()Gets the listener that was notified about the event.
getTime
double getTime()Gets the time the event happened.
of
static EventInfo of(EventListener<? extends EventInfo> listener, double time)Gets a EventInfo instance from the given parameters.
Parameters
• listener – the listener to be notified about the event
• time – the time the event happened
1.34.6 EventListener
public interface EventListener<T extends EventInfo>An interface to define Observers (Listeners) that listen to specific changes in the state of a given observableobject (Subject). By this way, the EventListener gets notified when the observed object has its state changed.
500 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
The interface was defined allowing the Subject object to have more than one state to be observable. If the subjectdirectly implements this interface, it will allow only one kind of state change to be observable. If the Subject hasmultiple state changes to be observed, it can define multiple EventListener attributes to allow multiple events tobe observed.
Such Listeners are used for many simulation entities such as Vm and Cloudlet. Check the documentation ofsuch interfaces that provides some Listeners.
Author Manoel Campos da Silva Filho
Parameters
• <T> – The class of the object containing information to be given to the listener when theexpected event happens.
Fields
NULL
EventListener NULLA implementation of Null Object pattern that makes nothing (it doesn’t perform any operation on each existingmethod). The pattern is used to avoid NullPointerException’s and checking everywhere if a listener object isnot null in order to call its methods.
Methods
update
void update(T info)Gets notified when the observed object (also called subject of observation) has changed. This method has to becalled by the observed objects to notify its state change to the listener.
Parameters
• info – The data about the happened event.
1.34.7 HostEventInfo
public interface HostEventInfo extends EventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Host.
Author Manoel Campos da Silva Filho
See also: VmHostEventInfo, HostUpdatesVmsProcessingEventInfo
Methods
getHost
Host getHost()Gets the Host for which the event happened.
1.34. org.cloudsimplus.listeners 501
CloudSim Plus Documentation, Release 1.0.0
1.34.8 HostUpdatesVmsProcessingEventInfo
public interface HostUpdatesVmsProcessingEventInfo extends HostEventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedafter a Host updates the processing of its VMs.
Author Manoel Campos da Silva Filho
See also: Host.removeOnUpdateProcessingListener(EventListener)
Methods
getNextCloudletCompletionTime
double getNextCloudletCompletionTime()Gets the expected completion time of the next finishing cloudlet.
of
static HostUpdatesVmsProcessingEventInfo of(EventListener<? extends EventInfo> listener, Host host, dou-ble nextCloudletCompletionTime)
Gets a HostUpdatesVmsProcessingEventInfo instance from the given parameters.
Parameters
• listener – the listener to be notified about the event
• host – the Host where the event happened
• nextCloudletCompletionTime – the expected time for completion of the nextCloudlet
1.34.9 VmDatacenterEventInfo
public interface VmDatacenterEventInfo extends VmEventInfo, DatacenterEventInfoAn interface that represent data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Vm running inside a Datacenter.
Author Manoel Campos da Silva Filho
See also: Vm.addOnCreationFailureListener(EventListener)
Methods
of
static VmDatacenterEventInfo of(EventListener<? extends EventInfo> listener, Vm vm)Gets a VmDatacenterEventInfo instance from the given parameters. The Datacenter attribute is defined asthe Datacenter where the Vm is running and the getTime() is the current simulation time..
Parameters
• listener – the listener to be notified about the event
• vm – the Vm that fired the event
502 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
of
static VmDatacenterEventInfo of(EventListener<? extends EventInfo> listener, Vm vm, Datacenter datacen-ter)
Gets a VmDatacenterEventInfo instance from the given parameters. The getTime() is the current simulationtime.
Parameters
• listener – the listener to be notified about the event
• vm – the Vm that fired the event
• datacenter – Datacenter that the Vm is related to. Such a Datacen-ter can be that one where the Vm is or was placed, or where the Vmwas tried to be be created, depending on the fired event, such as the Vm.addOnCreationFailureListener(EventListener) OnVmCreationFailure
1.34.10 VmEventInfo
public interface VmEventInfo extends EventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Vm.
Author Manoel Campos da Silva Filho
See also: VmDatacenterEventInfo, CloudletVmEventInfo
Methods
getVm
Vm getVm()Gets the Vm for which the event happened.
1.34.11 VmHostEventInfo
public interface VmHostEventInfo extends VmEventInfo, HostEventInfoAn interface that represents data to be passed to EventListener objects that are registered to be notifiedwhen some events happen for a given Vm that is related to some Host.
It can be used to notify Listeners when a Host is Vm.addOnHostAllocationListener(EventListener)allocated to or Vm.addOnHostDeallocationListener(EventListener) deallocated from agiven Vm, when a Vm has its Vm.addOnUpdateProcessingListener(EventListener) processingupdated by its Host, etc.
•
Author Manoel Campos da Silva Filho
See also: Vm.addOnHostAllocationListener(EventListener), Vm.addOnHostDeallocationListener(EventListener), Vm.addOnUpdateProcessingListener(EventListener)
1.34. org.cloudsimplus.listeners 503
CloudSim Plus Documentation, Release 1.0.0
Methods
of
static VmHostEventInfo of(EventListener<? extends EventInfo> listener, Vm vm)Gets a VmHostEventInfo instance from the given parameters. The Host attribute is defined as the Host wherethe Vm is running and the getTime() is the current simulation time.
Parameters
• listener – the listener to be notified about the event
• vm – Vm that fired the event
of
static VmHostEventInfo of(EventListener<? extends EventInfo> listener, Vm vm, Host host)Gets a VmHostEventInfo instance from the given parameters. The getTime() is the current simulation time.
Parameters
• listener – the listener to be notified about the event
• vm – Vm that fired the event
• host – Host that the Vm is related to. Such a Host can be that one where the Vm is or wasplaced, or where the Vm was tried to be be created, depending on the fired event, such asthe Vm.addOnHostAllocationListener(EventListener) OnHostAllocationor Vm.addOnHostDeallocationListener(EventListener) OnHostDealloca-tion
1.35 org.cloudsimplus.slametrics
Provides classes to load SLA contracts from JSON files, according to the format defined by the AWS Cloudwatch.
A JSON file can be read using a method such as the org.cloudsimplus.slametrics.SlaContract.getInstance(java.lang.String).
author raysaoliveira
See also: org.cloudsimplus.slametrics.SlaContract
1.35.1 SlaContract
public class SlaContractRepresents a SLA Contract containing a list of metrics. It follows the standard used by Amazon Cloudwatch.
Instances of this class can be created from a JSON file using the getInstance(InputStream) orgetInstance(String) methods. This way, one doesn’t need to create instances of this class using itsdefault constructor. This one is just used by the JSON parsing library.
Author raysaoliveira
504 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Constructors
SlaContract
public SlaContract()Default constructor used to create a SlaContract instance. If you want to get a contract from a JSON file,you shouldn’t call the constructor directly. Instead, use some methods of the class methods.
This constructor is just provided to enable the Gson object to use reflection to instantiate a SlaContract.
See also: .getInstance(String), .getInstance(InputStream)
Methods
getAvailabilityMetric
public SlaMetric getAvailabilityMetric()
getCpuUtilizationMetric
public SlaMetric getCpuUtilizationMetric()
getExpectedMaxPriceForSingleVm
public double getExpectedMaxPriceForSingleVm()Gets the expected maximum price a single VM can cost, considering the Fault Tolerance Level.
Returns the expected maximum price a single VM can cost for the given customerAwsEc2Template for the customer’s expected price
getFaultToleranceLevel
public SlaMetric getFaultToleranceLevel()
getInstance
public static SlaContract getInstance(String jsonFilePath)Gets an SlaContract from a JSON file inside the application’s resource directory.
Parameters
• jsonFilePath – the relative path to the JSON file representing the SLA contract to read
Returns a SlaContract read from the JSON file
getMaxPrice
public double getMaxPrice()Gets the maximum price a customer expects to pay hourly for all his/her running VMs.
1.35. org.cloudsimplus.slametrics 505
CloudSim Plus Documentation, Release 1.0.0
getMetrics
public List<SlaMetric> getMetrics()
Returns the metrics
getMinFaultToleranceLevel
public int getMinFaultToleranceLevel()
getPriceMetric
public SlaMetric getPriceMetric()
getTaskCompletionTimeMetric
public SlaMetric getTaskCompletionTimeMetric()
getWaitTimeMetric
public SlaMetric getWaitTimeMetric()
main
public static void main(String[] args)A main method just to try the class implementation.
Parameters
• args –
setMetrics
public void setMetrics(List<SlaMetric> metrics)
Parameters
• metrics – the metrics to set
toString
public String toString()
1.35.2 SlaMetric
public class SlaMetricRepresents a metric of a SLA contract. Follows the standard defined by AWS Cloudwatch.
Author raysaoliveira
506 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
Fields
NULL
public static final SlaMetric NULL
Constructors
SlaMetric
public SlaMetric()
SlaMetric
public SlaMetric(String name)
Methods
getDimensions
public List<SlaMetricDimension> getDimensions()
getMaxDimension
public SlaMetricDimension getMaxDimension()Gets a SlaMetricDimension representing the maximum value expected for the metric. If theSlaMetricDimension.getValue() is equals to Double.MAX_VALUE, it means there is no maximumvalue.
getMinDimension
public SlaMetricDimension getMinDimension()Gets a SlaMetricDimension representing the minimum value expected for the metric. If theSlaMetricDimension.getValue() is a negative number, it means there is no minimum value.
getName
public String getName()
setDimensions
public SlaMetric setDimensions(List<SlaMetricDimension> dimensions)
setName
public SlaMetric setName(String name)
1.35. org.cloudsimplus.slametrics 507
CloudSim Plus Documentation, Release 1.0.0
toString
public String toString()
1.35.3 SlaMetricDimension
public final class SlaMetricDimensionRepresents a value for a specific metric of a SLA contract, following the format defined by the AWS Cloud-Watch.
Each dimension contains the name of the metric, the minimum and maximum acceptable values, and the metricunit. Each metric may have multiple dimensions.
Author raysaoliveira
Constructors
SlaMetricDimension
public SlaMetricDimension()
SlaMetricDimension
public SlaMetricDimension(double value)
Methods
getName
public String getName()
getUnit
public String getUnit()Gets the unit of the dimension, if “Percent” or “Absolute”. When the unit is “Percent”, the values are definedin scale from 0 to 100%, but they are stored in this class in scale from 0 to 1, because everywhere percentagevalues are defined in this scale.
getValue
public double getValue()Gets the value of the dimension, in absolute or percentage, according to the getUnit().
When the unit is “Percent”, the values are defined in scale from 0 to 100%, but they are stored in this class inscale from 0 to 1, because everywhere percentage values are defined in this scale.
508 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
isMaxValue
public boolean isMaxValue()
isMinValue
public boolean isMinValue()
isPercent
public boolean isPercent()Checks if the unit is defined in percentage values.
setName
public SlaMetricDimension setName(String name)
setUnit
public SlaMetricDimension setUnit(String unit)
setValue
public SlaMetricDimension setValue(double value)
toString
public String toString()
1.36 org.cloudsimplus.vmtemplates
Provides template classes which enable reading VM configurations from a JSON file, representing actual types ofVMs available in real Cloud Providers such as Amazon Web Services (AWS).
A JSON file can be read using a method such as the org.cloudsimplus.vmtemplates.AwsEc2Template.getInstance(java.lang.String). Then, one can call the usual org.cloudbus.cloudsim.vms.Vmconstructors to create an actual VM, using the configurations from the template file.
author raysaoliveira
See also: org.cloudsimplus.vmtemplates.AwsEc2Template
1.36. org.cloudsimplus.vmtemplates 509
CloudSim Plus Documentation, Release 1.0.0
1.36.1 AwsEc2Template
public class AwsEc2Template implements Comparable<AwsEc2Template>Represents an Amazon EC2 Instance template. This class enables reading a template from a JSON file, contain-ing actual configurations for VMs available in Amazon Web Services.
Author raysaoliveira
See also: .getInstance(String)
Fields
NULL
public static final AwsEc2Template NULL
Constructors
AwsEc2Template
public AwsEc2Template()Default constructor used to create an AwsEc2Template instance. If you want to get a templatefrom a JSON file, you shouldn’t call the constructor directly. Instead, use some methods such as thegetInstance(String).
This constructor is just provided to enable the Gson object to use reflection to instantiate a AwsEc2Template.
AwsEc2Template
public AwsEc2Template(AwsEc2Template source)A clone constructor which receives an AwsEc2Template and creates a clone of it.
Parameters
• source – the AwsEc2Template to be cloned
AwsEc2Template
public AwsEc2Template(String jsonFilePath)Instantiates an AWS EC2 Instance from a JSON file.
Parameters
• jsonFilePath – the full path to the JSON file representing the template with configura-tions for an AWS EC2 Instance
Methods
compareTo
public int compareTo(AwsEc2Template o)
510 Chapter 1. JavaDocs
CloudSim Plus Documentation, Release 1.0.0
getCpus
public int getCpus()
getFileName
public String getFileName()Gets only the name of the JSON template file used to create this template, without the path.
getFilePath
public String getFilePath()Gets the full path to the JSON template file used to create this template.
getInstance
public static AwsEc2Template getInstance(String jsonFilePath)Gets an AWS EC2 Instance from a JSON file inside the application’s resource directory. Use the availableconstructors if you want to load a file outside the resource directory.
Parameters
• jsonFilePath – the relative path to the JSON file representing the template with con-figurations for an AWS EC2 Instance
Returns the AWS EC2 Instance from the JSON file
getMemoryInMB
public int getMemoryInMB()
getName
public String getName()
getPricePerHour
public double getPricePerHour()Gets the price per hour of a VM created from this template
main
public static void main(String[] args)A main method just to try the class implementation.
Parameters
• args –
1.36. org.cloudsimplus.vmtemplates 511
CloudSim Plus Documentation, Release 1.0.0
setCpus
public void setCpus(int cpus)
setMemoryInMB
public void setMemoryInMB(int memoryInMB)
setName
public void setName(String name)
setPricePerHour
public void setPricePerHour(double pricePerHour)
toString
public String toString()
512 Chapter 1. JavaDocs
CHAPTER 2
Frequent Asked Questions (FAQ)
Here, you find answer to the most recurrent questions in the CloudSim Plus mailing list. This FAQ was adapted fromCloudSim, under the terms of the GPL license. Copyright (c) 2009-2012, The University of Melbourne, Australia.
2.1 Getting started
2.1.1 1. What is CloudSim Plus? What does it do and what doesn’t it do?
CloudSim Plus is a toolkit (library) for simulation of Cloud computing scenarios. It provides basic classes for de-scribing data centers, virtual machines, applications, users, computational resources, and policies for management ofdiverse parts of the system (e.g., scheduling and provisioning).
These components can be put together for users to evaluate new strategies in utilization of Clouds (policies, schedulingalgorithms, mapping and load balancing policies, etc). It can also be used to evaluate efficiency of strategies fromdifferent perspectives, from cost/profit to speed up of application execution time. It also supports evaluation of GreenIT policies.
The above are some common scenarios we envisioned and that users have been explored. Nevertheless, there is nolimit on the utilization you can make from it: classes can be extended or replaced, new policies can be added and newscenarios for utilization can be coded. Think of it as the building blocks for your own simulated Cloud environment.
Therefore, CloudSim Plus is not a ready-to-use solution were you set parameters and collect results for use in yourproject. Being a library, CloudSim Plus requires that you write a Java program using its components to compose thedesired scenario. Nevertheless, CloudSim Plus can be used to build such a ready-to-use solution.
2.1.2 2. Is CloudSim Plus the right tool for my project?
CloudSim Plus is a simulator, so it doesn’t run any actual software technology. Simulation can be defined as “running amodel of a software in a model of hardware”. As it’s all about models, specific technology details are abstracted. Moreinformation about differences between simulation, emulation, and other experiments methodologies can be found in:
513
CloudSim Plus Documentation, Release 1.0.0
Gustedt, J.; Jeannot, E.; and Quinson, M. Experimental methodologies for large-scale systems: a survey, ParallelProcessing Letters, World Scientific, 2009, 19(3), 399-418.
2.1.3 3. What do I need to use CloudSim Plus ? How can I install it?
The only previous knowledge you need to use CloudSim Plus is basic Java programming (as CloudSim Plus is writtenin Java) and some knowledge about Cloud computing. Knowledge on programming IDEs like Eclipse or NetBeansis also handy, as they simplifies a lot application development tasks. Alternatively, Maven can be used to build yourapplications.
CloudSim Plus does not have to be installed: you just clone the GitHub repository at your machine, download thesource code from GitHub and unpack on any directory, or use it as a maven dependency inside your own project andit is ready to be used. See How to Use section for more details.
The current version requires JDK 8.
2.1.4 4. How can I learn more about CloudSim Plus ?
You can start by the examples available in the cloudsim-plus-examples module that is available when you downloadthe source codes. They start with simple scenarios and progress to more complex ones. After that, you will have agood idea on how you can put components together to build your own scenarios.
As the basic components are not sufficient for your project, you may start to study the API, so you will be able to useadvanced features, and to extend or replace components.
Other source of information is the CloudSim Plus Group.
2.1.5 5. Can CloudSim Plus run my application X?
No, CloudSim Plus is a simulator – it does not run real applications. It is intended to be used for simulating andexperimenting with various scheduling and VM allocation algorithms.
2.1.6 6. I don’t know anything about Java 8. How can I use CloudSim Plus?
You aren’t required to know Java 8 to use CloudSim Plus. Despite there are some examples using Java 8 featuressuch as Lambda Expressions and Streams API, you can perfectly write Java 7 code to build your simulations. It’s justneeded to use Java 8 to build and run the examples.
Anyway, if you don’t know Java 8 yet, it’s a good time to start learning. There are lots of free and awesome contentonline. You can start by checking the links above or subscribing for the JDK 8 Massive Open and Online Course:Lambdas and Streams Introduction at the Oracle Learning Library. If new classes aren’t scheduled yet, the videos areavailable at YouTube. But if you can attend the course, you’ll have more resources such as a exercises and a discussionforum.
2.2 CloudSim Plus components, communication, and events
2.2.1 1. What are the default behavior of components provided in CloudSim Pluspackage? How can I change them?
Datacenter behaves like an IaaS provider: it receives requests for VMs from brokers and create the VMs in hosts.
514 Chapter 2. Frequent Asked Questions (FAQ)
CloudSim Plus Documentation, Release 1.0.0
The most basic Broker (DatacenterBrokerSimple) provided in CloudSim Plus only submits a list of VMs to be createdand schedules Cloudlets sequentially on them. Usually you have to create your own Broker that implements thedesired scheduling policy and/or policy for generation of VM requests and Cloudlets.
To change default behavior, you can either extend these classes to add the intended behavior.
2.2.2 2. How can I code a periodic behavior to be adopted by entities?
This is done by setting an internal event to be fired periodically. Upon reception of the event, the handler for it iscalled, and the desired behavior is implemented in such handler method. Below we show how to do it for Datacenterclass. The same steps can be used to enable such behavior in Broker as well.
1. Extend DatacenterSimple
2. Define a new tag to describe periodic event
3. Override processOtherEvent, to detect the periodic event and call a handler for it
4. Implement the handler method. Eventually, this method also schedules the next call for the event.
Important: your code must contain a condition for stopping generation of internal events, otherwise simulationwill never finish.
class NewDatacenter extends DatacenterSimple //choose any unused value you want to represent the tag.public static final int PERIODIC_EVENT = 67567;
@Overrideprotected void processOtherEvent(SimEvent ev) if (ev == null)
Log.printLine("Warning: "+getSimulation().clock()+": "+this.getName()+": Null→˓event ignored.");
else int tag = ev.getTag();switch(tag)
case PERIODIC_EVENT: processPeriodicEvent(ev); break;default: Log.printLine("Warning: "+getSimulation().clock()+":"+this.getName()+
→˓": Unknown event ignored. Tag:" +tag);
private void processPeriodicEvent(SimEvent ev) //your code herefloat delay; //contains the delay to the next periodic eventboolean generatePeriodicEvent; //true if new internal events have to be generatedif (generatePeriodicEvent)
send(getId(), delay,PERIODIC_EVENT, data);
2.2.3 3. How can I create my own type of messages? How to make them be receivedby other entities?
The process is similar to the previous one. First, a new message tag has to be declared somewhere. Then, a handler forthis message have to be added in the receiver of the message. The code is similar to the previous, with the exception
2.2. CloudSim Plus components, communication, and events 515
CloudSim Plus Documentation, Release 1.0.0
of the handler, that will not generate the event internally, but instead it will wait for some entity to send the message.
2.3 Policies and algorithms
2.3.1 1. What are the default scheduling policies and how can I change them?
CloudSim Plus models scheduling of CPU resources at two levels: Host and VM.
At Host level, the host shares fractions of each processor element (PE) to each VM running on it. Because resources areshared among VMs, this scheduler is called VmScheduler. The scheduler must be set to a host after it is instantiated.
In the VM level, each virtual machine divides the resources received from the host among Cloudlets running on it.Because such resources are shared among Cloudlets, this scheduler is called CloudletScheduler. The scheduler mustbe set to a VM after it is instantiated
In both levels, there are two default policies available: the first policy, xSpaceShared (x stands for VmScheduler orCloudletScheduler), required PEs by Cloudlets/VMs are exclusively allocated. It means that if there are more runningelements (VMs or Cloudlets) than available PEs, the last objects to arrive wait on a queue until enough resources arefree. In the second policy, xTimeShared, fraction of available PEs are shared among running elements, and all theelements run simultaneously.
Policies for VM and Cloudlet scheduling can be used in any combination. For example, you can use VmScheduler-TimeShared and CloudletSchedulerSpaceShared, or you can use VmSchedulerTimeShared and CloudletScheduler-TimeShared. It is possible even having a host running VMs with different Cloudlet scheduling policies, or a datacenter with hosts with different VM Scheduling policies.
To define your own policy, you have to extend one of the VmScheduler or CloudletScheduler classes.
2.3.2 2. What scheduling decisions should be implemented at VM level and whatshould be implemented at broker level?
The VmScheduler models the behavior of scheduling at virtual machine level like VMMs such as Xen and VMwareESX. Therefore, if you want to model behavior of this kind of software regarding distribution of resources amongVMs running in the same host, this is the place where your new policy should be implemented.
Similarly, CloudletScheduler models the behavior of scheduling at the guest operating system level: given a numberof applications currently running inside a VM, how available CPU resources should be divided among them? If youwant to model this behavior, CloudletScheduler is the class to be extended.
There is one point that is not considered by either scheduler: given a number of Cloudlets, which one should startexecuting first? This kind of decision should be defined at Broker level, that will submit Cloudlets to VMs in thedesired order, while it may delay the submission of other Cloudlets according to defined policies. For instance, if thecurrent VMs that the broker is accountable for are overloaded, the submission of new Cloudlets to VMs can be delayedby the broker.
2.3.3 3. What is the default provisioning policy and how can I change it?
The provisioning problem consists of defining, among the available hosts in the data center, which one should receivea new VM requested by a user. Provisioning of hosts to VMs in data centers follows a simple strategy where thehost with less running VMs receives the next VM. This behavior is defined in the VMAllocationPolicySimple class.To change this behavior, extend VMAllocationPolicyAbstract to define the new provisioning behavior, and pass thisobject when instantiating a Datacenter.
516 Chapter 2. Frequent Asked Questions (FAQ)
CloudSim Plus Documentation, Release 1.0.0
2.3.4 4. What class should I modify to implement my algorithm?
There are several places in CloudSim Plus where you can implement your algorithm depending on what the algorithmis intended to do. Usually you may start by extending some abstract class or even extending a concrete class. Beloware several examples of classes that you may need to extend:
1. DatacenterBrokerAbstract – to define the way VM provisioning requests are submitted to data centers and theway cloudlets are submitted and assigned to VMs.
2. VmAllocatonPolicyAbstract – to implement your own algorithms for deciding which host a new VM shouldbe placed on. You can also implement dynamic VM reallocation algorithms (VM migration) by extending theoptimizeAllocation method, which is called at every time frame and receives the full set of current VMs in thedata center.
3. PowerVmAllocationPolicyMigrationAbstract – to implement power-aware dynamic VM consolidation algo-rithms that use VM live migration to dynamically reallocate VMs at every time frame. The main method to beoverridden is optimizeAllocation.
4. VmSchedulerAbstract – to implement algorithms for resource allocation to VMs within a single host.
5. CloudletSchedulerAbstract – to implement algorithms for scheduling cloudlets within a single VM.
2.4 Advanced features
2.4.1 1. How can I code VM migration inside a data center?
VM migrations are triggered inside the data center, by an internal data center event. Therefore, triggering a migrationmeans receiving and processing a VM_MIGRATION event. Such event is sent by a Datacenter to itself when itreceives a list of VMs to migrate from the VmAllocationPolicy.
The datacenter sends the migration request message using a call such as:
send(this.getId(), delay, CloudSimTags.VM_MIGRATE, vm);
The delay field contains the estimated migration completion time. Therefore, when using it, the method that startsthe migration process has to provide estimated completion time. After the delay, the event is received by the datacenter, which is interpreted as migration completed: therefore, from this time on the VM is available in the destinationhost.
2.5 Getting help
2.5.1 1. I have a question. What should I do?
The first thing you should do is reading this FAQ and the documentation. If you are trying to implement some feature,check the examples. They usually implement the most required features. Try reading the source code of the classesinvolved in the feature you may need to implement. By understanding how such classes work you may get youranswers.
If your question is not answered, you should try next previous discussions from CloudSim Plus Group. Fragments ofcode that solve typical problems can be found there.
2.4. Advanced features 517
CloudSim Plus Documentation, Release 1.0.0
Finally, if you can’t find an answer for your problem, send an e-mail to the discussion group. Please, try to beclear about your question, use appropriate English and show that you have tried by yourself to fix the issue. Suchrecommendations are likely to speed up the answer. If you are not getting meaningful answers or any answer at all,maybe it’s time to read the How To Ask Questions The Smart Way.
2.5.2 2. How do I report bugs, desirable features, unexpected behavior and otherissues?
Please, use the issue tracker for that. This helps to speed up update process. Issues reported in the discussion groupmay take longer time to be added to the issue tracker.
2.5.3 3. Can you implement the specific feature X, required by myproject/assignment?
Because we are a small team of developers, we can’t add support to every scenario envisioned by users. But this is ourintention: we provide generic classes and features that can be broadly used, and users develop case-specific behavior.Suggestion for new features that may be useful for significant number of users are welcomed and can be posted in theissue tracker. Classes and features that are narrow in applicability and are intended to solve specific problems, though,are unlikely to be developed.
518 Chapter 2. Frequent Asked Questions (FAQ)
CHAPTER 3
Publications
Information about CloudSim Plus publications is available at the official web site.
519
CloudSim Plus Documentation, Release 1.0.0
520 Chapter 3. Publications
CHAPTER 4
Syncing your fork or clone with the latest version from CloudSim Plusrepository
4.1 Syncing your fork
If you want to contribute to CloudSim Plus, you have to fork the project so that you can make changes at your owncopy of the repository. Once you have forked CloudSim Plus, this quick tutorial shows you how to sync your fork withthe official repository in order to get the latest development version.
Open a terminal inside the directory where you cloned the CloudSim Plus repository and execute the following com-mands:
1. Add a remote to the official repository in order to track changes on it (this step has to be performed justonce, if you already have execute it and try to execute again, git will just tell you that a remote called “up-stream” already exists): git remote add upstream https://github.com/manoelcampos/cloudsim-plus
2. Get the latest version from the upstream remote (that is pointing to the official repository): git fetchupstream
3. Switch to your master branch to merge the changes from the upstream: git checkout master
4. Merge the changes from the master branch got from the upstream remote into your master: git mergeupstream/master
5. As CloudSim Plus is a Maven project, usually it is worth to execute mvn clean install to clean the builddirectory, re-build the project and install the new updated CloudSim Plus jars into your local maven repository.This procedure is useful to avoid errors when trying to use a new version.
6. Push the changes to your fork at github: git push origin master
More information on syncing forks can be found here.
521
CloudSim Plus Documentation, Release 1.0.0
4.2 Syncing your clone
If you just want to download CloudSim Plus source code so that you can use it into your project, study its code,documentation and examples, you can simply clone it locally at your computer. The clone doesn’t create a copy ofthe repository into your GitHub account. However, if you are planning to make changes and request their inclusion inCloudSim Plus, you have to fork the project.
If you have just cloned the repository, to update your local copy with the official repository it is as simple as executinggit pull at the command line.
522 Chapter 4. Syncing your fork or clone with the latest version from CloudSim Plus repository
CHAPTER 5
Indices and tables
• genindex
• search
523
CloudSim Plus Documentation, Release 1.0.0
524 Chapter 5. Indices and tables
Index
Aabort() (Java method), 99, 123, 131abs(double) (Java method), 367ABSOLUTE (Java field), 379AbstractSwitch (Java class), 224AbstractSwitch(CloudSim, NetworkDatacenter) (Java
constructor), 224AbstractTableBuilder (Java class), 457AbstractTableBuilder() (Java constructor), 458AbstractTableBuilder(String) (Java constructor), 458AbstractTableColumn (Java class), 460AbstractTableColumn(String, String) (Java constructor),
460AbstractTableColumn(TableBuilder, String) (Java con-
structor), 460AbstractTableColumn(TableBuilder, String, String) (Java
constructor), 460addBaudRate(double) (Java method), 216addCapacity(long) (Java method), 293, 303, 306, 308addCloudletToExecList(CloudletExecution) (Java
method), 320addCloudletToFinishedList(CloudletExecution) (Java
method), 320addCloudletToReturnedList(Cloudlet) (Java method),
313, 320, 332addCloudletToWaitingList(CloudletExecution) (Java
method), 320addColumn(int, String) (Java method), 465, 467, 469, 473addColumn(int, TableColumn) (Java method), 458, 469addColumn(int, TableColumn, Function) (Java method),
463addColumn(String) (Java method), 458, 468addColumn(String, String) (Java method), 458, 469addColumn(TableColumn) (Java method), 458, 469addColumn(TableColumn, Function) (Java method), 463addColumnList(String) (Java method), 458, 469addDataToRow(Cloudlet, List) (Java method), 464addEntity(CloudSimEntity) (Java method), 99, 123, 131addEntryTime(double) (Java method), 216
addEvent(SimEvent) (Java method), 138–140addEventFirst(SimEvent) (Java method), 140addExitTime(double) (Java method), 217addFile(File) (Java method), 147, 160, 163, 282, 286, 311addFile(List) (Java method), 283, 287addHistoryEntryIfAbsent(Host, double) (Java method),
12addHop(SimEntity) (Java method), 217addHost(Host) (Java method), 160addHost(T) (Java method), 148, 163addHostList(List) (Java method), 148, 160, 163addLink(int, int, double, double) (Java method), 240, 241,
243addLink(TopologicalLink) (Java method), 244addMigratingInVm(Vm) (Java method), 183, 193, 201addNode(TopologicalNode) (Java method), 245addOnClockTickListener(EventListener) (Java method),
99, 123, 131addOnCreationFailureListener(EventListener) (Java
method), 392, 404, 412addOneTimeOnCreationOfWaitingVmsFinishListener(EventListener,
Boolean) (Java method), 38addOneTimeOnVmsCreatedListener(EventListener)
(Java method), 32, 38, 46addOnEventProcessingListener(EventListener) (Java
method), 100, 123, 131addOnFinishListener(EventListener) (Java method), 51,
66, 80addOnHostAllocationListener(EventListener) (Java
method), 392, 404, 413addOnHostDeallocationListener(EventListener) (Java
method), 393, 404, 413addOnSimulationPausedListener(EventListener) (Java
method), 100, 124, 131addOnUpdateProcessingListener(EventListener) (Java
method), 51, 66, 80, 183, 194, 201, 393, 404,413
addOnVmsCreatedListener(EventListener) (Javamethod), 32, 38, 46
addPacket(Cloudlet, long) (Java method), 92
525
CloudSim Plus Documentation, Release 1.0.0
addPacketToBeSentToDownlinkSwitch(Switch, Host-Packet) (Java method), 224, 232, 235
addPacketToBeSentToHost(NetworkHost, HostPacket)(Java method), 224, 232, 236
addPacketToBeSentToUplinkSwitch(Switch, Host-Packet) (Java method), 224, 232, 236
addPacketToListOfPacketsSentFromVm(VmPacket)(Java method), 338–340
addReceivedNetworkPacket(HostPacket) (Java method),211
addRequiredFile(String) (Java method), 52, 66, 80addRequiredFiles(List) (Java method), 52, 67, 81addReservedFile(File) (Java method), 283, 287, 311addStateHistoryEntry(VmStateHistoryEntry) (Java
method), 393, 404, 413addStorageToList(FileStorage) (Java method), 450addSwitch(Switch) (Java method), 170addTask(CloudletTask) (Java method), 96addUsedPes(Vm) (Java method), 4addUtilizationHistory(double) (Java method), 389, 391,
423addVirtualRuntime(double) (Java method), 76addVmCloner(DatacenterBroker, VmCloner) (Java
method), 475addVmMigratingOut(Vm) (Java method), 183, 194, 201addVmToCreatedList(Vm) (Java method), 201addVmToList(Vm) (Java method), 201addWaitingCloudletToExecList(CloudletExecution)
(Java method), 320AggregateSwitch (Java class), 228AggregateSwitch(CloudSim, NetworkDatacenter) (Java
constructor), 229allocateHostForVm(Vm) (Java method), 2, 5, 7, 27allocateHostForVm(Vm, Host) (Java method), 2, 5, 7, 9,
27allocateMipsShareForVm(Vm, List) (Java method), 352,
354allocatePesForVm(Vm) (Java method), 342, 345, 349allocatePesForVm(Vm, List) (Java method), 341, 346,
349allocatePesForVmInternal(Vm, List) (Java method), 346,
351, 353allocateResource(Class, long) (Java method), 393, 405,
413allocateResource(long) (Java method), 293, 303, 306, 308allocateResource(Resource) (Java method), 303allocateResourceForVm(Vm, double) (Java method),
262, 264, 270allocateResourceForVm(Vm, long) (Java method), 260,
262, 264, 269, 270ALMOST_ZERO (Java field), 379ANY_EVT (Java field), 123assignToDatacenter(Datacenter) (Java method), 52, 67,
81
availability() (Java method), 476availability(DatacenterBroker) (Java method), 476AwsEc2Template (Java class), 510AwsEc2Template() (Java constructor), 510AwsEc2Template(AwsEc2Template) (Java constructor),
510AwsEc2Template(String) (Java constructor), 510
BBandwidth (Java class), 271Bandwidth(long) (Java constructor), 271bindCloudletToVm(Cloudlet, Vm) (Java method), 33, 38,
46, 485bitesToBytes(double) (Java method), 359BriteNetworkTopology (Java class), 239BriteNetworkTopology() (Java constructor), 240BriteNetworkTopology(String) (Java constructor), 240BrokerBuilder (Java class), 444BrokerBuilder(SimulationScenarioBuilder) (Java con-
structor), 444BrokerBuilderDecorator (Java class), 445BrokerBuilderDecorator(BrokerBuilder, DatacenterBro-
kerSimple) (Java constructor), 445BrokerBuilderInterface (Java interface), 446build() (Java method), 464Builder (Java class), 447BUSY (Java field), 292bytesToBits(double) (Java method), 360bytesToMegaBits(double) (Java method), 360bytesToMegaBytes(double) (Java method), 360
CcanAddCloudletToExecutionList(CloudletExecution)
(Java method), 313, 328, 332, 335, 336cancel(SimEntity, Predicate) (Java method), 100, 124,
131cancelAll(SimEntity, Predicate) (Java method), 100, 124,
132CANCELED (Java field), 64cancelEvent(Predicate) (Java method), 103capacity (Java field), 301ChangeableId (Java interface), 97checkCloudletsCompletionForAllHosts() (Java method),
164clear() (Java method), 138, 140clearVmPacketsToSend() (Java method), 338–340clock() (Java method), 100, 124, 132clockInHours() (Java method), 100, 124, 132clockInMinutes() (Java method), 100, 125, 132clone() (Java method), 104clone(Vm) (Java method), 479, 481CloudInformationService (Java class), 97CloudInformationService(CloudSim) (Java constructor),
98
526 Index
CloudSim Plus Documentation, Release 1.0.0
Cloudlet (Java interface), 51CLOUDLET_CANCEL (Java field), 110CLOUDLET_PAUSE (Java field), 110CLOUDLET_PAUSE_ACK (Java field), 110CLOUDLET_RESUME (Java field), 111CLOUDLET_RESUME_ACK (Java field), 111CLOUDLET_RETURN (Java field), 111CLOUDLET_SUBMIT (Java field), 111CLOUDLET_SUBMIT_ACK (Java field), 111CloudletAbstract (Java class), 65CloudletAbstract(int, long, long) (Java constructor), 66CloudletAbstract(long, int) (Java constructor), 66CloudletAbstract(long, long) (Java constructor), 66CloudletBuilder (Java class), 447CloudletBuilder(BrokerBuilderDecorator, Datacenter-
BrokerSimple) (Java constructor), 447cloudletCancel(int) (Java method), 313, 320, 332CloudletDatacenterExecution (Java class), 74CloudletDatacenterExecution() (Java constructor), 74CloudletEventInfo (Java interface), 497CloudletExecution (Java class), 76CloudletExecution(Cloudlet) (Java constructor), 76CloudletExecutionTask (Java class), 89CloudletExecutionTask(int, long) (Java constructor), 89cloudletFinish(CloudletExecution) (Java method), 314,
320, 332CloudletNull (Java class), 80cloudletPause(int) (Java method), 314, 321, 332CloudletReceiveTask (Java class), 90CloudletReceiveTask(int, Vm) (Java constructor), 90cloudletResume(int) (Java method), 314, 332, 336, 337CloudletScheduler (Java interface), 313CloudletSchedulerAbstract (Java class), 319CloudletSchedulerAbstract() (Java constructor), 320CloudletSchedulerCompletelyFair (Java class), 327CloudletSchedulerNull (Java class), 332CloudletSchedulerSpaceShared (Java class), 335CloudletSchedulerTimeShared (Java class), 336CloudletSendTask (Java class), 91CloudletSendTask(int) (Java constructor), 92CloudletSimple (Java class), 87CloudletSimple(int, long, int, long, long, Utilization-
Model, UtilizationModel, UtilizationModel)(Java constructor), 88
CloudletSimple(int, long, long) (Java constructor), 88CloudletSimple(long, int) (Java constructor), 87CloudletSimple(long, long) (Java constructor), 88CloudletsTableBuilder (Java class), 462CloudletsTableBuilder(List) (Java constructor), 463CloudletsTableBuilder(List, TableBuilder) (Java con-
structor), 463cloudletSubmit(Cloudlet) (Java method), 314, 321, 332cloudletSubmit(Cloudlet, double) (Java method), 314,
321, 332
CloudletTask (Java class), 92CloudletTask(int) (Java constructor), 93CloudletToVmMappingHeuristic (Java interface), 482CloudletToVmMappingHeuristicNull (Java class), 483CloudletToVmMappingSimulatedAnnealing (Java class),
483CloudletToVmMappingSimulatedAnnealing(double,
ContinuousDistribution) (Java constructor),483
CloudletToVmMappingSolution (Java class), 484CloudletToVmMappingSolution(CloudletToVmMappingSolution)
(Java constructor), 485CloudletToVmMappingSolution(Heuristic) (Java con-
structor), 485CloudletVmEventInfo (Java interface), 498CloudSim (Java class), 99CloudSim() (Java constructor), 99CloudSim(double) (Java constructor), 99CloudSimEntity (Java class), 103CloudSimEntity(Simulation) (Java constructor), 103CloudSimEvent (Java class), 135CloudSimEvent(CloudSim, Type, double, Object) (Java
constructor), 136CloudSimEvent(CloudSim, Type, double, SimEntity)
(Java constructor), 136CloudSimEvent(CloudSim, Type, double, SimEntity, Si-
mEntity, int, Object) (Java constructor), 135CloudSimEvent(SimEvent) (Java constructor), 136CloudSimTags (Java class), 110compareTo(AwsEc2Template) (Java method), 510compareTo(Cloudlet) (Java method), 81, 88compareTo(HeuristicSolution) (Java method), 485compareTo(Host) (Java method), 194, 201compareTo(Object) (Java method), 494compareTo(SimEntity) (Java method), 46, 104, 121, 160,
236compareTo(SimEvent) (Java method), 136, 142, 145compareTo(Vm) (Java method), 405, 413, 426computeCloudletTimeSlice(CloudletExecution) (Java
method), 328computeCpuUtilizationPercent(double) (Java method),
202computeHostUtilizationMeasure(Host) (Java method),
18, 22, 23, 26computeShortestPaths(double[][]) (Java method), 213connectHost(NetworkHost) (Java method), 224, 232, 236contains(File) (Java method), 164, 283, 287contains(String) (Java method), 164, 283, 287ContinuousDistribution (Java interface), 171ContinuousDistributionAbstract (Java class), 172ContinuousDistributionAbstract(RealDistribution) (Java
constructor), 172ContinuousDistributionAbstract(RealDistribution, long)
(Java constructor), 172
Index 527
CloudSim Plus Documentation, Release 1.0.0
ContinuousDistributionNull (Java class), 172Conversion (Java class), 359copyValue(FileAttribute) (Java method), 278countNonZeroBeginning(double) (Java method), 367CREATE (Java field), 144create(double, double) (Java method), 454createAndSubmitCloudlets(int) (Java method), 447createAndSubmitCloudlets(int, int) (Java method), 447createAndSubmitOneVm() (Java method), 455createAndSubmitVms(int) (Java method), 455createBroker() (Java method), 444–446createCloudlets(int) (Java method), 447createCloudlets(int, int) (Java method), 447createDatacenter(List) (Java method), 450createHosts(int) (Java method), 452createLinearRegression(double[], double[]) (Java
method), 367createLinearRegression(double[][], double[]) (Java
method), 367createNeighbor(CloudletToVmMappingSolution) (Java
method), 484createNeighbor(S) (Java method), 488, 492createOneHost() (Java method), 452createTemporaryVm(Vm) (Java method), 184, 194, 202createVm(Vm) (Java method), 184, 194, 202, 211CsvTableBuilder (Java class), 464CsvTableBuilder() (Java constructor), 464CsvTableBuilder(String) (Java constructor), 464CsvTableColumn (Java class), 465CsvTableColumn(String) (Java constructor), 466CsvTableColumn(String, String) (Java constructor), 466CsvTableColumn(TableBuilder, String) (Java construc-
tor), 466CsvTableColumn(TableBuilder, String, String) (Java con-
structor), 466CTLG_BASE (Java field), 360CTLG_DELETE_MASTER (Java field), 361CTLG_DELETE_MASTER_RESULT (Java field), 361CustomerEntity (Java interface), 114
DDATA_COL_SEPARATOR_FORMAT (Java field), 466Datacenter (Java interface), 147DATACENTER_LIST_REQUEST (Java field), 111DATACENTER_REGISTRATION_REQUEST (Java
field), 111DatacenterBroker (Java interface), 31DatacenterBrokerAbstract (Java class), 38DatacenterBrokerAbstract(CloudSim) (Java constructor),
38DatacenterBrokerEventInfo (Java interface), 499DatacenterBrokerHeuristic (Java class), 44DatacenterBrokerHeuristic(CloudSim) (Java construc-
tor), 45
DatacenterBrokerNull (Java class), 45DatacenterBrokerSimple (Java class), 49DatacenterBrokerSimple(CloudSim) (Java constructor),
50DatacenterBuilder (Java class), 449DatacenterBuilder(SimulationScenarioBuilder) (Java
constructor), 450DatacenterCharacteristics (Java interface), 150DatacenterCharacteristicsNull (Java class), 155DatacenterCharacteristicsSimple (Java class), 157DatacenterCharacteristicsSimple(Datacenter) (Java con-
structor), 157DatacenterEventInfo (Java interface), 499DatacenterNull (Java class), 160DatacenterSimple (Java class), 163DatacenterSimple(Simulation, List, VmAllocationPolicy)
(Java constructor), 163DataCloudTags (Java class), 360deallocateAllResources() (Java method), 293, 303, 306,
308deallocateAndRemoveResource(long) (Java method),
293, 304, 306, 308deallocateHostForVm(Vm) (Java method), 2, 5, 7, 9, 27deallocatePesForAllVms() (Java method), 342, 346, 349,
353deallocatePesForVm(Vm) (Java method), 184, 194, 202deallocatePesFromVm(int) (Java method), 315, 321, 333deallocatePesFromVm(Vm) (Java method), 342, 346, 349deallocatePesFromVm(Vm, int) (Java method), 342, 346,
349deallocatePesFromVmInternal(Vm, int) (Java method),
346, 351, 353deallocateResource(Class) (Java method), 393, 405, 413deallocateResource(long) (Java method), 293, 304, 307,
308deallocateResource(Resource) (Java method), 304deallocateResourceForAllVms() (Java method), 261, 262,
265, 267, 269deallocateResourceForVm(Vm) (Java method), 261, 262,
265, 269, 270deallocateResourceForVmSettingAllocationMapEntryToZero(Vm)
(Java method), 267, 270deallocateResourcesOfAllVms() (Java method), 202deallocateResourcesOfVm(Vm) (Java method), 202DEBUG (Java field), 366DEF_BANDWIDTH_PERCENT_FOR_MIGRATION
(Java field), 147DEF_MAX_HISTORY_ENTRIES (Java field), 388DEFAULT_ARCH (Java field), 151DEFAULT_MTU (Java field), 361DEFAULT_OS (Java field), 151DEFAULT_TIMEZONE (Java field), 151DEFAULT_VM_DESTRUCTION_DELAY (Java field),
31
528 Index
CloudSim Plus Documentation, Release 1.0.0
DEFAULT_VM_MIGRATION_CPU_OVERHEAD(Java field), 345
DEFAULT_VMM (Java field), 151DeferredQueue (Java class), 138Delayable (Java interface), 114DelayMatrix (Java class), 212DelayMatrix() (Java constructor), 212DelayMatrix(TopologicalGraph, boolean) (Java construc-
tor), 212deleteFile(File) (Java method), 284, 287, 311deleteFile(String) (Java method), 283, 287deleteRequiredFile(String) (Java method), 52, 67, 81destroyAllVms() (Java method), 184, 194, 202destroyTemporaryVm(Vm) (Java method), 184, 194, 202destroyVm(Vm) (Java method), 185, 194, 202disable() (Java method), 363, 389, 391, 423disableMigrations() (Java method), 164disableStateHistory() (Java method), 185, 194, 202disconnectHost(NetworkHost) (Java method), 224, 233,
236doubleToInt(double) (Java method), 368DOWNLINK_BW (Java field), 228, 229, 231
EEdgeSwitch (Java class), 229EdgeSwitch(CloudSim, NetworkDatacenter) (Java con-
structor), 230enable() (Java method), 363, 389, 391, 424enableMigrations() (Java method), 164enableStateHistory() (Java method), 185, 194, 203end(String) (Java method), 362END_OF_SIMULATION (Java field), 112equals(Object) (Java method), 67, 77, 104, 164, 203, 413,
421ERROR (Java field), 366EventInfo (Java interface), 500EventListener (Java interface), 500EventQueue (Java interface), 139eventsArrivalProbability() (Java method), 177eventsHappened() (Java method), 178eventTime() (Java method), 136, 142, 145ExecutionTimeMeasurer (Java class), 362ExponentialDistr (Java class), 173ExponentialDistr(double) (Java constructor), 173ExponentialDistr(long, double) (Java constructor), 173
FFAILED (Java field), 64, 292FAILED_RESOURCE_UNAVAILABLE (Java field), 64FAILURE (Java field), 112FALSE_PREDICATE (Java field), 427File (Java class), 271File(File) (Java constructor), 272File(String, int) (Java constructor), 272
FILE_ADD_ERROR_EMPTY (Java field), 361FILE_ADD_ERROR_EXIST_READ_ONLY (Java
field), 361FILE_ADD_ERROR_STORAGE_FULL (Java field),
361FILE_ADD_SUCCESSFUL (Java field), 361FILE_DELETE_ERROR (Java field), 361FILE_DELETE_MASTER_RESULT (Java field), 362FILE_DELETE_SUCCESSFUL (Java field), 362FileAttribute (Java class), 278FileAttribute(File, int) (Java constructor), 278FileStorage (Java interface), 282finalizeCloudlet() (Java method), 77findBroker(int) (Java method), 445, 446findCloudletInAllLists(double) (Java method), 321findCloudletInList(double, List) (Java method), 321findFirstDeferred(SimEntity, Predicate) (Java method),
100, 125, 132findHostForVm(Vm) (Java method), 2, 7, 9, 12, 27findHostForVm(Vm, Set) (Java method), 12findHostForVm(Vm, Set, Predicate) (Java method), 13findHostForVmInternal(Vm, Stream) (Java method), 13,
17, 31findSuitableWaitingCloudlet() (Java method), 321, 329FINISHED (Java field), 120finishVmMigration(SimEvent, boolean) (Java method),
164first() (Java method), 138, 139, 141FloydWarshall (Java class), 213FloydWarshall(int) (Java constructor), 213FREE (Java field), 292FutureQueue (Java class), 140
GGammaDistr (Java class), 173GammaDistr(int, double) (Java constructor), 174GammaDistr(long, int, double) (Java constructor), 174generateData(Object) (Java method), 461, 466, 468, 471,
474generateHeader(String) (Java method), 461, 466, 468generateSubtitleHeader() (Java method), 461, 471, 474generateTitleHeader() (Java method), 461, 471generateWorkload() (Java method), 374, 377get(int) (Java method), 445, 446, 450getAcceptanceProbability() (Java method), 488, 492, 495getAccumulatedBwCost() (Java method), 52, 67, 81getActualCpuTime() (Java method), 53, 67, 74, 81getActualCpuTime(Datacenter) (Java method), 53, 67, 81getAllocatedMips() (Java method), 209, 421getAllocatedMips(Vm) (Java method), 342, 346, 349getAllocatedMipsForCloudlet(CloudletExecution, dou-
ble) (Java method), 315, 322, 333getAllocatedMipsForVm(Vm) (Java method), 185, 195,
203
Index 529
CloudSim Plus Documentation, Release 1.0.0
getAllocatedMipsMap() (Java method), 346getAllocatedResource() (Java method), 287, 293, 298,
299, 301, 308, 309, 431, 435, 438getAllocatedResourceForVm(Vm) (Java method), 261,
262, 265, 267, 269getArchitecture() (Java method), 151, 155, 157getArrivalTime() (Java method), 75getArrivalTime(Datacenter) (Java method), 53, 67, 81getAttributeSize() (Java method), 272, 279getAvailabilityMetric() (Java method), 505getAvailableMips() (Java method), 185, 195, 203, 342,
346, 349getAvailableMipsByPe() (Java method), 322getAvailableResource() (Java method), 262, 265, 267,
269, 287, 293, 298, 299, 307–309getAvailableStorage() (Java method), 185, 195, 203getAvgSeekTime() (Java method), 287getBandwidth() (Java method), 211, 312getBandwidthPercentForMigration() (Java method), 148,
160, 165getBaudRate() (Java method), 217getBestSolutionSoFar() (Java method), 488, 490, 492getBroker() (Java method), 53, 67, 81, 114, 394, 405, 413,
446getBrokerBuilder() (Java method), 448, 454getBrokers() (Java method), 445, 446getBufferedReader(Class, String) (Java method), 371getBuzyPeList() (Java method), 186, 195, 203getBw() (Java method), 116, 117, 195, 203, 394, 405, 414,
452, 455getBwMatrix() (Java method), 240getBwProvisioner() (Java method), 186, 195, 203getBwVerticalScaling() (Java method), 394, 405, 414getCalendar() (Java method), 100, 125, 132getCapacity() (Java method), 262, 265, 268, 269, 288,
290, 293, 298, 302, 308, 310getCharacteristics() (Java method), 148, 160, 165getChecksum() (Java method), 273, 279getClonedVmsNumber() (Java method), 479, 481getCloudInfoService() (Java method), 100, 125, 132getCloudlet() (Java method), 77, 93, 498getCloudletArrivalTime() (Java method), 77getCloudletBuilder() (Java method), 446getCloudletCreatedList() (Java method), 33, 38, 46getCloudletExecList() (Java method), 315, 322, 329, 333getCloudletFailedList() (Java method), 322getCloudletFinishedList() (Java method), 33, 38, 46, 315,
322, 333getCloudletId() (Java method), 77getCloudletLength() (Java method), 77getCloudletList() (Java method), 315, 322, 333, 426, 482–
484getCloudletNiceness(CloudletExecution) (Java method),
329
getCloudletPausedList() (Java method), 322getCloudletProcessingUpdateInterval(double) (Java
method), 165getCloudletReturnedList() (Java method), 316, 322, 333getCloudlets() (Java method), 448getCloudletScheduler() (Java method), 394, 405, 414getCloudletStatus(int) (Java method), 316, 323, 333getCloudletToMigrate() (Java method), 316, 323, 333getCloudletWaitingList() (Java method), 33, 39, 46, 316,
323, 329, 333, 337getCloudletWeight(CloudletExecution) (Java method),
329getColdTemperature() (Java method), 496getColumns() (Java method), 458, 470getColumnSeparator() (Java method), 458, 470getConstant() (Java method), 254getCoolingRate() (Java method), 496getCorrelationCoefficients(double[][]) (Java method),
356getCost() (Java method), 273, 279, 485, 493, 494getCost(boolean) (Java method), 486getCostPerBw() (Java method), 53, 67, 81, 151, 155, 157getCostPerBwMegabit() (Java method), 450getCostPerCpuSecond() (Java method), 450getCostPerMem() (Java method), 152, 155, 158, 450getCostPerSec() (Java method), 53, 67, 75, 81getCostPerSec(Datacenter) (Java method), 54, 68, 82getCostPerSecond() (Java method), 152, 155, 158getCostPerStorage() (Java method), 152, 155, 158, 450getCpuPercentUsage() (Java method), 394, 405, 414getCpuPercentUsage(double) (Java method), 394, 405,
414getCpus() (Java method), 511getCpuUtilizationMetric() (Java method), 505getCreationTime() (Java method), 273, 279getCurrentAllocatedBw() (Java method), 394, 405, 414getCurrentAllocatedRam() (Java method), 395, 405, 414getCurrentAllocatedSize() (Java method), 395, 406, 414getCurrentMipsShare() (Java method), 316, 323, 333getCurrentRequestedBw() (Java method), 395, 406, 414getCurrentRequestedBwPercentUtilization() (Java
method), 316, 323, 333getCurrentRequestedMaxMips() (Java method), 395, 406,
414getCurrentRequestedMips() (Java method), 395, 406, 415getCurrentRequestedRam() (Java method), 395, 406, 415getCurrentRequestedRamPercentUtilization() (Java
method), 317, 323, 334getCurrentRequestedTotalMips() (Java method), 395,
406, 415getCurrentTask() (Java method), 96getCurrentTemperature() (Java method), 496getData() (Java method), 136, 143, 145getDatacenter() (Java method), 2, 5, 7, 27, 75, 152, 155,
530 Index
CloudSim Plus Documentation, Release 1.0.0
158, 186, 195, 203, 225, 233, 236, 273, 476,500
getDatacenterBroker() (Java method), 499getDatacenterBuilder() (Java method), 454getDatacenterList() (Java method), 39, 98, 100, 125, 132getDatacenterRequestedList() (Java method), 39getDatacenters() (Java method), 450getDelay(int, int) (Java method), 213, 240, 242, 243getDescription() (Java method), 396, 406, 415getDestination() (Java method), 136, 143, 145, 214, 217,
220, 222getDestNodeID() (Java method), 246getDetailBaudRate() (Java method), 217getDetailEntryTimes() (Java method), 217getDetailExitTimes() (Java method), 217getDimensions() (Java method), 507getDownlinkBandwidth() (Java method), 225, 233, 236getDownlinkSwitches() (Java method), 225, 233, 236getDownlinkSwitchPacketList(Switch) (Java method),
225, 233, 236getEdgeSwitch() (Java method), 170, 211getEndWaitingTime() (Java method), 136, 143, 145getEnergyLinearInterpolation(double, double, double)
(Java method), 251, 252getEntityList() (Java method), 101, 125, 132getEstimatedFinishTimeOfCloudlet(CloudletExecution,
double) (Java method), 323getEstimatedFinishTimeOfSoonerFinishingCloudlet(double)
(Java method), 323getExecStartTime() (Java method), 54, 68, 82getExecutionStartTime(String) (Java method), 363getExecutionStartTimes() (Java method), 363getExecutionTime() (Java method), 93getExpectedMaxPriceForSingleVm() (Java method), 505getFallbackPolicy() (Java method), 356getFallbackVmAllocationPolicy() (Java method), 18, 20getFaultToleranceLevel() (Java method), 505getFile(String) (Java method), 284, 288getFileAttribute() (Java method), 273getFileList() (Java method), 284, 288getFileName() (Java method), 511getFileNameList() (Java method), 284, 288getFilePath() (Java method), 511getFileReader(String) (Java method), 371getFileSize() (Java method), 54, 68, 82, 279, 448getFileSizeInByte() (Java method), 279getFileTransferTime() (Java method), 77getFinishedLengthSoFar() (Java method), 54, 68, 82getFinishedLengthSoFar(Datacenter) (Java method), 54,
68, 82getFinishedSoFar() (Java method), 75getFinishedVms() (Java method), 186, 195, 203getFinishTime() (Java method), 54, 68, 78, 82, 93, 426
getFirstHostFromFirstDatacenter() (Java method), 450,454
getFirstVmFromFirstBroker() (Java method), 454getFitness() (Java method), 493, 494getFormat() (Java method), 461, 471getFreePeList() (Java method), 186, 195, 203getFreePes() (Java method), 317, 324, 334getHeuristic() (Java method), 45, 486, 493, 494getHistory() (Java method), 387, 389, 391, 424getHopsList() (Java method), 218getHorizontalScaling() (Java method), 396, 406, 415getHost() (Java method), 251, 252, 343, 346, 349, 396,
406, 415, 501getHost(int) (Java method), 148, 160, 165getHostFreePesMap() (Java method), 5getHostList() (Java method), 3, 5, 8, 27, 149, 160, 165,
225, 233, 236getHostOfDatacenter(int, int) (Java method), 451, 455getHostPacketList(NetworkHost) (Java method), 225,
233, 236getHosts() (Java method), 452getId() (Java method), 46, 68, 82, 93, 104, 115, 117, 121,
152, 155, 158, 160, 195, 204, 218, 237, 293,296, 406, 415
getIdleInterval() (Java method), 396, 406, 415getIndex() (Java method), 461getInitialSolution() (Java method), 484, 488, 492getInputStream(Class, String) (Java method), 371getInstance(String) (Java method), 240, 505, 511getInstance(String, double) (Java method), 385getInstance(String, int) (Java method), 374getInterarrivalMeanTime() (Java method), 178getK() (Java method), 178getLambda() (Java method), 178getLastBuzyTime() (Java method), 396, 407, 415getLastDatacenter() (Java method), 55, 68, 82getLastDatacenterArrivalTime() (Java method), 55, 68,
82getLastExecutedDatacenterIdx() (Java method), 68getLastFailedHost() (Java method), 476getLastHop() (Java method), 218getLastProcessingTime() (Java method), 78getLastProcessTime() (Java method), 165getLastSelectedVm() (Java method), 39getLastUpdateTime() (Java method), 273, 279getLatency() (Java method), 288, 330getLength() (Java method), 55, 68, 82, 89, 96, 448getLevel() (Java method), 229, 230, 232, 234, 237getLineSeparator() (Java method), 465, 473getLinkBw() (Java method), 246getLinkDelay() (Java method), 246getLinksList() (Java method), 245getListener() (Java method), 136, 145, 500getLoessParameterEstimates(double) (Java method), 368
Index 531
CloudSim Plus Documentation, Release 1.0.0
getLowerThresholdFunction() (Java method), 432, 435,438
getMaxAvailableMips() (Java method), 186, 195, 204,343, 347, 350
getMaxClonesNumber() (Java method), 479, 481getMaxCpuUsagePercentDuringOutMigration() (Java
method), 343, 347, 350getMaxDimension() (Java method), 507getMaxHistoryEntries() (Java method), 389, 391, 424getMaximumVmMigrationTime(Host) (Java method), 23getMaxLinesToRead() (Java method), 374getMaxPower() (Java method), 251, 255getMaxPrice() (Java method), 505getMaxResourceUtilization() (Java method), 382getMaxTimeToGenerateFailureInHours() (Java method),
476getMaxTransferRate() (Java method), 284, 288, 312getMaxUtilizationAfterAllocation(Host, Vm) (Java
method), 13getMemory() (Java method), 93, 96getMemoryInMB() (Java method), 511getMetricHistory() (Java method), 10, 13, 27getMetrics() (Java method), 506getMigratableVms(Host) (Java method), 355getMinDimension() (Java method), 507getMinFaultToleranceLevel() (Java method), 506getMinimumGranularity() (Java method), 330getMinTimeBetweenEvents() (Java method), 101, 125,
132getMinUtilizationHistorySize(List) (Java method), 356getMips() (Java method), 116, 117, 152, 156, 158, 196,
204, 298, 374, 407, 415, 452, 455getMipsShareRequestedReduced(Vm, List) (Java
method), 347getMipsShareToAllocate(List, double) (Java method),
353getMipsShareToAllocate(Vm, List) (Java method), 353getName() (Java method), 46, 104, 118, 121, 161, 237,
273, 285, 288, 507, 508, 511getNeighborSolution() (Java method), 488, 490, 492getNetServiceLevel() (Java method), 55, 69, 82, 218getNetworkLatency() (Java method), 312getNetworkTopology() (Java method), 101, 126, 132getNextCloudletCompletionTime() (Java method), 502getNextEvent() (Java method), 104getNextEvent(Predicate) (Java method), 104getNodeId() (Java method), 247getNodeList() (Java method), 245getNodeName() (Java method), 247getNumberOfExpectedPacketsToReceive() (Java
method), 91getNumberOfFailedHosts() (Java method), 152, 156, 158getNumberOfFailedPes() (Java method), 186, 196, 204getNumberOfFaults() (Java method), 476
getNumberOfFaults(DatacenterBroker) (Java method),477
getNumberOfFreePes() (Java method), 153, 156, 158,187, 196, 204
getNumberOfFutureEvents(Predicate) (Java method),101, 126, 133
getNumberOfHops() (Java method), 218getNumberOfHostFaults() (Java method), 477getNumberOfLinks() (Java method), 245getNumberOfNeighborhoodSearchesByIteration() (Java
method), 488, 490, 492getNumberOfNodes() (Java method), 245getNumberOfPes() (Java method), 55, 69, 78, 83, 116,
117, 153, 156, 158, 196, 204, 407, 415getNumberOfTasks() (Java method), 96getNumberOfWorkingPes() (Java method), 187, 196, 204getNumEntities() (Java method), 101, 126, 133getNumStoredFile() (Java method), 285, 288getNumVertices() (Java method), 214getOnUpdateVmProcessingListener() (Java method), 456getOnUpdateVmsProcessingListener() (Java method),
452getOptimizedAllocationMap(List) (Java method), 3, 7–9,
14, 27getOs() (Java method), 153, 156, 158getOutput() (Java method), 364getOutputSize() (Java method), 56, 69, 83, 448getOverloadedHosts() (Java method), 14getOverloadPredicate() (Java method), 427, 429, 430getOverUtilizationThreshold(Host) (Java method), 10,
20, 23, 27, 29getOwnerName() (Java method), 274, 280getPacketList() (Java method), 225, 234, 237getPacketScheduler() (Java method), 317, 324, 334getPacketsReceived() (Java method), 91getPacketsToSend() (Java method), 92getPacketsToSend(double) (Java method), 92getPacketToHostMap() (Java method), 225, 234, 237getParameterEstimates(double) (Java method), 23getParameterEstimates(double[]) (Java method), 25getPeCapacity() (Java method), 343, 347, 350getPeList() (Java method), 187, 196, 204getPeProvisioner() (Java method), 290, 293, 296getPercentUtilization() (Java method), 300getPes() (Java method), 448, 452, 456getPeVerticalScaling() (Java method), 396, 407, 416getPk() (Java method), 214getPorts() (Java method), 225, 234, 237getPower() (Java method), 149, 161, 165, 250, 252getPower(double) (Java method), 251, 252getPowerAfterAllocation(Host, Vm) (Java method), 14getPowerAfterAllocationDifference(Host, Vm) (Java
method), 14getPowerData(int) (Java method), 255–259
532 Index
CloudSim Plus Documentation, Release 1.0.0
getPowerInKWattsHour() (Java method), 161, 250getPowerInternal(double) (Java method), 252, 255, 256getPowerModel() (Java method), 187, 196, 204getPreviousTime() (Java method), 317, 324, 334, 389,
391, 424getPreviousUtilizationOfCpu() (Java method), 187, 196,
204getPriceMetric() (Java method), 506getPricePerHour() (Java method), 511getPriority() (Java method), 56, 69, 83getProcessor() (Java method), 396, 407, 416getProvisioner(Class) (Java method), 187, 196, 205getProvisionerClass() (Java method), 454getRam() (Java method), 116, 117, 196, 205, 397, 407,
416, 452, 456getRamProvisioner() (Java method), 187, 196, 205getRamVerticalScaling() (Java method), 397, 407, 416getRandom() (Java method), 490getRandomGenerator() (Java method), 387getRandomMapEntries() (Java method), 486getRandomRecoveryTimeForVmInSecs() (Java method),
477getRandomValue(int) (Java method), 489, 490, 492getReceivedPacketList() (Java method), 426getReceiverCloudlet() (Java method), 223getReceiveTime() (Java method), 214, 218, 221, 222getRegistrationID() (Java method), 274, 280getRemainingCloudletLength() (Java method), 78getRequestedCpuPercentUtilization(double) (Java
method), 317, 324, 334getRequestedMips() (Java method), 209, 421getRequestedMips(Vm) (Java method), 343, 347, 350getRequestedMipsForCloudlet(CloudletExecution, dou-
ble) (Java method), 317, 324, 334getRequestedMipsMap() (Java method), 347getRequiredFiles() (Java method), 56, 69, 83getResource() (Java method), 262, 266, 268, 269, 432,
435, 438getResource(Class) (Java method), 310getResourceAllocationMap() (Java method), 268getResourceAmountToScale() (Java method), 432, 436,
438getResourceAmountToScale(VerticalVmScaling) (Java
method), 443, 444getResourceClass() (Java method), 268, 432, 436, 438getResourceList(Class, String) (Java method), 372getResourcePath(Class, String) (Java method), 372getResources() (Java method), 117, 197, 205, 310, 397,
407, 416getResourceUrl(Class, String) (Java method), 372getResourceUsageThresholdFunction() (Java method),
432, 436, 438getResult() (Java method), 486, 494
getRobustLoessParameterEstimates(double) (Javamethod), 368
getRows() (Java method), 459getSafetyParameter() (Java method), 18, 20getScalingFactor() (Java method), 433, 436, 438getSchedulingInterval() (Java method), 24, 149, 161, 166,
385, 451getSeed() (Java method), 171–173, 178getSenderCloudlet() (Java method), 223getSendTime() (Java method), 215, 218, 221, 223getSerial() (Java method), 137, 143, 145getSimulation() (Java method), 46, 56, 69, 83, 105, 116–
118, 121, 137, 143, 146, 161, 197, 205, 237,378, 379, 384, 407, 416, 455
getSize() (Java method), 215, 218, 221, 223, 274, 456getSizeInByte() (Java method), 274getSolveTime() (Java method), 489, 490, 492getSource() (Java method), 137, 143, 146, 215, 218, 221,
223getSourceVm() (Java method), 91getSrcNodeID() (Java method), 246getStartTime() (Java method), 94, 397, 407, 416getState() (Java method), 105getStateHistory() (Java method), 188, 197, 205, 397, 407,
416getStaticPower() (Java method), 255getStaticPowerPercent() (Java method), 255getStatistics(double) (Java method), 369getStatistics(List) (Java method), 368getStatus() (Java method), 56, 69, 83, 290, 294, 296getStopTime() (Java method), 397, 408, 416getStorage() (Java method), 116, 117, 197, 205, 397, 408,
416, 453getStorageList() (Java method), 149, 161, 166getSubmissionDelay() (Java method), 69, 83, 115, 408,
416getSubTitle() (Java method), 461, 471getSwitchedOffHosts() (Java method), 14getSwitchingDelay() (Java method), 225, 234, 237getSwitchMap() (Java method), 170getTable() (Java method), 462, 464, 471getTag() (Java method), 137, 143, 146, 219getTaskCompletionTimeMetric() (Java method), 506getTasks() (Java method), 96getTime() (Java method), 137, 146, 209, 422, 500getTimeHistory() (Java method), 10, 14, 27getTimeSlice() (Java method), 78getTimeSpan() (Java method), 382getTimeZone() (Java method), 153, 156, 158getTimezone() (Java method), 451getTitle() (Java method), 459, 462, 470, 472getTopologycalGraph() (Java method), 240, 242, 243getTotalAllocatedMipsForVm(Vm) (Java method), 188,
197, 205, 343, 347, 350
Index 533
CloudSim Plus Documentation, Release 1.0.0
getTotalAllocatedResource() (Java method), 261, 262,266, 268, 269
getTotalCost() (Java method), 56, 69, 83getTotalCpuMipsUsage(double) (Java method), 398, 408,
417getTotalDataTransferBytes() (Java method), 211getTotalExecutedLength() (Java method), 90getTotalExecutionTime() (Java method), 398, 408, 417getTotalLength() (Java method), 57, 69, 83getTotalMips() (Java method), 298getTotalMipsCapacity() (Java method), 116, 117, 188,
197, 205, 408, 417getTotalResponseTime() (Java method), 219getTransactionTime() (Java method), 274getTricubeBisquareWeights(double) (Java method), 369getTricubeWeights(int) (Java method), 369getType() (Java method), 137, 143, 146, 274, 280getUid() (Java method), 69, 83, 135, 408, 417getUid(int, int) (Java method), 135getUnderUtilizationThreshold() (Java method), 10, 15, 28getUnit() (Java method), 378, 379, 384, 508getUplinkBandwidth() (Java method), 225, 234, 237getUplinkSwitches() (Java method), 226, 235, 238getUplinkSwitchPacketList(Switch) (Java method), 226,
234, 237getUplinkSwitchPacketMap() (Java method), 226, 235,
237getUpperThresholdFunction() (Java method), 433, 436,
438getUsedPes() (Java method), 318, 324, 334getUtilization() (Java method), 261, 263, 264, 378, 380,
382–384getUtilization(double) (Java method), 378, 382–384, 386,
387getUtilizationHistory() (Java method), 10, 15, 28, 188,
197, 205, 398, 408, 417getUtilizationMad() (Java method), 390, 391, 424getUtilizationMatrix(List) (Java method), 357getUtilizationMean() (Java method), 390, 391, 424getUtilizationModelBw() (Java method), 57, 70, 83getUtilizationModelCpu() (Java method), 57, 70, 84getUtilizationModelRam() (Java method), 57, 70, 84getUtilizationOfBw() (Java method), 57, 70, 84, 188, 197,
205getUtilizationOfBw(double) (Java method), 57, 70, 84getUtilizationOfCpu() (Java method), 58, 70, 84, 188,
197, 206getUtilizationOfCpu(double) (Java method), 58, 70, 84getUtilizationOfCpuMips() (Java method), 189, 197, 206getUtilizationOfCpuMips(Host) (Java method), 15getUtilizationOfRam() (Java method), 58, 70, 84, 189,
197, 206getUtilizationOfRam(double) (Java method), 58, 70, 84getUtilizationVariance() (Java method), 390, 391, 424
getValue() (Java method), 508getVirtualRuntime() (Java method), 78getVm() (Java method), 59, 70, 84, 298, 318, 324, 334,
338–340, 429, 436, 440–442, 503getVm(int, int) (Java method), 189, 198, 206getVmAllocationPolicy() (Java method), 149, 161, 166getVmBuilder() (Java method), 446getVmById(int) (Java method), 456getVmCost(Map.Entry) (Java method), 486getVmCost(Vm, List) (Java method), 486getVmCreatedList() (Java method), 33, 39, 47, 189, 198,
206getVmCreationAcks() (Java method), 39getVmCreationRequests() (Java method), 39getVmDatacenter(Vm) (Java method), 39getVmDestructionDelayFunction() (Java method), 34, 40,
47getVmEdgeSwitch(Vm) (Java method), 226getVmExecList() (Java method), 34, 40, 47getVmFromBroker(int, int) (Java method), 455getVmFromCreatedList(int) (Java method), 40getVmHost(Vm) (Java method), 226getVmList() (Java method), 150, 161, 166, 189, 198, 206,
482–484getVmm() (Java method), 153, 156, 159, 398, 408, 417getVmMigrationCpuOverhead() (Java method), 344, 347,
350getVmPacket() (Java method), 215getVmPacketsToSend() (Java method), 338–340getVms() (Java method), 456getVmScheduler() (Java method), 189, 198, 206getVmSchedulerClass() (Java method), 453getVmSelectionPolicy() (Java method), 15getVmsMigratingIn() (Java method), 190, 198, 206getVmsMigratingOut() (Java method), 190, 198, 206getVmsToMigrateFromUnderUtilizedHost(Host) (Java
method), 15getVmSupplier() (Java method), 428–430getVmToMigrate(Host) (Java method), 355, 357, 358getVmWaitingList() (Java method), 34, 40, 47getWaitingTime() (Java method), 59, 70, 84getWaitingVm(int) (Java method), 34, 40, 47getWaitTimeMetric() (Java method), 506getWallClockTime() (Java method), 75getWallClockTime(Datacenter) (Java method), 59, 71, 84getWallClockTimeInLastExecutedDatacenter() (Java
method), 59, 71, 85getWorkingPeList() (Java method), 190, 198, 206, 344,
347, 350getWorldCoordinates() (Java method), 248getX() (Java method), 244getY() (Java method), 244GIBABYTE (Java field), 359
534 Index
CloudSim Plus Documentation, Release 1.0.0
HHarddriveStorage (Java class), 286HarddriveStorage(long) (Java constructor), 286HarddriveStorage(String, long) (Java constructor), 286hasFinishedCloudlets() (Java method), 318, 324, 334hashCode() (Java method), 71, 78, 105, 166, 206, 417,
422hasPotentialAvailableSpace(int) (Java method), 285, 288Heuristic (Java interface), 487HeuristicAbstract (Java class), 489HeuristicAbstract(ContinuousDistribution, Class) (Java
constructor), 490HeuristicNull (Java class), 491HeuristicSolution (Java interface), 493HeuristicSolutionNull (Java class), 494history (Java field), 423HOLD_DONE (Java field), 144holdEntity(SimEntity, long) (Java method), 101, 126, 133HOLDING (Java field), 121HorizontalVmScaling (Java interface), 427HorizontalVmScalingNull (Java class), 429HorizontalVmScalingSimple (Java class), 430HorizontalVmScalingSimple() (Java constructor), 430Host (Java interface), 183HOST_FAILURE (Java field), 112HostBuilder (Java class), 452HostBuilder() (Java constructor), 452HostEventInfo (Java interface), 501HostFaultInjection (Java class), 474HostFaultInjection(Datacenter, ContinuousDistribution)
(Java constructor), 475HostNull (Java class), 193HostPacket (Java class), 214HostPacket(NetworkHost, VmPacket) (Java constructor),
214HostSimple (Java class), 200HostSimple(long, long, long, List) (Java constructor), 200HostSimple(ResourceProvisioner, ResourceProvisioner,
long, List, VmScheduler) (Java constructor),201
HostStateHistoryEntry (Java class), 209HostStateHistoryEntry(double, double, double, boolean)
(Java constructor), 209HostUpdatesVmsProcessingEventInfo (Java interface),
502HtmlTableBuilder (Java class), 466HtmlTableBuilder() (Java constructor), 467HtmlTableBuilder(String) (Java constructor), 467HtmlTableColumn (Java class), 467HtmlTableColumn(String) (Java constructor), 468HtmlTableColumn(String, String) (Java constructor), 468HtmlTableColumn(TableBuilder, String) (Java construc-
tor), 468
HtmlTableColumn(TableBuilder, String, String) (Javaconstructor), 468
HUNDRED_PERCENT (Java field), 359, 367
IICMP_PKT_RETURN (Java field), 112ICMP_PKT_SUBMIT (Java field), 112IcmpPacket (Java class), 216IcmpPacket(String, int, long, SimEntity, SimEntity, int)
(Java constructor), 216Identificable (Java interface), 115INEXEC (Java field), 65INFO (Java field), 366INSTANTIATED (Java field), 65iqr(double) (Java method), 369isActive() (Java method), 94, 190, 198, 207, 209isAllowedToAllocateMips(List) (Java method), 344, 348,
350, 354isApplyAntitheticVariatesTechnique() (Java method), 180isAssignedToDatacenter() (Java method), 59, 71, 85isBindToVm() (Java method), 59, 71, 85isBuzy() (Java method), 290, 294, 296isCloudletReturned(Cloudlet) (Java method), 318, 324,
334isCreated() (Java method), 398, 408, 417isDebug() (Java method), 364isDeleted() (Java method), 274isDisabled() (Java method), 364isEmpty() (Java method), 138, 139, 141, 318, 324, 334isEnabled() (Java method), 364, 390, 391, 424isExecutionTask() (Java method), 94isFailed() (Java method), 190, 198, 207, 291, 294, 296,
399, 408, 417isFinished() (Java method), 60, 71, 85, 94, 96isFree() (Java method), 291, 294, 296, 426isFull() (Java method), 288, 294, 300, 308, 310isHostOverloaded(Host) (Java method), 11, 15, 20, 24, 28isHostUnderloaded(Host) (Java method), 11, 16, 28isInMigration() (Java method), 399, 409, 417, 422isLastColumn() (Java method), 462isMasterCopy() (Java method), 275, 280isMaxClonesNumberReached() (Java method), 480, 481isMaxValue() (Java method), 509isMigrationsEnabled() (Java method), 166isMinValue() (Java method), 509isNetworkEnabled() (Java method), 241–243isNotAllVmsMigratingOut(Host) (Java method), 16isNotHostOverloadedAfterAllocation(Host, Vm) (Java
method), 16isObjectSubClassOf(Class) (Java method), 300isObjectSubClassOf(Object, Class) (Java method), 300isPaused() (Java method), 101, 126, 133isPercent() (Java method), 509isReceiveTask() (Java method), 94
Index 535
CloudSim Plus Documentation, Release 1.0.0
isRegistered() (Java method), 275, 280isResourceAllocatedToVm(Vm) (Java method), 263, 266,
268, 269isResourceAmountAvailable(double) (Java method), 289,
294, 301, 302, 309isResourceAmountAvailable(long) (Java method), 289,
294, 301, 302, 309, 310isResourceAmountAvailable(Resource) (Java method),
300isResourceAmountBeingUsed(long) (Java method), 294,
302, 304, 309isRunning() (Java method), 101, 126, 133isSendTask() (Java method), 94isStarted() (Java method), 47, 105, 118, 121, 161, 238isStateHistoryEnabled() (Java method), 190, 198, 207isSuitable(long) (Java method), 294, 302, 305, 309isSuitableForVm(List) (Java method), 344, 350, 351, 353isSuitableForVm(Vm) (Java method), 190, 198, 207, 344,
348, 350isSuitableForVm(Vm, long) (Java method), 263, 266,
269, 271isTasksStarted() (Java method), 97isThereEnoughFreePesForCloudlet(CloudletExecution)
(Java method), 325isTherePacketScheduler() (Java method), 318, 325, 335isThereWaitingCloudlets() (Java method), 34, 40, 47isTimeToCheckPredicate(double) (Java method), 441isTimeToUpdateCloudletProcessing(Cloudlet) (Java
method), 338–340isToStopSearch() (Java method), 489, 492, 496isValid(File) (Java method), 275isValid(String) (Java method), 275, 280isVmOverloaded() (Java method), 433, 436, 439isVmUnderloaded() (Java method), 433, 436, 439isWorking() (Java method), 153, 156, 159, 291, 294, 296,
399, 409, 417iterator() (Java method), 138, 140, 141
KKILOBYTE (Java field), 359
LLevel (Java enum), 366LEVEL (Java field), 228, 230, 231loadHistory(String) (Java method), 387Log (Java class), 363LognormalDistr (Java class), 174LognormalDistr(double, double) (Java constructor), 174LognormalDistr(long, double, double) (Java constructor),
174LomaxDistr (Java class), 175LomaxDistr(double, double, double) (Java constructor),
175
LomaxDistr(long, double, double, double) (Java construc-tor), 175
MMachine (Java interface), 115MachineNull (Java class), 117mad(double) (Java method), 369main(String[]) (Java method), 178, 506, 511makeMasterCopy() (Java method), 275makeReplica() (Java method), 275mapNode(int, int) (Java method), 241–243MASTERFILE_ADD_RESULT (Java field), 362MathUtil (Java class), 367mean(List) (Java method), 370meanTimeBetweenHostFaultsInMinutes() (Java method),
477meanTimeBetweenVmFaultsInMinutes() (Java method),
477meanTimeBetweenVmFaultsInMinutes(DatacenterBroker)
(Java method), 477meanTimeToRepairVmFaultsInMinutes() (Java method),
478meanTimeToRepairVmFaultsInMinutes(DatacenterBroker)
(Java method), 478median(double) (Java method), 370median(List) (Java method), 370MEGABYTE (Java field), 359MILLION (Java field), 359MIN_DIFF (Java field), 484moveNextCloudletsFromWaitingToExecList() (Java
method), 325, 330
NNameable (Java interface), 118NETWORK_EVENT_DOWN (Java field), 112NETWORK_EVENT_HOST (Java field), 112NETWORK_EVENT_SEND (Java field), 112NETWORK_EVENT_UP (Java field), 112NETWORK_HOST_REGISTER (Java field), 112NetworkCloudlet (Java class), 95NetworkCloudlet(int, long, int) (Java constructor), 95NetworkDatacenter (Java class), 169NetworkDatacenter(Simulation, List, VmAllocationPol-
icy) (Java constructor), 170networkDelayForPacketTransmission(HostPacket, dou-
ble, List) (Java method), 226NetworkHost (Java class), 210NetworkHost(long, long, long, List) (Java constructor),
210NetworkHost(long, long, long, List, VmScheduler) (Java
constructor), 210NetworkPacket (Java interface), 220NetworkTopology (Java interface), 241NetworkTopologyNull (Java class), 242
536 Index
CloudSim Plus Documentation, Release 1.0.0
NetworkVm (Java class), 425NetworkVm(int, DatacenterBroker, long, int, int, long,
long, String, CloudletScheduler) (Java con-structor), 425
NetworkVm(int, long, int) (Java constructor), 425newRow() (Java method), 459, 470NormalDistr (Java class), 175NormalDistr(double, double) (Java constructor), 176NormalDistr(long, double, double) (Java constructor),
176NOT_ASSIGNED (Java field), 51NOT_REGISTERED (Java field), 271notifyOnCreationFailureListeners(Datacenter) (Java
method), 399, 409, 418notifyOnHostAllocationListeners() (Java method), 399,
409, 418notifyOnHostDeallocationListeners(Host) (Java method),
399, 409, 418notifyOnUpdateProcessingListeners() (Java method), 418notifyOnUpdateProcessingListeners(double) (Java
method), 60, 71, 85NULL (Java field), 1, 10, 32, 51, 74, 76, 115, 118, 123,
142, 145, 147, 151, 171, 183, 232, 241, 251,260, 264, 290, 297, 299, 303, 313, 337, 341,377, 389, 392, 427, 431, 440, 443, 479, 482,487, 493, 501, 507, 510
numEventsWaiting() (Java method), 105numEventsWaiting(Predicate) (Java method), 105
Oof(EventListener, Cloudlet) (Java method), 498of(EventListener, Cloudlet, Vm) (Java method), 498of(EventListener, DatacenterBroker) (Java method), 499of(EventListener, double) (Java method), 500of(EventListener, double, Cloudlet) (Java method), 498of(EventListener, double, Cloudlet, Vm) (Java method),
499of(EventListener, Host, double) (Java method), 502of(EventListener, Vm) (Java method), 502, 504of(EventListener, Vm, Datacenter) (Java method), 503of(EventListener, Vm, Host) (Java method), 504org.cloudbus.cloudsim.allocationpolicies (package), 1org.cloudbus.cloudsim.allocationpolicies.migration
(package), 9org.cloudbus.cloudsim.brokers (package), 31org.cloudbus.cloudsim.cloudlets (package), 51org.cloudbus.cloudsim.cloudlets.network (package), 89org.cloudbus.cloudsim.core (package), 97org.cloudbus.cloudsim.core.events (package), 135org.cloudbus.cloudsim.datacenters (package), 147org.cloudbus.cloudsim.datacenters.network (package),
169org.cloudbus.cloudsim.distributions (package), 171org.cloudbus.cloudsim.hosts (package), 182
org.cloudbus.cloudsim.hosts.network (package), 210org.cloudbus.cloudsim.network (package), 212org.cloudbus.cloudsim.network.switches (package), 224org.cloudbus.cloudsim.network.topologies (package),
239org.cloudbus.cloudsim.network.topologies.readers (pack-
age), 248org.cloudbus.cloudsim.power.models (package), 249org.cloudbus.cloudsim.provisioners (package), 260org.cloudbus.cloudsim.resources (package), 271org.cloudbus.cloudsim.schedulers.cloudlet (package),
312org.cloudbus.cloudsim.schedulers.cloudlet.network
(package), 337org.cloudbus.cloudsim.schedulers.vm (package), 341org.cloudbus.cloudsim.selectionpolicies.power (pack-
age), 355org.cloudbus.cloudsim.util (package), 358org.cloudbus.cloudsim.utilizationmodels (package), 377org.cloudbus.cloudsim.vms (package), 388org.cloudbus.cloudsim.vms.network (package), 425org.cloudsimplus.autoscaling (package), 427org.cloudsimplus.autoscaling.resources (package), 442org.cloudsimplus.builders (package), 444org.cloudsimplus.builders.tables (package), 457org.cloudsimplus.faultinjection (package), 474org.cloudsimplus.heuristics (package), 481org.cloudsimplus.listeners (package), 497org.cloudsimplus.slametrics (package), 504org.cloudsimplus.vmtemplates (package), 509
PPacketScheduler (Java interface), 337PacketSchedulerNull (Java class), 339PacketSchedulerSimple (Java class), 340PacketSchedulerSimple() (Java constructor), 340ParetoDistr (Java class), 176ParetoDistr(double, double) (Java constructor), 176ParetoDistr(long, double, double) (Java constructor), 176pause() (Java method), 101, 127, 133pause(double) (Java method), 101, 105, 127, 133PAUSED (Java field), 65pauseEntity(SimEntity, double) (Java method), 101, 127,
133Pe (Java interface), 290PeBuilder (Java class), 453PeNull (Java class), 292PeProvisioner (Java interface), 260PeProvisionerNull (Java class), 262PeProvisionerSimple (Java class), 263PeProvisionerSimple() (Java constructor), 263PeProvisionerSimple(Pe) (Java constructor), 263PERCENTAGE (Java field), 379percentOfMipsToRequest(Vm) (Java method), 348
Index 537
CloudSim Plus Documentation, Release 1.0.0
PeSimple (Java class), 295PeSimple(double, PeProvisioner) (Java constructor), 295PeSimple(int, double, PeProvisioner) (Java constructor),
296PKT_SIZE (Java field), 362Point2D (Java class), 243Point2D() (Java constructor), 243Point2D(int, int) (Java constructor), 243PoissonDistr (Java class), 177PoissonDistr(double) (Java constructor), 177PoissonDistr(double, long) (Java constructor), 177PORTS (Java field), 228, 230, 231PowerAware (Java interface), 250PowerModel (Java interface), 250PowerModelAbstract (Java class), 252PowerModelCubic (Java class), 253PowerModelCubic(double, double) (Java constructor),
253PowerModelLinear (Java class), 253PowerModelLinear(double, double) (Java constructor),
254PowerModelSimple (Java class), 254PowerModelSimple(double, double, UnaryOperator)
(Java constructor), 254PowerModelSpecPower (Java class), 255PowerModelSpecPowerHpProLiantMl110G3PentiumD930
(Java class), 256PowerModelSpecPowerHpProLiantMl110G4Xeon3040
(Java class), 256PowerModelSpecPowerHpProLiantMl110G5Xeon3075
(Java class), 257PowerModelSpecPowerIbmX3250XeonX3470 (Java
class), 257PowerModelSpecPowerIbmX3250XeonX3480 (Java
class), 258PowerModelSpecPowerIbmX3550XeonX5670 (Java
class), 258PowerModelSpecPowerIbmX3550XeonX5675 (Java
class), 258PowerModelSqrt (Java class), 259PowerModelSqrt(double, double) (Java constructor), 259PowerModelSquare (Java class), 259PowerModelSquare(double, double) (Java constructor),
260PowerVmSelectionPolicy (Java class), 355PowerVmSelectionPolicyMaximumCorrelation (Java
class), 356PowerVmSelectionPolicyMaximumCorrelation(PowerVmSelectionPolicy)
(Java constructor), 356PowerVmSelectionPolicyMinimumMigrationTime (Java
class), 357PowerVmSelectionPolicyMinimumUtilization (Java
class), 358PowerVmSelectionPolicyRandomSelection (Java class),
358PowerVmSelectionPolicyRandomSelection() (Java con-
structor), 358PredicateType (Java class), 141PredicateType(int) (Java constructor), 142predictFileTransferTime(List) (Java method), 166previousTime (Java field), 423print() (Java method), 459, 470print(Object) (Java method), 364print(String) (Java method), 364printColumnHeaders() (Java method), 459, 473printConcatLine(Object) (Java method), 364printFormatted(String, Object) (Java method), 365printFormattedLine(String, Object) (Java method), 365printLine() (Java method), 365printLine(Object) (Java method), 365printLine(String) (Java method), 365println() (Java method), 119println(Level, Class, double, String, Object) (Java
method), 365println(String) (Java method), 47, 106, 119, 121, 161, 238printRowClosing() (Java method), 459, 465, 467printRowOpening() (Java method), 459, 465, 467printTableClosing() (Java method), 459, 465, 467, 473printTableOpening() (Java method), 459, 465, 467, 473printTitle() (Java method), 459, 465, 467, 473process(long) (Java method), 90processCloudlet(SimEvent, int) (Java method), 166processCloudletCancel(Cloudlet) (Java method), 167processCloudletPackets(Cloudlet, double) (Java method),
338, 340, 341processCloudletPause(Cloudlet, boolean) (Java method),
167processCloudletResume(Cloudlet, boolean) (Java
method), 167processCloudletReturn(SimEvent) (Java method), 40processCloudletSubmit(CloudletExecution, double) (Java
method), 325, 331processCloudletSubmit(SimEvent, boolean) (Java
method), 167, 171processDatacenterListRequest(SimEvent) (Java method),
40processEvent(SimEvent) (Java method), 41, 47, 98, 119,
122, 161, 167, 226, 238, 478processFailedVmCreationInDatacenter(Vm, Datacenter)
(Java method), 41processHostPacket(SimEvent) (Java method), 227Processor (Java class), 297Processor(Vm, double, long) (Java constructor), 297processPacketDown(SimEvent) (Java method), 227, 229,
230processPacketUp(SimEvent) (Java method), 227, 229,
230, 232processPingRequest(SimEvent) (Java method), 167
538 Index
CloudSim Plus Documentation, Release 1.0.0
processSuccessVmCreationInDatacenter(Vm, Datacen-ter) (Java method), 41
processVmCreate(SimEvent, boolean) (Java method),168, 171
processVmCreateResponseFromDatacenter(SimEvent)(Java method), 41
processVmDestroy(SimEvent, boolean) (Java method),168
QQUEUED (Java field), 65
RRam (Java class), 299Ram(long) (Java constructor), 299readGraphFile(InputStreamReader) (Java method), 249readGraphFile(String) (Java method), 248, 249readGZIPFile(InputStream) (Java method), 374readTextFile(InputStream) (Java method), 375READY (Java field), 65readZipFile(InputStream) (Java method), 375reallocateMigratingInVms() (Java method), 191, 199, 207receivePacket(VmPacket) (Java method), 91REGISTER_REGIONAL_CIS (Java field), 113registerArrivalInDatacenter() (Java method), 60, 71, 85remove(SimEvent) (Java method), 138, 141removeAll(Collection) (Java method), 141removeCapacity(long) (Java method), 294, 305, 307, 309removeCloudletFromExecList(CloudletExecution) (Java
method), 325removeMigratingInVm(Vm) (Java method), 191, 199,
207removeOnClockTickListener(EventListener) (Java
method), 102, 127, 133removeOnCreationFailureListener(EventListener) (Java
method), 400, 409, 418removeOnEventProcessingListener(EventListener) (Java
method), 102, 127, 133removeOnFinishListener(EventListener) (Java method),
60, 71, 85removeOnHostAllocationListener(EventListener) (Java
method), 400, 409, 418removeOnHostDeallocationListener(EventListener) (Java
method), 400, 409, 418removeOnSimulationPausedListener(EventListener)
(Java method), 102, 128, 133removeOnUpdateProcessingListener(EventListener)
(Java method), 60, 71, 85, 191, 199, 207, 400,409, 418
removePesFromMap(Vm, Map, int) (Java method), 348removeUsedPes(Vm) (Java method), 5removeVmMigratingIn(Vm) (Java method), 191, 199,
207
removeVmMigratingOut(Vm) (Java method), 191, 199,207
renameFile(File, String) (Java method), 285, 289REQUEST_REGIONAL_CIS (Java field), 113requestCreationOfWaitingVmsToFallbackDatacenter()
(Java method), 41requestDatacentersToCreateWaitingCloudlets() (Java
method), 42, 45requestDatacenterToCreateWaitingVms() (Java method),
41requestDatacenterToCreateWaitingVms(Datacenter)
(Java method), 42requestIdleVmsDestruction(Function) (Java method), 42requestShutDown() (Java method), 42requestUpScaling(double) (Java method), 430, 439, 441requestUpScalingIfPredicateMatches(VmHostEventInfo)
(Java method), 428–430, 433, 436, 439, 440,442
requiresFiles() (Java method), 60, 71, 85reserveSpace(int) (Java method), 285, 289Resource (Java interface), 299ResourceAbstract (Java class), 301ResourceAbstract(long) (Java constructor), 301ResourceCapacity (Java interface), 302Resourceful (Java interface), 310ResourceLoader (Java class), 371ResourceManageable (Java interface), 302ResourceManageableAbstract (Java class), 306ResourceManageableAbstract(long) (Java constructor),
306ResourceManageableNull (Java class), 308ResourceNull (Java class), 309ResourceProvisioner (Java interface), 264ResourceProvisionerAbstract (Java class), 267ResourceProvisionerAbstract() (Java constructor), 267ResourceProvisionerAbstract(ResourceManageable)
(Java constructor), 267ResourceProvisionerNull (Java class), 268ResourceProvisionerSimple (Java class), 270ResourceProvisionerSimple() (Java constructor), 270ResourceProvisionerSimple(ResourceManageable) (Java
constructor), 270ResourceScaling (Java interface), 442ResourceScalingGradual (Java class), 443ResourceScalingInstantaneous (Java class), 443resume() (Java method), 102, 128, 134RESUMED (Java field), 65RM_BASE (Java field), 362RootSwitch (Java class), 231RootSwitch(CloudSim, NetworkDatacenter) (Java con-
structor), 231run() (Java method), 47, 106, 119, 122, 162, 238RUNNABLE (Java field), 121runningCloudletsNumber() (Java method), 318, 326, 335
Index 539
CloudSim Plus Documentation, Release 1.0.0
Ssample() (Java method), 171–173, 175, 178, 180, 182sample(Random, double, double) (Java method), 180SanStorage (Java class), 310SanStorage(long, double, double) (Java constructor), 311SanStorage(String, long, double, double) (Java construc-
tor), 311saveHistory(String) (Java method), 387scaleVmVertically(VerticalVmScaling) (Java method), 3,
5, 8, 28schedule(SimEntity, double, int) (Java method), 47, 106,
119, 122, 162, 238schedule(SimEntity, double, int, Object) (Java method),
106scheduledBy() (Java method), 137, 144, 146scheduleFirst(SimEntity, double, int) (Java method), 106scheduleFirst(SimEntity, double, int, Object) (Java
method), 106scheduleFirstNow(SimEntity, int) (Java method), 107scheduleFirstNow(SimEntity, int, Object) (Java method),
107scheduleNow(SimEntity, int) (Java method), 107scheduleNow(SimEntity, int, Object) (Java method), 107select(SimEntity, Predicate) (Java method), 102, 128, 134selectDatacenterForWaitingVms() (Java method), 50selectEvent(Predicate) (Java method), 107selectFallbackDatacenterForWaitingVms() (Java
method), 50selectVmForWaitingCloudlet(Cloudlet) (Java method),
45, 50SEND (Java field), 145send(SimEntity, double, int) (Java method), 108send(SimEntity, double, int, Object) (Java method), 108send(SimEntity, SimEntity, double, int, Object) (Java
method), 102, 128, 134sendFirst(SimEntity, SimEntity, double, int, Object) (Java
method), 102, 128, 134sendNow(SimEntity, int) (Java method), 108sendNow(SimEntity, int, Object) (Java method), 108sendNow(SimEntity, SimEntity, int, Object) (Java
method), 102, 129, 134setAccumulatedBwCost(double) (Java method), 72setActive(boolean) (Java method), 191, 199, 207setActualCpuTime(double) (Java method), 75setAllocatedMips(double) (Java method), 422setAllocatedResource(double) (Java method), 305setAllocatedResource(long) (Java method), 295, 305,
307, 309setApplyAntitheticVariatesTechnique(boolean) (Java
method), 181setArchitecture(String) (Java method), 153, 156, 159setArrivalTime(double) (Java method), 75setAvailableResource(long) (Java method), 307setAvgSeekTime(double) (Java method), 289
setAvgSeekTime(double, ContinuousDistribution) (Javamethod), 289
setBandwidth(double) (Java method), 211setBandwidthPercentForMigration(double) (Java
method), 150, 162, 168setBestSolutionSoFar(S) (Java method), 491setBroker(DatacenterBroker) (Java method), 61, 72, 85,
114, 400, 409, 418setBw(long) (Java method), 401, 409, 418, 453, 456setBwProvisioner(ResourceProvisioner) (Java method),
192, 199, 207setBwVerticalScaling(VerticalVmScaling) (Java method),
401, 410, 419setCapacity(double) (Java method), 291, 295, 297setCapacity(long) (Java method), 291, 295, 298, 306, 307,
309setChecksum(int) (Java method), 276, 280setCloudlet(NetworkCloudlet) (Java method), 94setCloudletComparator(Comparator) (Java method), 34,
42, 48setCloudletList(List) (Java method), 426, 464, 482–484setCloudletScheduler(CloudletScheduler) (Java method),
401, 410, 419setCloudletSchedulerSupplier(Supplier) (Java method),
456setCloudletsClonerFunction(Function) (Java method),
480, 481setCloudletStatus(Cloudlet.Status) (Java method), 79setColdTemperature(double) (Java method), 496setColumnSeparator(String) (Java method), 460, 470setComment(String) (Java method), 375setCoolingRate(double) (Java method), 496setCost(double) (Java method), 276, 281setCostPerBw(double) (Java method), 72, 154, 156, 159setCostPerBwMegabit(double) (Java method), 451setCostPerCpuSecond(double) (Java method), 451setCostPerMem(double) (Java method), 154, 156, 159,
451setCostPerSec(double) (Java method), 75setCostPerSecond(double) (Java method), 154, 157, 159setCostPerStorage(double) (Java method), 154, 157, 159,
451setCpus(int) (Java method), 512setCreated(boolean) (Java method), 401, 410, 419setCreationTime(long) (Java method), 281setCurrentMipsShare(List) (Java method), 326setCurrentTemperature(double) (Java method), 497setDatacenter(Datacenter) (Java method), 3, 6, 8, 28, 75,
192, 199, 208, 276, 478setDatacenter(NetworkDatacenter) (Java method), 227,
235, 238setDatacenterList(Set) (Java method), 42setDatacenterSupplier(Supplier) (Java method), 35, 43,
48
540 Index
CloudSim Plus Documentation, Release 1.0.0
setDeleted(boolean) (Java method), 276setDescription(String) (Java method), 401, 410, 419setDestination(NetworkHost) (Java method), 215setDestination(SimEntity) (Java method), 137, 144, 146,
219setDestination(T) (Java method), 221setDestination(Vm) (Java method), 223setDimensions(List) (Java method), 507setDisabled(boolean) (Java method), 366setDownlinkBandwidth(double) (Java method), 227, 235,
238setEdgeSwitch(EdgeSwitch) (Java method), 212setEventBuffer(SimEvent) (Java method), 109setExecStartTime(double) (Java method), 61, 72, 85setFailed(boolean) (Java method), 192, 199, 208, 402,
410, 419setFallbackDatacenterSupplier(Supplier) (Java method),
35, 43, 48setFallbackPolicy(PowerVmSelectionPolicy) (Java
method), 357setFallbackVmAllocationPolicy(VmAllocationPolicyMigration)
(Java method), 19, 20setField(int, int, int, int, int) (Java method), 375setFileSize(int) (Java method), 281setFileSize(long) (Java method), 61, 72, 86, 448setFileTransferTime(double) (Java method), 79setFindHostForVmFunction(BiFunction) (Java method),
3, 6, 8, 28setFinished(boolean) (Java method), 94setFinishedLengthSoFar(long) (Java method), 61, 72, 86setFinishedSoFar(long) (Java method), 76setFinishTime(double) (Java method), 72, 79, 426setFormat(String) (Java method), 462, 472setFree(boolean) (Java method), 426setHeuristic(CloudletToVmMappingHeuristic) (Java
method), 45setHistory(Map) (Java method), 388setHorizontalScaling(HorizontalVmScaling) (Java
method), 402, 410, 419setHost(Host) (Java method), 252, 253, 345, 349–351,
402, 410, 419setHostFreePesMap(Map) (Java method), 6setId(int) (Java method), 72, 86, 95, 97, 109, 118, 199,
208, 291, 295, 297, 410, 419setIdForEntitiesWithoutOne(List) (Java method), 129setIdForEntitiesWithoutOne(List, T) (Java method), 129setInMigration(boolean) (Java method), 402, 410, 419,
422setK(int) (Java method), 179setLastExecutedDatacenterIdx(int) (Java method), 73setLastHop(SimEntity) (Java method), 219setLastProcessingTime(double) (Java method), 79, 441setLastProcessTime(double) (Java method), 168setLatency(double) (Java method), 289
setLatency(int) (Java method), 331setLength(long) (Java method), 61, 73, 86, 90, 448setLog(boolean) (Java method), 48, 109, 119, 122, 162,
238setLowerThresholdFunction(Function) (Java method),
434, 436, 439setMasterCopy(boolean) (Java method), 276, 281setMaxClonesNumber(int) (Java method), 480, 481setMaxHistoryEntries(int) (Java method), 390, 392, 424setMaxLinesToRead(int) (Java method), 376setMaxResourceUtilization(double) (Java method), 382setMaxTimeToGenerateFailureInHours(double) (Java
method), 478setMaxTransferRate(int) (Java method), 285, 290setMemory(long) (Java method), 95, 97setMemoryInMB(int) (Java method), 512setMetrics(List) (Java method), 506setMinimumGranularity(int) (Java method), 331setMips(double) (Java method), 298, 420, 453, 456setMips(int) (Java method), 376setName(String) (Java method), 48, 109, 120, 122, 162,
238, 276, 507, 509, 512setNeighborSolution(S) (Java method), 491setNetServiceLevel(int) (Java method), 62, 73, 86, 219setNetworkTopology(NetworkTopology) (Java method),
102, 129, 134setNodeId(int) (Java method), 248setNodeName(String) (Java method), 248setNumberOfExpectedPacketsToReceive(long) (Java
method), 91setNumberOfNeighborhoodSearchesByIteration(int)
(Java method), 489, 491, 492setNumberOfPes(long) (Java method), 62, 73, 86setOnCloudletFinishEventListener(EventListener) (Java
method), 448setOnHostAllocationListener(EventListener) (Java
method), 456setOnHostDeallocationListener(EventListener) (Java
method), 457setOnUpdateVmProcessingListener(EventListener) (Java
method), 457setOnUpdateVmsProcessingListener(EventListener)
(Java method), 453setOnVmCreationFilatureListenerForAllVms(EventListener)
(Java method), 457setOs(String) (Java method), 154, 157, 159setOutput(OutputStream) (Java method), 366setOutputSize(long) (Java method), 62, 73, 86, 448setOverloadPredicate(Predicate) (Java method), 428–430setOverUtilizationThreshold(double) (Java method), 30setOwnerName(String) (Java method), 277, 281setPacketScheduler(PacketScheduler) (Java method),
319, 326, 335setPe(Pe) (Java method), 261, 263, 264
Index 541
CloudSim Plus Documentation, Release 1.0.0
setPeList(List) (Java method), 208setPeProvisioner(PeProvisioner) (Java method), 292, 295,
297setPEs(int) (Java method), 449setPes(int) (Java method), 453, 457setPeVerticalScaling(VerticalVmScaling) (Java method),
402, 410, 420setPorts(int) (Java method), 227, 235, 238setPowerModel(PowerModel) (Java method), 192, 199,
208setPredicate(Predicate) (Java method), 376, 377setPreviousTime(double) (Java method), 326, 390, 392,
424setPricePerHour(double) (Java method), 512setPriority(int) (Java method), 62, 73, 86setProvisioner(Class) (Java method), 454setRam(int) (Java method), 453, 457setRam(long) (Java method), 403, 410, 420setRamProvisioner(ResourceProvisioner) (Java method),
192, 200, 208setRamVerticalScaling(VerticalVmScaling) (Java
method), 403, 411, 420setRandomGenerator(ContinuousDistribution) (Java
method), 388setReceivedPacketList(List) (Java method), 427setReceiveTime(double) (Java method), 215, 219, 221,
223setRegistrationID(int) (Java method), 277setRegistrationId(int) (Java method), 282setRequestedMips(double) (Java method), 422setRequiredFiles(List) (Java method), 73, 449setResource(ResourceManageable) (Java method), 263,
266, 268, 270setResourceClass(Class) (Java method), 434, 436, 439setResourceScaling(ResourceScaling) (Java method),
434, 437, 439setSafetyParameter(double) (Java method), 21setScalingFactor(double) (Java method), 434, 437, 439setSchedulingInterval(double) (Java method), 24, 150,
162, 168, 386, 451setSeed(long) (Java method), 172setSendTime(double) (Java method), 215, 219, 221, 223setSerial(long) (Java method), 137, 144, 146setSimulation(Simulation) (Java method), 48, 109, 120,
122, 162, 193, 200, 208, 239, 378, 380, 384setSize(int) (Java method), 277setSize(long) (Java method), 220, 403, 411, 420, 457setSolveTime(double) (Java method), 491setSource(NetworkHost) (Java method), 215setSource(SimEntity) (Java method), 137, 144, 146, 220setSource(T) (Java method), 222setSource(Vm) (Java method), 223setStarted(boolean) (Java method), 109setStartTime(double) (Java method), 95, 403, 411, 420
setState(State) (Java method), 48, 109, 120, 122, 162, 239setStatus(Status) (Java method), 63, 73, 86, 292, 295, 297setStopTime(double) (Java method), 403, 411, 420setStorage(long) (Java method), 453setStorageList(List) (Java method), 150, 162, 168, 451setSubmissionDelay(double) (Java method), 73, 86, 115,
411, 420setSubTitle(String) (Java method), 462, 472setSwitchingDelay(double) (Java method), 227, 235, 239setTable(TableBuilder) (Java method), 462, 472setTag(int) (Java method), 220setTime(double) (Java method), 422setTimeSlice(double) (Java method), 79setTimeZone(double) (Java method), 154, 157, 159setTimezone(double) (Java method), 451setTitle(String) (Java method), 460, 462, 464, 470, 472setTransactionTime(double) (Java method), 277setType(int) (Java method), 277, 282setUnderUtilizationThreshold(double) (Java method), 11,
16, 28setUnit(String) (Java method), 509setUnit(Unit) (Java method), 380setUpdateTime(double) (Java method), 278, 282setUplinkBandwidth(double) (Java method), 227, 235,
239setUpperThresholdFunction(Function) (Java method),
435, 437, 439setUsedPes(Map) (Java method), 6setUtilizationModel(UtilizationModel) (Java method),
63, 73, 86setUtilizationModelBw(UtilizationModel) (Java method),
63, 74, 87, 449setUtilizationModelCpu(UtilizationModel) (Java
method), 63, 74, 87, 449setUtilizationModelCpuRamAndBw(UtilizationModel)
(Java method), 449setUtilizationModelRam(UtilizationModel) (Java
method), 63, 74, 87, 449setUtilizationUpdateFunction(Function) (Java method),
382setValue(double) (Java method), 509setVirtualRuntime(double) (Java method), 80setVm(Vm) (Java method), 64, 74, 87, 319, 326, 335,
339–341, 429, 437, 440, 442, 449setVmAllocationPolicy(VmAllocationPolicy) (Java
method), 169setVmClonerFunction(UnaryOperator) (Java method),
480, 481setVmComparator(Comparator) (Java method), 35, 43, 48setVmDestructionDelayFunction(Function) (Java
method), 35, 43, 48setVmList(List) (Java method), 482–484setVmm(String) (Java method), 155, 157, 159, 420setVmMapper(Function) (Java method), 35, 43, 48
542 Index
CloudSim Plus Documentation, Release 1.0.0
setVmScheduler(VmScheduler) (Java method), 193, 200,208
setVmSchedulerClass(Class) (Java method), 453setVmSelectionPolicy(PowerVmSelectionPolicy) (Java
method), 16setVmSupplier(Supplier) (Java method), 428–430setWallClockTime(double) (Java method), 76setWallClockTime(double, double) (Java method), 64, 74,
87setWorldCoordinates(Point2D) (Java method), 248shutdownEntity() (Java method), 43, 48, 98, 120, 122,
162, 169, 228, 239, 479signalShutdown(Collection) (Java method), 98SimEntity (Java interface), 118SimEntityNull (Java class), 121SimEvent (Java interface), 142SimEventNull (Java class), 145SimulatedAnnealing (Java class), 495SimulatedAnnealing(ContinuousDistribution, Class)
(Java constructor), 495Simulation (Java interface), 122SimulationNull (Java class), 131SimulationScenarioBuilder (Java class), 454SimulationScenarioBuilder(CloudSim) (Java construc-
tor), 454size() (Java method), 139–141SlaContract (Java class), 504SlaContract() (Java constructor), 505SlaMetric (Java class), 506SlaMetric() (Java constructor), 507SlaMetric(String) (Java constructor), 507SlaMetricDimension (Java class), 508SlaMetricDimension() (Java constructor), 508SlaMetricDimension(double) (Java constructor), 508solve() (Java method), 489, 491, 493sortCloudletWaitingList(Comparator) (Java method), 326start() (Java method), 49, 102, 110, 120, 122, 130, 134,
162, 239start(String) (Java method), 363startEntity() (Java method), 43, 98, 110, 169, 228, 479startNextTaskIfCurrentIsFinished(double) (Java method),
97State (Java enum), 120Status (Java enum), 64, 292stDev(List) (Java method), 370Storage (Java class), 312Storage(long) (Java constructor), 312stream() (Java method), 139–141submitCloudlet(Cloudlet) (Java method), 36, 43, 49submitCloudletList(List) (Java method), 36, 44, 49submitCloudletList(List, double) (Java method), 36, 43,
49submitCloudletList(List, Vm) (Java method), 36, 43, 49
submitCloudletList(List, Vm, double) (Java method), 37,43, 49
submitCloudlets() (Java method), 449submitVm(Vm) (Java method), 37, 44, 49submitVmList(List) (Java method), 37, 44, 49submitVmList(List, double) (Java method), 37, 44, 49SUCCESS (Java field), 65sum(List) (Java method), 370sumAvailableResource(long) (Java method), 307swapVmsOfTwoMapEntries(List) (Java method), 487swapVmsOfTwoRandomSelectedMapEntries() (Java
method), 487Switch (Java interface), 232SWITCHING_DELAY (Java field), 228, 230, 231SwitchNull (Java class), 235
TTableBuilder (Java interface), 468TableColumn (Java interface), 471terminate() (Java method), 102, 130, 134terminateAt(double) (Java method), 103, 130, 134test(SimEvent) (Java method), 142TextTableBuilder (Java class), 472TextTableBuilder() (Java constructor), 472TextTableBuilder(String) (Java constructor), 472TextTableColumn (Java class), 473TextTableColumn(String) (Java constructor), 473TextTableColumn(String, String) (Java constructor), 473TextTableColumn(TableBuilder, String) (Java construc-
tor), 474TextTableColumn(TableBuilder, String, String) (Java
constructor), 474timeSpan(CloudletExecution, double) (Java method), 326TopologicalGraph (Java class), 244TopologicalGraph() (Java constructor), 244TopologicalLink (Java class), 245TopologicalLink(int, int, double, double) (Java construc-
tor), 246TopologicalNode (Java class), 246TopologicalNode() (Java constructor), 247TopologicalNode(int) (Java constructor), 247TopologicalNode(int, Point2D) (Java constructor), 247TopologicalNode(int, String, Point2D) (Java constructor),
247TopologyReader (Java interface), 248TopologyReaderBrite (Java class), 249toString() (Java method), 44, 80, 87, 89, 137, 163, 169,
200, 208, 210, 213, 220, 244, 245, 278, 297,307, 411, 421, 462, 506, 508, 509, 512
Type (Java enum), 144TYPE_UNKNOWN (Java field), 272
UUniformDistr (Java class), 179
Index 543
CloudSim Plus Documentation, Release 1.0.0
UniformDistr() (Java constructor), 179UniformDistr(double) (Java constructor), 179UniformDistr(double, double) (Java constructor), 179UniformDistr(double, double, long) (Java constructor),
180UniformDistr(long) (Java constructor), 179UniquelyIdentificable (Java interface), 135Unit (Java enum), 378unmapNode(int) (Java method), 241–243update(T) (Java method), 501updateCloudletProcessing() (Java method), 169updateCloudletProcessing(CloudletExecution, double)
(Java method), 327, 331updateProcessing(double) (Java method), 193, 200, 208,
212updateProcessing(double, List) (Java method), 319, 327,
331, 335, 404, 411, 421updateProcessing(long) (Java method), 80updateSystemState() (Java method), 491, 497utilizationHistory (Java field), 411UtilizationHistory (Java interface), 388UtilizationHistoryNull (Java class), 390UtilizationModel (Java interface), 377UtilizationModelAbstract (Java class), 379UtilizationModelAbstract() (Java constructor), 379UtilizationModelAbstract(Unit) (Java constructor), 379UtilizationModelDynamic (Java class), 380UtilizationModelDynamic() (Java constructor), 380UtilizationModelDynamic(double) (Java constructor),
381UtilizationModelDynamic(Unit) (Java constructor), 381UtilizationModelDynamic(Unit, double) (Java construc-
tor), 381UtilizationModelDynamic(UtilizationModelDynamic)
(Java constructor), 381UtilizationModelFull (Java class), 383UtilizationModelNull (Java class), 384UtilizationModelPlanetLab (Java class), 384UtilizationModelPlanetLab(String, double) (Java con-
structor), 384UtilizationModelPlanetLab(String, double, int) (Java con-
structor), 385UtilizationModelStochastic (Java class), 386UtilizationModelStochastic() (Java constructor), 386UtilizationModelStochastic(long) (Java constructor), 387UtilizationModelStochastic(Unit) (Java constructor), 386UtilizationModelStochastic(Unit, long) (Java construc-
tor), 386
VvalidateAmount(double) (Java method), 447validateUtilizationField(String, double) (Java method),
380
validateUtilizationField(String, double, double) (Javamethod), 380
variance(List) (Java method), 371VERSION (Java field), 99VerticalVmScaling (Java interface), 431VerticalVmScalingNull (Java class), 435VerticalVmScalingSimple (Java class), 437VerticalVmScalingSimple(Class, double) (Java construc-
tor), 437Vm (Java interface), 392VM_CREATE (Java field), 113VM_CREATE_ACK (Java field), 113VM_DESTROY (Java field), 113VM_DESTROY_ACK (Java field), 113VM_MIGRATE (Java field), 113VM_MIGRATE_ACK (Java field), 113VM_UPDATE_CLOUDLET_PROCESSING_EVENT
(Java field), 114VM_VERTICAL_SCALING (Java field), 114VmAllocationPolicy (Java interface), 1VmAllocationPolicyAbstract (Java class), 4VmAllocationPolicyAbstract() (Java constructor), 4VmAllocationPolicyAbstract(BiFunction) (Java construc-
tor), 4VmAllocationPolicyFirstFit (Java class), 6VmAllocationPolicyMigration (Java interface), 9VmAllocationPolicyMigrationAbstract (Java class), 11VmAllocationPolicyMigrationAbstract(PowerVmSelectionPolicy)
(Java constructor), 11VmAllocationPolicyMigrationAbstract(PowerVmSelectionPolicy,
BiFunction) (Java constructor), 12VmAllocationPolicyMigrationBestFitStaticThreshold
(Java class), 16VmAllocationPolicyMigrationBestFitStaticThreshold(PowerVmSelectionPolicy,
double) (Java constructor), 17VmAllocationPolicyMigrationBestFitStaticThreshold(PowerVmSelectionPolicy,
double, BiFunction) (Java constructor), 17VmAllocationPolicyMigrationDynamicUpperThreshold
(Java interface), 18VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit
(Java class), 19VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit(PowerVmSelectionPolicy)
(Java constructor), 19VmAllocationPolicyMigrationDynamicUpperThresholdFirstFit(PowerVmSelectionPolicy,
double, VmAllocationPolicyMigration) (Javaconstructor), 19
VmAllocationPolicyMigrationInterQuartileRange (Javaclass), 21
VmAllocationPolicyMigrationInterQuartileRange(PowerVmSelectionPolicy)(Java constructor), 21
VmAllocationPolicyMigrationInterQuartileRange(PowerVmSelectionPolicy,double, VmAllocationPolicyMigration) (Javaconstructor), 21
VmAllocationPolicyMigrationLocalRegression (Java
544 Index
CloudSim Plus Documentation, Release 1.0.0
class), 22VmAllocationPolicyMigrationLocalRegression(PowerVmSelectionPolicy)
(Java constructor), 22VmAllocationPolicyMigrationLocalRegression(PowerVmSelectionPolicy,
double, VmAllocationPolicyMigration) (Javaconstructor), 22
VmAllocationPolicyMigrationLocalRegressionRobust(Java class), 24
VmAllocationPolicyMigrationLocalRegressionRobust(PowerVmSelectionPolicy)(Java constructor), 24
VmAllocationPolicyMigrationLocalRegressionRobust(PowerVmSelectionPolicy,double, VmAllocationPolicyMigration) (Javaconstructor), 25
VmAllocationPolicyMigrationMedianAbsoluteDeviation(Java class), 25
VmAllocationPolicyMigrationMedianAbsoluteDeviation(PowerVmSelectionPolicy)(Java constructor), 26
VmAllocationPolicyMigrationMedianAbsoluteDeviation(PowerVmSelectionPolicy,double, VmAllocationPolicyMigration) (Javaconstructor), 26
VmAllocationPolicyMigrationNull (Java class), 26VmAllocationPolicyMigrationStaticThreshold (Java
class), 28VmAllocationPolicyMigrationStaticThreshold(PowerVmSelectionPolicy,
double) (Java constructor), 29VmAllocationPolicyMigrationStaticThreshold(PowerVmSelectionPolicy,
double, BiFunction) (Java constructor), 29VmAllocationPolicyMigrationWorstFitStaticThreshold
(Java class), 30VmAllocationPolicyMigrationWorstFitStaticThreshold(PowerVmSelectionPolicy,
double) (Java constructor), 30VmAllocationPolicyMigrationWorstFitStaticThreshold(PowerVmSelectionPolicy,
double, BiFunction) (Java constructor), 30VmAllocationPolicyNull (Java class), 7VmAllocationPolicySimple (Java class), 8VmAllocationPolicySimple() (Java constructor), 8VmAllocationPolicySimple(BiFunction) (Java construc-
tor), 8VmBuilder (Java class), 455VmBuilder(DatacenterBrokerSimple) (Java constructor),
455VmCloner (Java interface), 479VmClonerSimple (Java class), 480VmClonerSimple(UnaryOperator, Function) (Java con-
structor), 480VmDatacenterEventInfo (Java interface), 502VmEventInfo (Java interface), 503VmHostEventInfo (Java interface), 503VmNull (Java class), 404VmPacket (Java class), 222VmPacket(Vm, Vm, long, Cloudlet, Cloudlet) (Java con-
structor), 222VmScaling (Java interface), 440VmScalingAbstract (Java class), 441
VmScalingAbstract() (Java constructor), 441VmScalingNull (Java class), 442VmScheduler (Java interface), 341VmSchedulerAbstract (Java class), 345VmSchedulerAbstract(double) (Java constructor), 345VmSchedulerNull (Java class), 349VmSchedulerSpaceShared (Java class), 351VmSchedulerSpaceShared() (Java constructor), 351VmSchedulerSpaceShared(double) (Java constructor),
351VmSchedulerTimeShared (Java class), 352VmSchedulerTimeShared() (Java constructor), 352VmSchedulerTimeShared(double) (Java constructor), 352VmSchedulerTimeSharedOverSubscription (Java class),
354VmSchedulerTimeSharedOverSubscription() (Java con-
structor), 354VmSchedulerTimeSharedOverSubscription(double)
(Java constructor), 354VmSimple (Java class), 411VmSimple(int, double, long) (Java constructor), 412VmSimple(int, long, long) (Java constructor), 412VmSimple(long, long) (Java constructor), 412VmStateHistoryEntry (Java class), 421VmStateHistoryEntry(double, double, double, boolean)
(Java constructor), 421VmUtilizationHistory (Java class), 423VmUtilizationHistory(Vm) (Java constructor), 423VmUtilizationHistory(Vm, boolean) (Java constructor),
423
Wwait(CloudSimEntity, Predicate) (Java method), 103, 130,
134waitForEvent(Predicate) (Java method), 110WAITING (Java field), 121waiting(SimEntity, Predicate) (Java method), 103, 131,
134wattsSecToKWattsHour(double) (Java method), 250WeibullDistr (Java class), 181WeibullDistr(double, double) (Java constructor), 181WeibullDistr(long, double, double) (Java constructor),
181WorkloadFileReader (Java class), 373WorkloadFileReader(String, int) (Java constructor), 373WorkloadReader (Java interface), 376
ZZipfDistr (Java class), 181ZipfDistr(double, int) (Java constructor), 182ZipfDistr(long, double, int) (Java constructor), 182
Index 545