Package com.io7m.waxmill.machines
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.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWXMCPUTopology.BuilderBuilds instances of typeWXMCPUTopology.Nested classes/interfaces inherited from interface com.io7m.waxmill.machines.WXMCPUTopologyType
WXMCPUTopologyType.WXMPinCPUType -
Method Summary
Modifier and Type Method Description static WXMCPUTopology.Builderbuilder()Creates a builder forWXMCPUTopology.java.lang.Stringcomment()static WXMCPUTopologycopyOf(WXMCPUTopologyType instance)Creates an immutable copy of aWXMCPUTopologyTypevalue.intcores()intcpus()booleanequals(java.lang.Object another)This instance is equal to all instances ofWXMCPUTopologythat have equal attribute values.inthashCode()Computes a hash code from attributes:sockets,threads,cores,cpus,comment,pinnedCPUs.java.util.List<WXMPinCPU>pinnedCPUs()intsockets()intthreads()java.lang.StringtoString()Prints the immutable valueWXMCPUTopologywith attribute values.WXMCPUTopologywithComment(java.lang.String value)Copy the current immutable object by setting a value for thecommentattribute.WXMCPUTopologywithCores(int value)Copy the current immutable object by setting a value for thecoresattribute.WXMCPUTopologywithCpus(int value)Copy the current immutable object by setting a value for thecpusattribute.WXMCPUTopologywithPinnedCPUs(WXMPinCPU... elements)Copy the current immutable object with elements that replace the content ofpinnedCPUs.WXMCPUTopologywithPinnedCPUs(java.lang.Iterable<? extends WXMPinCPU> elements)Copy the current immutable object with elements that replace the content ofpinnedCPUs.WXMCPUTopologywithSockets(int value)Copy the current immutable object by setting a value for thesocketsattribute.WXMCPUTopologywithThreads(int value)Copy the current immutable object by setting a value for thethreadsattribute.
-
Method Details
-
sockets
public int sockets()- Specified by:
socketsin interfaceWXMCPUTopologyType- Returns:
- The number of sockets
-
threads
public int threads()- Specified by:
threadsin interfaceWXMCPUTopologyType- Returns:
- The number of threads per core
-
cores
public int cores()- Specified by:
coresin interfaceWXMCPUTopologyType- Returns:
- The number of cores per socket
-
cpus
public int cpus()- Specified by:
cpusin interfaceWXMCPUTopologyType- Returns:
- The total number of CPU elements
-
comment
public java.lang.String comment()- Specified by:
commentin interfaceWXMCPUTopologyType- Returns:
- A descriptive comment
-
pinnedCPUs
- Specified by:
pinnedCPUsin interfaceWXMCPUTopologyType- Returns:
- The list of CPU pinning instructions
-
withSockets
Copy the current immutable object by setting a value for thesocketsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for sockets- Returns:
- A modified copy of the
thisobject
-
withThreads
Copy the current immutable object by setting a value for thethreadsattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for threads- Returns:
- A modified copy of the
thisobject
-
withCores
Copy the current immutable object by setting a value for thecoresattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for cores- Returns:
- A modified copy of the
thisobject
-
withCpus
Copy the current immutable object by setting a value for thecpusattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for cpus- Returns:
- A modified copy of the
thisobject
-
withComment
Copy the current immutable object by setting a value for thecommentattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for comment- Returns:
- A modified copy of the
thisobject
-
withPinnedCPUs
Copy the current immutable object with elements that replace the content ofpinnedCPUs.- Parameters:
elements- The elements to set- Returns:
- A modified copy of
thisobject
-
withPinnedCPUs
Copy the current immutable object with elements that replace the content ofpinnedCPUs. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
elements- An iterable of pinnedCPUs elements to set- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofWXMCPUTopologythat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:sockets,threads,cores,cpus,comment,pinnedCPUs.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueWXMCPUTopologywith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
Creates an immutable copy of aWXMCPUTopologyTypevalue. 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
Creates a builder forWXMCPUTopology.WXMCPUTopology.builder() .setSockets(int) // optionalsockets.setThreads(int) // optionalthreads.setCores(int) // optionalcores.setCpus(int) // optionalcpus.setComment(String) // optionalcomment.addPinnedCPUs|addAllPinnedCPUs(WXMPinCPU) //pinnedCPUselements .build();- Returns:
- A new WXMCPUTopology builder
-