Class CpuCore


  • public class CpuCore
    extends java.lang.Object
    Core information linked to logical CPUs.
    Author:
    Daniel Sagenschneider
    • 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 - Possible Throwable 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 the CpuCore instances.
        Returns:
        CpuCore instances.
      • getCoreId

        public int getCoreId()
        Obtains the Core identifier.
        Returns:
        Core identifier.
      • getCoreAffinity

        public java.util.BitSet getCoreAffinity()
        Obtains the CpuCore BitSet affinity.
        Returns:
        CpuCore BitSet affinity.