Package net.officefloor.web.executive
Class CpuCore
- java.lang.Object
-
- net.officefloor.web.executive.CpuCore
-
public class CpuCore extends java.lang.Object
Core information linked to logical CPUs.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
CpuCore.CustomExecution<R,T extends java.lang.Throwable>
FunctionalInterface
for customCpuLayout
execution.static class
CpuCore.LogicalCpu
Logical CPU on a Core.
-
Constructor Summary
Constructors Constructor Description CpuCore(int coreId, java.util.BitSet coreAffinity, CpuCore.LogicalCpu[] cpus)
Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.BitSet
getCoreAffinity()
Obtains theCpuCore
BitSet
affinity.int
getCoreId()
Obtains the Core identifier.static CpuCore[]
getCores()
Obtains theCpuCore
instances.CpuCore.LogicalCpu[]
getCpus()
Obtains theCpuCore.LogicalCpu
instances on thisCpuCore
.static <R,T extends java.lang.Throwable>
RrunWithCpuLayout(net.openhft.affinity.CpuLayout layout, CpuCore.CustomExecution<R,T> customExecution)
Runs with customCpuLayout
.
-
-
-
Constructor Detail
-
CpuCore
public CpuCore(int coreId, java.util.BitSet coreAffinity, CpuCore.LogicalCpu[] cpus)
Instantiate.- Parameters:
coreId
- Core identifier.coreAffinity
- AffinityBitSet
for allCpuCore.LogicalCpu
instances on theCpuCore
.cpus
-CpuCore.LogicalCpu
instances for theCpuCore
.
-
-
Method Detail
-
runWithCpuLayout
public static <R,T extends java.lang.Throwable> R runWithCpuLayout(net.openhft.affinity.CpuLayout layout, CpuCore.CustomExecution<R,T> customExecution) throws T extends java.lang.Throwable
Runs with custom
CpuLayout
.This for example, allows restricting access to particular CPU cores or logical CPUs.
- Type Parameters:
R
- Return type.T
- PossibleThrowable
type.- Parameters:
layout
-CpuLayout
.customExecution
-CpuCore.CustomExecution
.- Returns:
- Possible return value.
- Throws:
T
- Failure on running.T extends java.lang.Throwable
-
getCores
public static CpuCore[] getCores()
Obtains theCpuCore
instances.- Returns:
CpuCore
instances.
-
getCoreId
public int getCoreId()
Obtains the Core identifier.- Returns:
- Core identifier.
-
getCoreAffinity
public java.util.BitSet getCoreAffinity()
Obtains theCpuCore
BitSet
affinity.- Returns:
CpuCore
BitSet
affinity.
-
getCpus
public CpuCore.LogicalCpu[] getCpus()
Obtains theCpuCore.LogicalCpu
instances on thisCpuCore
.- Returns:
CpuCore.LogicalCpu
instances on thisCpuCore
.
-
-