Class WXMCPUTopology

java.lang.Object
com.io7m.waxmill.machines.WXMCPUTopology
All Implemented Interfaces:
WXMCPUTopologyType

public final class WXMCPUTopology
extends java.lang.Object
implements WXMCPUTopologyType
The CPU topology for the virtual machine. The default value for each of cpus, sockets, cores, and threads is 1. The current maximum number of guest virtual CPUs is 16. If cpus is not specified then it will be calculated from the other arguments. The topology must be consistent in that the cpus must equal the product of sockets, cores, and threads. If a setting is specified more than once the last one has precedence.
  • Method Details

    • sockets

      public int sockets()
      Specified by:
      sockets in interface WXMCPUTopologyType
      Returns:
      The number of sockets
    • threads

      public int threads()
      Specified by:
      threads in interface WXMCPUTopologyType
      Returns:
      The number of threads per core
    • cores

      public int cores()
      Specified by:
      cores in interface WXMCPUTopologyType
      Returns:
      The number of cores per socket
    • cpus

      public int cpus()
      Specified by:
      cpus in interface WXMCPUTopologyType
      Returns:
      The total number of CPU elements
    • comment

      public java.lang.String comment()
      Specified by:
      comment in interface WXMCPUTopologyType
      Returns:
      A descriptive comment
    • pinnedCPUs

      public java.util.List<WXMPinCPU> pinnedCPUs()
      Specified by:
      pinnedCPUs in interface WXMCPUTopologyType
      Returns:
      The list of CPU pinning instructions
    • withSockets

      public final WXMCPUTopology withSockets​(int value)
      Copy the current immutable object by setting a value for the sockets attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for sockets
      Returns:
      A modified copy of the this object
    • withThreads

      public final WXMCPUTopology withThreads​(int value)
      Copy the current immutable object by setting a value for the threads attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for threads
      Returns:
      A modified copy of the this object
    • withCores

      public final WXMCPUTopology withCores​(int value)
      Copy the current immutable object by setting a value for the cores attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for cores
      Returns:
      A modified copy of the this object
    • withCpus

      public final WXMCPUTopology withCpus​(int value)
      Copy the current immutable object by setting a value for the cpus attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for cpus
      Returns:
      A modified copy of the this object
    • withComment

      public final WXMCPUTopology withComment​(java.lang.String value)
      Copy the current immutable object by setting a value for the comment attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for comment
      Returns:
      A modified copy of the this object
    • withPinnedCPUs

      public final WXMCPUTopology withPinnedCPUs​(WXMPinCPU... elements)
      Copy the current immutable object with elements that replace the content of pinnedCPUs.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withPinnedCPUs

      public final WXMCPUTopology withPinnedCPUs​(java.lang.Iterable<? extends WXMPinCPU> elements)
      Copy the current immutable object with elements that replace the content of pinnedCPUs. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of pinnedCPUs elements to set
      Returns:
      A modified copy of this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of WXMCPUTopology that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: sockets, threads, cores, cpus, comment, pinnedCPUs.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value WXMCPUTopology with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • copyOf

      public static WXMCPUTopology copyOf​(WXMCPUTopologyType instance)
      Creates an immutable copy of a WXMCPUTopologyType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable WXMCPUTopology instance
    • builder

      public static WXMCPUTopology.Builder builder()
      Creates a builder for WXMCPUTopology.
       WXMCPUTopology.builder()
          .setSockets(int) // optional sockets
          .setThreads(int) // optional threads
          .setCores(int) // optional cores
          .setCpus(int) // optional cpus
          .setComment(String) // optional comment
          .addPinnedCPUs|addAllPinnedCPUs(WXMPinCPU) // pinnedCPUs elements
          .build();
       
      Returns:
      A new WXMCPUTopology builder