Package oshi.hardware

Class CentralProcessor.LogicalProcessor

  • Enclosing interface:
    CentralProcessor

    @Immutable
    public static class CentralProcessor.LogicalProcessor
    extends java.lang.Object
    A class representing a Logical Processor and its replationship to physical processors, physical packages, and logical groupings such as NUMA Nodes and Processor groups, useful for identifying processor topology.
    • Field Detail

      • processorNumber

        private final int processorNumber
      • physicalProcessorNumber

        private final int physicalProcessorNumber
      • physicalPackageNumber

        private final int physicalPackageNumber
      • numaNode

        private final int numaNode
      • processorGroup

        private final int processorGroup
    • Constructor Detail

      • LogicalProcessor

        public LogicalProcessor​(int processorNumber,
                                int physicalProcessorNumber,
                                int physicalPackageNumber)
        Parameters:
        processorNumber - the Processor number
        physicalProcessorNumber - the core number
        physicalPackageNumber - the package/socket number
      • LogicalProcessor

        public LogicalProcessor​(int processorNumber,
                                int physicalProcessorNumber,
                                int physicalPackageNumber,
                                int numaNode)
        Parameters:
        processorNumber - the Processor number
        physicalProcessorNumber - the core number
        physicalPackageNumber - the package/socket number
        numaNode - the NUMA node number
      • LogicalProcessor

        public LogicalProcessor​(int processorNumber,
                                int physicalProcessorNumber,
                                int physicalPackageNumber,
                                int numaNode,
                                int processorGroup)
        Parameters:
        processorNumber - the Processor number
        physicalProcessorNumber - the core number
        physicalPackageNumber - the package/socket number
        numaNode - the NUMA node number
        processorGroup - the Processor Group number
    • Method Detail

      • getProcessorNumber

        public int getProcessorNumber()
        The Logical Processor number as seen by the Operating System. Used for assigning process affinity and reporting CPU usage and other statistics.
        Returns:
        the processorNumber
      • getPhysicalProcessorNumber

        public int getPhysicalProcessorNumber()
        The physical processor (core) id number assigned to this logical processor. Hyperthreaded logical processors which share the same physical processor will have the same number.
        Returns:
        the physicalProcessorNumber
      • getPhysicalPackageNumber

        public int getPhysicalPackageNumber()
        The physical package (socket) id number assigned to this logical processor. Multicore CPU packages may have multiple physical processors which share the same number.
        Returns:
        the physicalPackageNumber
      • getNumaNode

        public int getNumaNode()
        The NUMA node. If the operating system supports Non-Uniform Memory Access this identifies the node number. Set to 0 if the operating system does not support NUMA. Not supported on macOS or FreeBSD.
        Returns:
        the NUMA Node number
      • getProcessorGroup

        public int getProcessorGroup()
        The Processor Group. Only applies to Windows systems with more than 64 logical processors. Set to 0 for other operating systems or Windows systems with 64 or fewer logical processors.
        Returns:
        the processorGroup
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object