Kafu, just tried your script - and it returned 4 logical processors. (I have 4 cores, no hyperthreading, so.. ernnhh!! fail!) Sorry! hehe
But you inspired me to try out the 'GetLogicalProcessorInformation' API function (available for O/S's with XP SP3, XP x64, or Server 2003 and above)
What I got, after figuring out the structures and creating a loop to go through them, was the below confusing mess. I can probably ignore the 'Cache' structure info, but how I can determine what logical processors exist, I don't know yet. I'd probably have to send the program I wrote to someone who has Hyperthreading or 'Logical cores'...
One of the problems with this Windows API call is that, not only does it have the above O/S requirements, some of the return values have *further* O/S requirements. Argh, frustrating..
Window's GetLogicalProcessorInformation call Results:
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #1
Processor Mask:00000001, Relationship:RelationProcessorCore
Processor Core Flags:0
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #2
Processor Mask:00000001, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheData
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #3
Processor Mask:00000001, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheInstruction
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #4
Processor Mask:00000002, Relationship:RelationProcessorCore
Processor Core Flags:0
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #5
Processor Mask:00000002, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheData
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #6
Processor Mask:00000002, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheInstruction
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #7
Processor Mask:00000003, Relationship:RelationCache
Cache Descriptor fields:
Level:2, Associativity:16, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:4194304, Cache type:CacheUnified
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #8
Processor Mask:00000004, Relationship:RelationProcessorCore
Processor Core Flags:0
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #9
Processor Mask:00000004, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheData
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #10
Processor Mask:00000004, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheInstruction
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #11
Processor Mask:0000000F, Relationship:RelationProcessorPackage
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #12
Processor Mask:00000008, Relationship:RelationProcessorCore
Processor Core Flags:0
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #13
Processor Mask:00000008, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheData
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #14
Processor Mask:00000008, Relationship:RelationCache
Cache Descriptor fields:
Level:1, Associativity:8, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:32768, Cache type:CacheInstruction
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #15
Processor Mask:0000000C, Relationship:RelationCache
Cache Descriptor fields:
Level:2, Associativity:16, (Cache) Line Size, in bytes:64, (Cache) Size, in bytes:4194304, Cache type:CacheUnified
-------------------------------------------------------------
Processor Information for SYSTEM_LOGICAL_PROCESSOR_INFORMATION, structure #16
Processor Mask:0000000F, Relationship:RelationNumaNode
NumaNode Node Number:0