Home > Software engineering >  GetLogicalProcessorInformationEx how to use?
GetLogicalProcessorInformationEx how to use?

Time:11-07

As title, GetLogicalProcessorInformationEx this API how to use?
https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlogicalprocessorinformationex
This is the official document, need a source code examples!!!!!!

The second problem is that I use this function, use the header files & lt; Windows. H> Or & lt; Sysinfoapi. H> , bosses are still complains, give advice or comments!!!!!!

CodePudding user response:

 
The decltype (GetLogicalProcessorInformationEx) * _GetLogicalProcessorInformationEx=NULL;

PInfo SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *;
BYTE bzData [4096].
DWORD dwSize;
BOOL bRetVal;

NSys: : GetProcAddress call (& amp; _GetLogicalProcessorInformationEx, "Kernel32. DLL GetLogicalProcessorInformationEx", "");
//the equivalent API GetProcAddress call

PInfo=(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *) bzData;
DwSize=sizeof (bzData);
BRetVal=_GetLogicalProcessorInformationEx (RelationProcessorCore pInfo, & amp; DwSize);

Int nCoreCount=dwSize/pInfo - & gt; The Size;
//this is the number of core


If an error to error messages sent to
In addition the API is not the same in different systems

CodePudding user response:

https://blog.csdn.net/xiaoyafang123/article/details/53374910

CodePudding user response:

reference 1st floor Yofoo response:
 
The decltype (GetLogicalProcessorInformationEx) * _GetLogicalProcessorInformationEx=NULL;

PInfo SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *;
BYTE bzData [4096].
DWORD dwSize;
BOOL bRetVal;

NSys: : GetProcAddress call (& amp; _GetLogicalProcessorInformationEx, "Kernel32. DLL GetLogicalProcessorInformationEx", "");
//the equivalent API GetProcAddress call

PInfo=(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *) bzData;
DwSize=sizeof (bzData);
BRetVal=_GetLogicalProcessorInformationEx (RelationProcessorCore pInfo, & amp; DwSize);

Int nCoreCount=dwSize/pInfo - & gt; The Size;
//this is the number of core


If an error to error messages sent to
In addition the API is not the same in different system


Yes, is this meaning, I was under the Windows 7 use VS2008, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX doesn't recognize all these structures, an error is as follows:

CodePudding user response:

Older versions of the compiler won't have some of the new structure of the new system, you can update the VS version, or manually define the structure of the copied
And the way of API also can only use GetProcAddress call

CodePudding user response:

refer to 6th floor Yofoo response:
older versions of the compiler won't have some of the new structure of the new system, you can update the VS version, or manually define the structure of the copied
And the way of API also can only use GetProcAddress call


Yes, the current solution is my own all these structure defines it again, but there is a problem is according to the structure, GetLogicalProcessorInformationEx and GetLogicalProcessorInformation results seems to be the same? But see information not only support with the EX 64 nuclear machine, with the EX is unlimited, is that so?
I want to make with the EX API is because we have a client computer is double CPU 128 nuclear 256 thread, used before without the EX API has been unable to get correct information, to bring the EX after can get correct?

CodePudding user response:

Whether or not to bring the Ex should be related to the operating system, if unable to get should obtain error error code,
More than 128 nuclear 256 thread core should allocate more, or you will fail

CodePudding user response:

refer to the eighth floor Yofoo response:
whether or not to bring the Ex should be related to the operating system, if you cannot access should get error error code,
When more than 128 nuclear 256 thread core should allocate more, or you will fail


In the 128 nuclear 256 threads to use the API without the EX machine, did not return an error code, just read to the number of threads is 64,
This API is also related to memory?
  • Related