您如何检测.NET物理处理器/核心的数量?
解决方案 System.Environment.ProcessorCount
返回逻辑处理器的数量
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的又性能特性的非常的不同。
![电子市场潜规则 揭秘低端显卡以次充好](https://p.xsw88.cn/allimgs/daicuo/20230902/650.png)
要检查是否有支持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.
相关推荐
最新文章