Expand Minimize

GetLogicalProcessorInformationEx function

Retrieves information about the relationships of logical processors and related hardware.

Syntax


BOOL GetLogicalProcessorInformationEx(
  _In_       LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType,
  _Out_opt_  PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer,
  _Inout_    PDWORD ReturnedLength
);

Parameters

RelationshipType [in]

The type of relationship to retrieve. This parameter can be one of the following LOGICAL_PROCESSOR_RELATIONSHIP values.

ValueMeaning
RelationCache
2

Retrieves information about logical processors that share a cache.

RelationNumaNode
1

Retrieves information about logical processors that are part of the same NUMA node.

RelationProcessorCore
0

Retrieves information about logical processors that share a single processor core.

RelationProcessorPackage
3

Retrieves information about logical processors that share a physical package.

RelationGroup
4

Retrieves information about logical processors that share a processor group.

RelationAll
0xffff

Retrieves information about logical processors for all relationship types (cache, NUMA node, processor core, physical package, and processor group).

 

Buffer [out, optional]

A pointer to a buffer that receives an array of SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX structures. If the function fails, the contents of this buffer are undefined.

ReturnedLength [in, out]

On input, specifies the length of the buffer pointed to by Buffer, in bytes. If the buffer is large enough to contain all of the data, this function succeeds and ReturnedLength is set to the number of bytes returned. If the buffer is not large enough to contain all of the data, the function fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and ReturnedLength is set to the buffer length required to contain all of the data. If the function fails with an error other than ERROR_INSUFFICIENT_BUFFER, the value of ReturnedLength is undefined.

Return value

If the function succeeds, the return value is TRUE and at least one SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX structure is written to the output buffer.

If the function fails, the return value is FALSE. To get extended error information, call GetLastError.

Remarks

If a 32-bit process running under WOW64 calls this function on a system with more than 64 processors, some of the processor affinity masks returned by the function may be incorrect. This is because the high-order DWORD of the 64-bit KAFFINITY structure that represents all 64 processors is "folded" into a 32-bit KAFFINITY structure in the caller's buffer. As a result, the affinity masks for processors 32 through 63 are incorrectly represented as duplicates of the masks for processors 0 through 31. In addition, the sum of all per-group ActiveProcessorCount and MaximumProcessorCount values reported in PROCESSOR_GROUP_INFO structures may exclude some active logical processors.

When this function is called with a relationship type of RelationProcessorCore, it returns a PROCESSOR_RELATIONSHIP structure for every active processor core in every processor group in the system. This is by design, because an unaffinitized 32-bit thread can run on any logical processor in a given group, including processors 32 through 63. A 32-bit caller can use the total count of PROCESSOR_RELATIONSHIP structures to determine the actual number of active processor cores on the system. However, the affinity of a 32-bit thread cannot be explicitly set to logical processor 32 through 63 of any processor group.

To compile an application that uses this function, set _WIN32_WINNT >= 0x0601. For more information, see Using the Windows Headers.

Requirements

Minimum supported client

Windows 7 [desktop apps only]

Minimum supported server

Windows Server 2008 R2 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.