检测处理器的数量 [英] Detecting the number of processors

查看:197
本文介绍了检测处理器的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何检测.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆