If the function fails, the return value is FALSE. To get extended error information, call
GetLogicalProcessorInformation can be used to get information about the relationship between logical processors in the system, including:
The logical processors that are part of a NUMA node.
The logical processors that share resources. An example of this type of resource sharing would be hyperthreading scenarios.
Your application can use this information when affinitizing your threads and processes to take best advantage of the hardware properties of the platform, or to determine the number of logical and physical processors for licensing purposes.
A logical processor affinity mask, which indicates the logical processors that the information in the structure applies to.
A logical processor mask of type LOGICAL_PROCESSOR_RELATIONSHIP, which indicates the relationship between the logical processors in the mask. Applications calling this function must be prepared to handle additional indicator values in the future.
Note that the order in which the structures are returned in the buffer may change between calls to this function.
The size of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION structure varies between processor architectures and versions of Windows. For this reason, applications should first call this function to obtain the required buffer size, then dynamically allocate memory for the buffer.
On systems with more than 64 logical processors, the GetLogicalProcessorInformation function retrieves logical processor information about processors in the processor group to which the calling thread is currently assigned. Use the GetLogicalProcessorInformationEx function to retrieve information about processors in all processor groups on the system.
The following C++ example uses the GetLogicalProcessorInformation function to display information about processors on the current system. Because GetLogicalProcessorInformation is not present on all systems, this example uses the GetProcAddress function instead of calling GetLogicalProcessorInformation directly.
This example reports the number of active processor cores. This example also reports the number of NUMA nodes, physical packages, and caches on systems that support this information. For more information, see the description of the Relationship member of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION structure. Windows Server 2003, Windows XP Professional x64 Edition and Windows XP with SP3: This example reports the number of physical processors rather than the number of active processor cores.