views:

827

answers:

1

On a dual quad-core GetProcessAffinityMask (or the dialog from "Set affinity" in taskman.exe) will report eight logical processors. How do I find out which logical processor is on which physical processor? Especially: which logical processors are on the same physical processor?

EDIT: If it is not possible to do this programmatically, do anyone just know what the normal mapping is? Are the first four on the first processor and the second four on the second or are the odd numbered on the first and the even numbered on the second?

+5  A: 

You can use Win32_Processor WMI class to query the number of cores, number of logical processors, architecture, cache memory and other information about the CPUs on the system.

To query information about the relationship between the logical processors in a system, you can use GetLogicalProcessorInformation API function.

Mehrdad Afshari
I can see how that allows me to detect that I am on a dual quad-core, but I do not see how it allows me to identify whether logical processor 1 is on the same physical processor as logical processor 2. I am missing something?
Rasmus Faber
I think this API function better suits your specific need.
Mehrdad Afshari
Thanks, I did not see your edit. GetLogicalProcessorInformation is exactly what I need.
Rasmus Faber