Class HostSimple

java.lang.Object
org.cloudbus.cloudsim.hosts.HostSimple
All Implemented Interfaces:
Comparable<Host>, AbstractMachine<FileStorage>, ChangeableId, Identifiable, Machine, ResourceStatsComputer<HostResourceStats>, Host, PowerAware<PowerModelHost>, Resourceful
Direct Known Subclasses:
NetworkHost

public class HostSimple extends Object implements Host
A Host class that implements the most basic features of a Physical Machine (PM) inside a Datacenter. It executes actions related to management of virtual machines (e.g., creation and destruction). A host has a defined policy for provisioning memory and bw, as well as an allocation policy for PEs to Virtual Machines. A host is associated to a Datacenter and can host virtual machines.
Since:
CloudSim Toolkit 1.0
Author:
Rodrigo N. Calheiros, Anton Beloglazov
  • Field Details

  • Constructor Details

  • Method Details

    • getDefaultRamCapacity

      public static long getDefaultRamCapacity()
      Gets the Default RAM capacity (in MB) for creating Hosts. This value is used when the RAM capacity is not given in a Host constructor.
    • setDefaultRamCapacity

      public static void setDefaultRamCapacity(long defaultCapacity)
      Sets the Default RAM capacity (in MB) for creating Hosts. This value is used when the RAM capacity is not given in a Host constructor.
    • getDefaultBwCapacity

      public static long getDefaultBwCapacity()
      Gets the Default Bandwidth capacity (in Mbps) for creating Hosts. This value is used when the BW capacity is not given in a Host constructor.
    • setDefaultBwCapacity

      public static void setDefaultBwCapacity(long defaultCapacity)
      Sets the Default Bandwidth capacity (in Mbps) for creating Hosts. This value is used when the BW capacity is not given in a Host constructor.
    • getDefaultStorageCapacity

      public static long getDefaultStorageCapacity()
      Gets the Default Storage capacity (in MB) for creating Hosts. This value is used when the Storage capacity is not given in a Host constructor.
    • setDefaultStorageCapacity

      public static void setDefaultStorageCapacity(long defaultCapacity)
      Sets the Default Storage capacity (in MB) for creating Hosts. This value is used when the Storage capacity is not given in a Host constructor.
    • updateProcessing

      public double updateProcessing(double currentTime)
      Description copied from interface: Host
      Updates the processing of VMs running on this Host, that makes the processing of cloudlets inside such VMs to be updated.
      Specified by:
      updateProcessing in interface Host
      Parameters:
      currentTime - the current time
      Returns:
      the predicted completion time of the earliest finishing cloudlet (which is a relative delay from the current simulation time), or Double.MAX_VALUE if there is no next Cloudlet to execute
    • updateVmProcessing

      protected double updateVmProcessing(Vm vm, double currentTime, double nextSimulationDelay)
    • createVm

      public HostSuitability createVm(Vm vm)
      Description copied from interface: Host
      Try to allocate resources to a new VM in the Host.
      Specified by:
      createVm in interface Host
      Parameters:
      vm - Vm being started
      Returns:
      a HostSuitability to indicate if the Vm was placed into the host or not (if the Host doesn't have enough resources to allocate the Vm)
    • createTemporaryVm

      public HostSuitability createTemporaryVm(Vm vm)
      Description copied from interface: Host
      Try to allocate resources to a new temporary VM in the Host. The method is used only to book resources for a given VM. For instance, if Hosts are being chosen to migrate a set of VMs, when a Host is selected for a given VM, 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, if it was possible to place just one Vm into that Host, with the booking, no other VM will be selected to that Host.
      Specified by:
      createTemporaryVm in interface Host
      Parameters:
      vm - Vm being started
      Returns:
      a HostSuitability to indicate if the Vm was placed into the host or not (if the Host doesn't have enough resources to allocate the Vm) TODO: https://github.com/manoelcampos/cloudsim-plus/issues/94
    • reallocateMigratingInVms

      public void reallocateMigratingInVms()
      Description copied from interface: Host
      Reallocate VMs migrating into the host. Gets the VM in the migrating in queue and allocate them on the host.
      Specified by:
      reallocateMigratingInVms in interface Host
    • isSuitableForVm

      public boolean isSuitableForVm(Vm vm)
      Description copied from interface: Host
      Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed.
      Specified by:
      isSuitableForVm in interface Host
      Parameters:
      vm - the Vm to check
      Returns:
      true if is suitable for Vm, false otherwise
      See Also:
    • getSuitabilityFor

      public HostSuitability getSuitabilityFor(Vm vm)
      Description copied from interface: Host
      Checks if the host is suitable for a Vm (if it has enough resources to attend the Vm) and the Host is not failed, providing fine-grained information about each individual Host's resource suitability.
      Specified by:
      getSuitabilityFor in interface Host
      Parameters:
      vm - the Vm to check
      Returns:
      a HostSuitability object containing indicating the Host's resources that are suitable or not for the given Vm.
      See Also:
    • isActive

      public boolean isActive()
      Description copied from interface: Host
      Checks if the Host is powered-on or not.
      Specified by:
      isActive in interface Host
      Returns:
      true if the Host is powered-on, false otherwise.
    • hasEverStarted

      public boolean hasEverStarted()
      Description copied from interface: Host
      Checks if the Host has ever started sometime, i.e., if it was active sometime in the simulation execution.
      Specified by:
      hasEverStarted in interface Host
      Returns:
    • setActive

      public final Host setActive(boolean activate)
      Description copied from interface: Host
      Requests the Host to be powered on or off. If there is no PowerModelHost.getStartupDelay() or PowerModelHost.getShutDownDelay() (which is the default), those operations will happen immediately.

      If the Host is set to be powered off while it has running VMs, it is simulated a scheduled shutdown, so that those VMs will finish, but new ones won't be submitted to this Host.

      Specified by:
      setActive in interface Host
      Parameters:
      activate - true to power on, false to power off
      Returns:
      this Host instance
      See Also:
    • processActivation

      public void processActivation(boolean activate)
      Process an event for actually powering the Host on or off after any defined start up/shutdown delay (if some delay is set).
      Parameters:
      activate - true to start the Host up, false to shut it down
      See Also:
    • destroyVm

      public void destroyVm(Vm vm)
      Description copied from interface: Host
      Destroys a VM running in the host and removes it from the Host.getVmList(). If the VM was not created yet, this method has no effect.
      Specified by:
      destroyVm in interface Host
      Parameters:
      vm - the VM to be destroyed
    • destroyTemporaryVm

      public void destroyTemporaryVm(Vm vm)
      Description copied from interface: Host
      Destroys a temporary VM created into the Host to book resources.
      Specified by:
      destroyTemporaryVm in interface Host
      Parameters:
      vm - the VM
      See Also:
    • deallocateResourcesOfVm

      protected void deallocateResourcesOfVm(Vm vm)
      Deallocate all resources that a VM was using.
      Parameters:
      vm - the VM
    • destroyAllVms

      public void destroyAllVms()
      Description copied from interface: Host
      Destroys all VMs running in the host and remove them from the Host.getVmList().
      Specified by:
      destroyAllVms in interface Host
    • addOnStartupListener

      public Host addOnStartupListener(EventListener<HostEventInfo> listener)
      Description copied from interface: Host
      Adds a listener object that will be notified every time the host is powered on.
      Specified by:
      addOnStartupListener in interface Host
      Parameters:
      listener - the Listener to add
      Returns:
    • removeOnStartupListener

      public boolean removeOnStartupListener(EventListener<HostEventInfo> listener)
      Description copied from interface: Host
      Removes a Listener object from the registered List.
      Specified by:
      removeOnStartupListener in interface Host
      Parameters:
      listener - the Listener to remove
      Returns:
      true if the Listener was removed, false otherwise
    • addOnShutdownListener

      public Host addOnShutdownListener(EventListener<HostEventInfo> listener)
      Description copied from interface: Host
      Adds a listener object that will be notified every time the host is powered off.
      Specified by:
      addOnShutdownListener in interface Host
      Parameters:
      listener - the Listener to add
      Returns:
    • removeOnShutdownListener

      public boolean removeOnShutdownListener(EventListener<HostEventInfo> listener)
      Description copied from interface: Host
      Removes a Listener object from the registered List.
      Specified by:
      removeOnShutdownListener in interface Host
      Parameters:
      listener - the Listener to remove
      Returns:
      true if the Listener was removed, false otherwise
    • getNumberOfPes

      public long getNumberOfPes()
      Gets the overall number of Pes the machine has, that include PEs of all statuses, including failed PEs.
      Specified by:
      getNumberOfPes in interface AbstractMachine<FileStorage>
      Returns:
      the machine's number of PEs
      See Also:
    • getAllocatedMipsForVm

      protected MipsShare 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
    • getMips

      public double getMips()
      Description copied from interface: AbstractMachine
      Gets the individual MIPS capacity of any machine's Pe, considering that all PEs have the same capacity.
      Specified by:
      getMips in interface AbstractMachine<FileStorage>
      Returns:
      the MIPS capacity of a single Pe
    • getTotalMipsCapacity

      public double getTotalMipsCapacity()
      Description copied from interface: Host
      Gets total MIPS capacity of PEs which are not Pe.Status.FAILED.
      Specified by:
      getTotalMipsCapacity in interface AbstractMachine<FileStorage>
      Specified by:
      getTotalMipsCapacity in interface Host
      Returns:
      the total MIPS of working PEs
    • getTotalAvailableMips

      public double getTotalAvailableMips()
      Description copied from interface: Host
      Gets the current total amount of available MIPS at the host.
      Specified by:
      getTotalAvailableMips in interface Host
      Returns:
      the total available amount of MIPS
    • getTotalAllocatedMips

      public double getTotalAllocatedMips()
      Description copied from interface: Host
      Gets the total allocated MIPS at the host.
      Specified by:
      getTotalAllocatedMips in interface Host
      Returns:
      the total allocated amount of MIPS
    • getTotalAllocatedMipsForVm

      public double getTotalAllocatedMipsForVm(Vm vm)
      Description copied from interface: Host
      Gets the total allocated MIPS for a VM along all its PEs.
      Specified by:
      getTotalAllocatedMipsForVm in interface Host
      Parameters:
      vm - the vm
      Returns:
      the allocated mips for vm
    • getBw

      public Resource getBw()
      Description copied from interface: AbstractMachine
      Gets a resource representing the machine bandwidth (bw) in Megabits/s.
      Specified by:
      getBw in interface AbstractMachine<FileStorage>
      Returns:
      the machine bw resource
    • getRam

      public Resource getRam()
      Description copied from interface: AbstractMachine
      Gets a resource representing the machine memory in Megabytes.
      Specified by:
      getRam in interface AbstractMachine<FileStorage>
      Returns:
      the machine memory
    • getStorage

      public FileStorage getStorage()
      Description copied from interface: AbstractMachine
      Gets the storage device of the machine with capacity in Megabytes.
      Specified by:
      getStorage in interface AbstractMachine<FileStorage>
      Returns:
      the machine storage device
    • getId

      public long getId()
      Specified by:
      getId in interface Identifiable
    • setId

      public final void setId(long id)
      Description copied from interface: ChangeableId
      Sets the id of the object. -1 indicates the object has no id.
      Specified by:
      setId in interface ChangeableId
      Parameters:
      id - the id to set
    • getRamProvisioner

      public ResourceProvisioner getRamProvisioner()
      Description copied from interface: Host
      Gets the ram provisioner with capacity in Megabytes.
      Specified by:
      getRamProvisioner in interface Host
      Returns:
      the ram provisioner
    • setRamProvisioner

      public final Host setRamProvisioner(ResourceProvisioner ramProvisioner)
      Description copied from interface: Host
      Sets the ram provisioner with capacity in Megabytes.
      Specified by:
      setRamProvisioner in interface Host
      Parameters:
      ramProvisioner - the new ram provisioner
    • getBwProvisioner

      public ResourceProvisioner getBwProvisioner()
      Description copied from interface: Host
      Gets the bandwidth (BW) provisioner with capacity in Megabits/s.
      Specified by:
      getBwProvisioner in interface Host
      Returns:
      the bw provisioner
    • setBwProvisioner

      public final Host setBwProvisioner(ResourceProvisioner bwProvisioner)
      Description copied from interface: Host
      Sets the bandwidth (BW) provisioner with capacity in Megabits/s.
      Specified by:
      setBwProvisioner in interface Host
      Parameters:
      bwProvisioner - the new bw provisioner
    • getVmScheduler

      public VmScheduler getVmScheduler()
      Description copied from interface: Host
      Gets the policy for allocation of host PEs to VMs in order to schedule VM execution.
      Specified by:
      getVmScheduler in interface Host
      Returns:
      the VmScheduler
    • setVmScheduler

      public final Host setVmScheduler(VmScheduler vmScheduler)
      Description copied from interface: Host
      Sets the policy for allocation of host PEs to VMs in order to schedule VM execution. The host also sets itself to the given scheduler. It also sets the Host itself to the given scheduler.
      Specified by:
      setVmScheduler in interface Host
      Parameters:
      vmScheduler - the vm scheduler to set
      Returns:
    • getStartTime

      public double getStartTime()
      Description copied from interface: AbstractMachine
      Gets the last time the machine was started up (in seconds). The value -1 means it was not started yet.
      Specified by:
      getStartTime in interface AbstractMachine<FileStorage>
      Returns:
    • getFirstStartTime

      public double getFirstStartTime()
      Description copied from interface: Host
      Gets the first time the Host was powered-on (in seconds).
      Specified by:
      getFirstStartTime in interface Host
      Returns:
      the first Host startup time or -1 if the Host has never been powered on
      See Also:
    • setStartTime

      public Host setStartTime(double startTime)
      Description copied from interface: AbstractMachine
      Sets the current machine startup time. The value -1 means it was not started yet.
      Specified by:
      setStartTime in interface AbstractMachine<FileStorage>
      Parameters:
      startTime - the start time to set (in seconds)
      Returns:
    • getShutdownTime

      public double getShutdownTime()
      Description copied from interface: Host
      Gets the last time the Host was shut down (in seconds).
      Specified by:
      getShutdownTime in interface Host
      Returns:
      the last shut downtime or -1 if the Host is active
    • setShutdownTime

      public void setShutdownTime(double shutdownTime)
      Description copied from interface: Host
      Sets the the Host shut down time.
      Specified by:
      setShutdownTime in interface Host
      Parameters:
      shutdownTime - the time to set (in seconds)
      See Also:
    • getUpTime

      public double getUpTime()
      Description copied from interface: Host
      Gets the elapsed time since the last power on.
      Specified by:
      getUpTime in interface Host
      Returns:
      the elapsed time (in seconds)
      See Also:
    • getTotalUpTime

      public double getTotalUpTime()
      Description copied from interface: Host
      Gets the total time the Host stayed active (powered on). Since the Host can be powered on and off according to demand, this method returns the sum of all intervals the Host was active (in seconds).
      Specified by:
      getTotalUpTime in interface Host
      Returns:
      the total uptime (in seconds)
      See Also:
    • getUpTimeHours

      public double getUpTimeHours()
      Description copied from interface: Host
      Gets the elapsed time in hours since the last power on.
      Specified by:
      getUpTimeHours in interface Host
      Returns:
      the elapsed time (in hours)
      See Also:
    • getTotalUpTimeHours

      public double getTotalUpTimeHours()
      Description copied from interface: Host
      Gets the total time the Host stayed active (powered on). Since the Host can be powered on and off according to demand, this method returns the sum of all intervals the Host was active (in hours).
      Specified by:
      getTotalUpTimeHours in interface Host
      Returns:
      the total uptime (in hours)
      See Also:
    • getIdleShutdownDeadline

      public double getIdleShutdownDeadline()
      Description copied from interface: Host
      Gets the deadline to shut down the Host when it becomes idle. This is the time interval after the Host becoming idle that it will be shutdown.
      Specified by:
      getIdleShutdownDeadline in interface Host
      Returns:
      the idle shutdown deadline (in seconds)
      See Also:
    • setIdleShutdownDeadline

      public Host setIdleShutdownDeadline(double deadline)
      Description copied from interface: Host
      Sets the deadline to shutdown the Host when it becomes idle. This is the time interval after the Host becoming idle that it will be shutdown.
      Specified by:
      setIdleShutdownDeadline in interface Host
      Parameters:
      deadline - the deadline to shut down the Host after it becoming idle (in seconds). A negative value disables idle host shutdown.
      Returns:
      See Also:
    • getPeList

      public List<Pe> getPeList()
      Description copied from interface: Host
      Gets the list of all Processing Elements (PEs) of the host, including failed PEs.
      Specified by:
      getPeList in interface Host
      Returns:
      the list of all Host PEs
      See Also:
    • getVmList

      public <T extends Vm> List<T> getVmList()
      Description copied from interface: Host
      Gets as list of VMs currently assigned to the host.
      Specified by:
      getVmList in interface Host
      Type Parameters:
      T - The generic type
      Returns:
      the read-only current vm list
    • getVmCreatedList

      public <T extends Vm> List<T> getVmCreatedList()
      Description copied from interface: Host
      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.
      Specified by:
      getVmCreatedList in interface Host
      Type Parameters:
      T - The generic type
      Returns:
      the read-only vm created historic list
    • addVmToList

      protected void addVmToList(Vm vm)
    • addVmToCreatedList

      protected void addVmToCreatedList(Vm vm)
    • isFailed

      public boolean isFailed()
      Description copied from interface: Host
      Checks if the host is working properly or has failed.
      Specified by:
      isFailed in interface Host
      Returns:
      true, if the host PEs have failed; false otherwise
    • setFailed

      public final boolean setFailed(boolean failed)
      Description copied from interface: Host
      Sets the Host state to "failed" or "working".
      Specified by:
      setFailed in interface Host
      Parameters:
      failed - true to set the Host to "failed", false to set to "working"
      Returns:
      true if the Host status was changed, false otherwise
    • setPeStatus

      public final void setPeStatus(List<Pe> peList, Pe.Status newStatus)
      Sets the status of a given (sub)list of Pe to a new status.
      Parameters:
      peList - the (sub)list of Pe to change the status
      newStatus - the new status
    • incFailedPesNumber

      protected void incFailedPesNumber(int inc)
      Updates the number of failed (and working) PEs, decreasing it if a negative number of given, or increasing otherwise.
      Parameters:
      inc - the value to sum (positive or negative) to the number of busy PEs
    • incFreePesNumber

      protected void incFreePesNumber(int inc)
      Updates the number of free PEs, decreasing it if a negative number of given, or increasing otherwise.
      Parameters:
      inc - the value to sum (positive or negative) to the number of busy PEs
    • incBusyPesNumber

      protected void incBusyPesNumber(int inc)
      Updates the number of busy PEs, decreasing it if a negative number of given, or increasing otherwise.
      Parameters:
      inc - the value to sum (positive or negative) to the number of busy PEs
    • getVmsMigratingIn

      public <T extends Vm> Set<T> getVmsMigratingIn()
      Description copied from interface: Host
      Gets the list of VMs migrating into this host.
      Specified by:
      getVmsMigratingIn in interface Host
      Type Parameters:
      T - the generic type
      Returns:
      the vms migrating in
    • hasMigratingVms

      public boolean hasMigratingVms()
      Description copied from interface: Host
      Checks if there is any VMs migrating in or out this host.
      Specified by:
      hasMigratingVms in interface Host
      Returns:
    • addMigratingInVm

      public boolean addMigratingInVm(Vm vm)
      Description copied from interface: Host
      Try to add a VM migrating into the current host if there is enough resources for it. In this case, the resources are allocated and the VM added to the Host.getVmsMigratingIn() List. Otherwise, the VM is not added.
      Specified by:
      addMigratingInVm in interface Host
      Parameters:
      vm - the vm
      Returns:
      true if the Vm was migrated in; false if the Host doesn't have enough resources to place the Vm
    • removeMigratingInVm

      public void removeMigratingInVm(Vm vm)
      Description copied from interface: Host
      Removes a VM migrating into this Host from the migrating-in list, so that the VM can be actually placed into the Host and the migration process finished.
      Specified by:
      removeMigratingInVm in interface Host
      Parameters:
      vm - the vm
    • getVmsMigratingOut

      public Set<Vm> getVmsMigratingOut()
      Description copied from interface: Host
      Gets a read-only list of VMs migrating out from the Host.
      Specified by:
      getVmsMigratingOut in interface Host
      Returns:
    • addVmMigratingOut

      public boolean addVmMigratingOut(Vm vm)
      Description copied from interface: Host
      Adds a Vm to the list of VMs migrating out from the Host.
      Specified by:
      addVmMigratingOut in interface Host
      Parameters:
      vm - the vm to be added
      Returns:
      true if the VM wasn't into the list and was added, false otherwise
    • removeVmMigratingOut

      public boolean removeVmMigratingOut(Vm vm)
      Description copied from interface: Host
      Adds a Vm to the list of VMs migrating out from the Host.
      Specified by:
      removeVmMigratingOut in interface Host
      Parameters:
      vm - the vm to be added
      Returns:
    • getDatacenter

      public Datacenter getDatacenter()
      Description copied from interface: Host
      Gets the Datacenter where the host is placed.
      Specified by:
      getDatacenter in interface Host
      Returns:
      the data center of the host
    • setDatacenter

      public final void setDatacenter(Datacenter datacenter)
      Description copied from interface: Host
      Sets the Datacenter where the host is placed.
      Specified by:
      setDatacenter in interface Host
      Parameters:
      datacenter - the new data center to move the host
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • removeOnUpdateProcessingListener

      public boolean removeOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)
      Description copied from interface: Host
      Removes a Listener object from the registered List.
      Specified by:
      removeOnUpdateProcessingListener in interface Host
      Parameters:
      listener - the listener to remove
      Returns:
      true if the listener was found and removed, false otherwise
      See Also:
    • addOnUpdateProcessingListener

      public Host addOnUpdateProcessingListener(EventListener<HostUpdatesVmsProcessingEventInfo> listener)
      Description copied from interface: Host
      Adds a listener object that will be notified every time the host updates the processing of all its VMs.
      Specified by:
      addOnUpdateProcessingListener in interface Host
      Parameters:
      listener - the OnUpdateProcessingListener to add
      Returns:
      See Also:
    • getAvailableStorage

      public long getAvailableStorage()
      Description copied from interface: Host
      Gets the total free storage available at the host in Megabytes.
      Specified by:
      getAvailableStorage in interface Host
      Returns:
      the free storage
    • getFreePesNumber

      public int getFreePesNumber()
      Description copied from interface: Host
      Gets the number of PEs that are free to be used by any VM.
      Specified by:
      getFreePesNumber in interface Host
      Returns:
      the free pes number
    • getWorkingPesNumber

      public int getWorkingPesNumber()
      Description copied from interface: Host
      Gets the number of PEs that are working. That is, the number of PEs that aren't FAIL.
      Specified by:
      getWorkingPesNumber in interface Host
      Returns:
      the number of working pes
    • getBusyPesNumber

      public int getBusyPesNumber()
      Description copied from interface: Host
      Gets the number of PEs that are Pe.Status.BUSY. That is, the number of PEs that aren't FAIL.
      Specified by:
      getBusyPesNumber in interface Host
      Returns:
      the number of working pes
    • getBusyPesPercent

      public double getBusyPesPercent()
      Description copied from interface: Host
      Gets the current percentage (from 0..1) of used (busy) PEs, according to the total number of PEs.
      Specified by:
      getBusyPesPercent in interface Host
      Returns:
      See Also:
    • getBusyPesPercent

      public double getBusyPesPercent(boolean hundredScale)
      Description copied from interface: Host
      Gets the current percentage of used (busy) PEs, according to the total number of PEs.
      Specified by:
      getBusyPesPercent in interface Host
      Parameters:
      hundredScale - if true, result is provided from 0..100 scale; otherwise, it's returned in scale from 0..1.
      Returns:
      the percentage of busy PEs in the defined scale
      See Also:
    • getFailedPesNumber

      public int getFailedPesNumber()
      Description copied from interface: Host
      Gets the number of PEs that have failed.
      Specified by:
      getFailedPesNumber in interface Host
      Returns:
      the number of failed pes
    • getSimulation

      public Simulation getSimulation()
      Description copied from interface: AbstractMachine
      Gets the CloudSim instance that represents the simulation the Entity belongs to.
      Specified by:
      getSimulation in interface AbstractMachine<FileStorage>
      Returns:
    • getLastBusyTime

      public double getLastBusyTime()
      Description copied from interface: AbstractMachine
      Gets the last time the Machine was running some process.
      Specified by:
      getLastBusyTime in interface AbstractMachine<FileStorage>
      Returns:
      the last busy time (in seconds)
    • setSimulation

      public final Host setSimulation(Simulation simulation)
      Description copied from interface: Host
      Sets the CloudSim instance that represents the simulation the Entity belongs Such attribute has to be set by the Datacenter that the host belongs to.
      Specified by:
      setSimulation in interface Host
      Parameters:
      simulation - The CloudSim instance that represents the simulation the Entity belongs
      Returns:
    • compareTo

      public int compareTo(Host other)
      Specified by:
      compareTo in interface Comparable<Host>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getResources

      public List<ResourceManageable> getResources()
      Description copied from interface: Resourceful
      Gets a read-only list of resources the machine has.
      Specified by:
      getResources in interface Resourceful
      Returns:
      a read-only list of resources
      See Also:
    • getProvisioner

      public ResourceProvisioner getProvisioner(Class<? extends ResourceManageable> resourceClass)
      Description copied from interface: Host
      Gets the ResourceProvisioners that manages a Host resource such as Ram, Bandwidth and Pe.
      Specified by:
      getProvisioner in interface Host
      Parameters:
      resourceClass - the class of the resource to get its provisioner
      Returns:
      the ResourceProvisioner for the given resource class
    • getWorkingPeList

      public List<Pe> getWorkingPeList()
      Description copied from interface: Host
      Gets the list of working Processing Elements (PEs) of the host. It's the list of all PEs which are not FAILEd.
      Specified by:
      getWorkingPeList in interface Host
      Returns:
      the list working (non-failed) Host PEs
    • getBusyPeList

      public List<Pe> getBusyPeList()
      Description copied from interface: Host
      Gets the list of working Processing Elements (PEs) of the host, which excludes failed PEs.
      Specified by:
      getBusyPeList in interface Host
      Returns:
      the list working (non-failed) Host PEs
    • getFreePeList

      public List<Pe> getFreePeList()
      Description copied from interface: Host
      Gets the list of Free Processing Elements (PEs) of the host, which excludes failed PEs.
      Specified by:
      getFreePeList in interface Host
      Returns:
      the list free (non-failed) Host PEs
    • getCpuPercentUtilization

      public double getCpuPercentUtilization()
      Description copied from interface: Host
      Gets the current percentage of CPU capacity (MIPS %) used by all running VMs. It represents the actual percentage of MIPS allocated.
      Specified by:
      getCpuPercentUtilization in interface Host
      Returns:
      total CPU utilization percentage (between [0 and 1]) for the current time
    • getCpuPercentRequested

      public double getCpuPercentRequested()
      Description copied from interface: Host
      Gets the percentage of CPU capacity (MIPS %) requested by all running VMs at the current time. It represents the percentage of MIPS requested, which may be higher than the percentage used (allocated) due to lack of capacity.
      Specified by:
      getCpuPercentRequested in interface Host
      Returns:
      the percentage (between [0 and 1]) of CPU capacity requested
    • getCpuMipsUtilization

      public double getCpuMipsUtilization()
      Description copied from interface: Host
      Gets the current total utilization of CPU in MIPS, considering the usage of all its PEs.
      Specified by:
      getCpuMipsUtilization in interface Host
      Returns:
    • getRamUtilization

      public long getRamUtilization()
      Description copied from interface: Host
      Gets the current utilization of memory (in Megabytes).
      Specified by:
      getRamUtilization in interface Host
      Returns:
    • getBwUtilization

      public long getBwUtilization()
      Description copied from interface: Host
      Gets the current utilization of bw (in Megabits/s).
      Specified by:
      getBwUtilization in interface Host
      Returns:
    • getCpuUtilizationStats

      public HostResourceStats getCpuUtilizationStats()
      Description copied from interface: Host
      Gets machine's CPU utilization percentage statistics (between [0 and 1]).

      WARNING: You need to enable the data collection and computation of statistics by calling ResourceStatsComputer.enableUtilizationStats().

      The time interval in which utilization is collected is defined by the Datacenter.getSchedulingInterval().

      It uses the utilization statistics from its VMs to provide the overall Host's CPU utilization. However, for this method to return any data, you need to enable the statistics computation for every VM it owns.
      Specified by:
      getCpuUtilizationStats in interface Host
      Specified by:
      getCpuUtilizationStats in interface ResourceStatsComputer<HostResourceStats>
      Returns:
    • enableUtilizationStats

      public void enableUtilizationStats()
      Description copied from interface: Host
      Enables the data collection and computation of utilization statistics. It iterates over all existing VMs enabling the statistics computation on every one. But keep in mind that when a Host is created, it has no VM. Therefore, you need to call this method for every VM if you are enabling the computation before the simulation starts and VM placement is performed.
      Specified by:
      enableUtilizationStats in interface Host
      Specified by:
      enableUtilizationStats in interface ResourceStatsComputer<HostResourceStats>
      See Also:
    • getPowerModel

      public PowerModelHost getPowerModel()
      Description copied from interface: Host
      Gets the PowerModelHost used by the host to define how it consumes power. A Host just provides power usage data if a PowerModel is set.
      Specified by:
      getPowerModel in interface Host
      Specified by:
      getPowerModel in interface PowerAware<PowerModelHost>
      Returns:
      the Host's PowerModelHost
    • setPowerModel

      public final void setPowerModel(PowerModelHost powerModel)
      Description copied from interface: Host
      Sets the PowerModelHost used by the host to define how it consumes power. A Host just provides power usage data if a PowerModel is set.
      Specified by:
      setPowerModel in interface Host
      Specified by:
      setPowerModel in interface PowerAware<PowerModelHost>
      Parameters:
      powerModel - the PowerModelHost to set
    • enableStateHistory

      public void enableStateHistory()
      Description copied from interface: Host
      Enables storing Host state history.
      Specified by:
      enableStateHistory in interface Host
      See Also:
    • disableStateHistory

      public void disableStateHistory()
      Description copied from interface: Host
      Disable storing Host state history.
      Specified by:
      disableStateHistory in interface Host
      See Also:
    • isStateHistoryEnabled

      public boolean isStateHistoryEnabled()
      Description copied from interface: Host
      Checks if Host state history is being collected and stored.
      Specified by:
      isStateHistoryEnabled in interface Host
      Returns:
    • getFinishedVms

      public List<Vm> getFinishedVms()
      Description copied from interface: Host
      Gets the List of VMs that have finished executing.
      Specified by:
      getFinishedVms in interface Host
      Returns:
    • getStateHistory

      public List<HostStateHistoryEntry> getStateHistory()
      Description copied from interface: Host
      Gets a read-only host state history. This List is just populated if Host.isStateHistoryEnabled()
      Specified by:
      getStateHistory in interface Host
      Returns:
      the state history
      See Also:
    • getMigratableVms

      public List<Vm> getMigratableVms()
      Description copied from interface: Host
      Gets the list of migratable VMs from a given host.
      Specified by:
      getMigratableVms in interface Host
      Returns:
      the list of migratable VMs
    • isLazySuitabilityEvaluation

      public boolean isLazySuitabilityEvaluation()
      Checks if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such as Host.isSuitableForVm(Vm). It means that the method will return as soon as some resource requirement is not met and the suitability for other VM requirements is not evaluated. This laziness improves performance but provides less information when calling Host.getSuitabilityFor(Vm).

      It's enabled by default.

      Specified by:
      isLazySuitabilityEvaluation in interface Host
      Returns:
      true if the lazy evaluation is enabled, false otherwise
    • setLazySuitabilityEvaluation

      public Host setLazySuitabilityEvaluation(boolean lazySuitabilityEvaluation)
      Description copied from interface: Host
      Defines if the suitability evaluation of this Host for a given Vm is to be performed lazily by methods such as Host.isSuitableForVm(Vm). It means that the method will return as soon as some resource requirement is not met and the suitability for other VM requirements is not evaluated. This laziness improves performance but provides less information when calling Host.getSuitabilityFor(Vm).
      Specified by:
      setLazySuitabilityEvaluation in interface Host
    • isActivateOnDatacenterStartup

      public boolean isActivateOnDatacenterStartup()
      Indicates if the Host must be automatically started up when the assigned Datacenter is started up.
      Returns: