检测处理器的数量 [英] Detecting the number of processors
问题描述
您如何检测.NET物理处理器/核心的数量?
System.Environment.ProcessorCount
返回逻辑处理器的数量
<一个href="http://msdn.microsoft.com/en-us/library/system.environment.processorcount.aspx">http://msdn.microsoft.com/en-us/library/system.environment.processorcount.aspx
有关物理处理器数量你可能需要使用WMI - 下面的元数据支持XP / WIN2K3向上(功能启用SP事先到Vista / Win2k8)
Win32_ComputerSystem.NumberOfProcessors 返回盘点
Win32_ComputerSystem.NumberOfLogicalProcessors 返回逻辑(废话!)
要谨慎的超线程CPU出现相同的multicore'd CPU的又性能特性的非常的不同。
要检查是否有支持HT的CPU检测Win32_Processor的每个实例和比较这两个属性。
Win32_Processor.NumberOfLogicalProcessors
Win32_Processor.NumberOfCores
在多核系统中,这些通常是相同的值。
How do you detect the number of physical processors/cores in .net?
System.Environment.ProcessorCount
returns the number of logical processors
http://msdn.microsoft.com/en-us/library/system.environment.processorcount.aspx
For physical processor count you'd probably need to use WMI - the following metadata is supported in XP/Win2k3 upwards (Functionality enabled in SP's prior to Vista/Win2k8).
Win32_ComputerSystem.NumberOfProcessors returns physical count
Win32_ComputerSystem.NumberOfLogicalProcessors returns logical (duh!)
Be cautious that HyperThreaded CPUs appear identical to multicore'd CPU's yet the performance characteristics are very different.
To check for HT-enabled CPUs examine each instance of Win32_Processor and compare these two properties.
Win32_Processor.NumberOfLogicalProcessors
Win32_Processor.NumberOfCores
On multicore systems these are typically the same the value.
这篇关于检测处理器的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!