Interface OSNuma
- All Known Implementing Classes:
LinuxNuma,OSNuma.NoOp,OSNuma.PreCalculatedNuma
public interface OSNuma
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionint[]getCores(int numaId) Returns the cores associated with the specified NUMA node.intReturns the current core that this thread is running on.intReturns the current NUMA node that this thread is running on.long[]Returns the current thread's affinity mask.static OSNumaint[][]Returns an N by N array wherecost[i][j] = getNumaDistance(i,j)intgetNumaDistance(int n1, int n2) Returns the distance between the specified NUMA nodes.intgetNumaNode(int coreId) Returns the NUMA node associated with the specified core.intReturns the total number of cores on the system.intReturns the total number of nodes on the system.booleanReturns whether interaction with the OS for NUMA is available.default voidsetCurrentNumaAffinity(int[] numaNodes) Attempts to adjust the current thread's NUMA affinity mask to the specified list of numa nodes.default voidsetCurrentNumaAffinity(long[] to) Attempts to adjust the current thread's NUMA affinity mask to the specified bitset.voidsetCurrentThreadAffinity(long[] to) Attempts to adjust the current thread's affinity mask to the specified bitset.
-
Field Details
-
NUMA_DISTANCE_CANNOT_DETERMINE
static final int NUMA_DISTANCE_CANNOT_DETERMINE- See Also:
-
-
Method Details
-
getNativeInstance
-
isAvailable
boolean isAvailable()Returns whether interaction with the OS for NUMA is available. If no interaction is available, then the following applies:- There exists only one NUMA node including all the available processors.
-
Scheduling affinity methods will throw
UnsupportedOperationException
- Returns:
- Whether there exists native support to retrieve NUMA information and set scheduling affinity.
-
getNumaDistance
int getNumaDistance(int n1, int n2) Returns the distance between the specified NUMA nodes. The return values are defined by the ACPI SLIT table present on the system.- Parameters:
n1- First noden2- Second node- Returns:
- The distance between the NUMA nodes.
- See Also:
-
getTotalNumaNodes
int getTotalNumaNodes()Returns the total number of nodes on the system.- Returns:
- The total number of nodes on the system.
-
getNodeDistances
int[][] getNodeDistances()Returns an N by N array wherecost[i][j] = getNumaDistance(i,j)- Returns:
- The node distance matrix.
- See Also:
-
getNumaNode
int getNumaNode(int coreId) Returns the NUMA node associated with the specified core. If the core is not valid, then returns-1.- Parameters:
coreId- The specified core- Returns:
- The NUMA node for the core.
-
getTotalCores
int getTotalCores()Returns the total number of cores on the system.- Returns:
- The total number of cores on the system.
-
getCores
int[] getCores(int numaId) Returns the cores associated with the specified NUMA node. If the node is not valid, then returnsnull.Note that the returned array is not a bitset. It is simply a list of core numbers.
- Parameters:
numaId- The specified NUMA node.- Returns:
- The cores associated with the specified NUMA node.
-
getCurrentNumaNode
int getCurrentNumaNode()Returns the current NUMA node that this thread is running on. If NUMA interaction is not available, then0will be returned.- Returns:
- The current NUMA node that this thread is running on
-
getCurrentCore
int getCurrentCore()Returns the current core that this thread is running on. If NUMA interaction is not available, then0will be returned.- Returns:
- The current core this thread is running on
- See Also:
-
getCurrentThreadAffinity
long[] getCurrentThreadAffinity()Returns the current thread's affinity mask. If NUMA interaction is not available, then this function will return an undefined result.- Returns:
- The current thread's affinity mask.
- See Also:
-
setCurrentThreadAffinity
void setCurrentThreadAffinity(long[] to) Attempts to adjust the current thread's affinity mask to the specified bitset. If NUMA interaction is not available, then this function is a no-op.- Parameters:
to- Specified new affinity bitmask.- See Also:
-
setCurrentNumaAffinity
default void setCurrentNumaAffinity(long[] to) Attempts to adjust the current thread's NUMA affinity mask to the specified bitset. This is equivalent to invokingsetCurrentThreadAffinity(long[])with a bitmask specifying all cores present in the specified NUMA nodes. If NUMA interaction is not available, then this function is a no-op.- Parameters:
to- Specified new NUMA affinity bitmask.- See Also:
-
setCurrentNumaAffinity
default void setCurrentNumaAffinity(int[] numaNodes) Attempts to adjust the current thread's NUMA affinity mask to the specified list of numa nodes. This is equivalent to invokingsetCurrentThreadAffinity(long[])with a bitmask specifying all cores present in the specified NUMA nodes. If NUMA interaction is not available, then this function is a no-op.- Parameters:
numaNodes- Specified new NUMA nodes.- See Also:
-