.net c# 通过ManagementClass初始化Win32_Processor信息,遍历获取CUP中央处理器详细信息
源码:
/// <summary>
/// 其它硬件信息
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public string PhicnalInfo()
{
StringBuilder str = new StringBuilder();
string name = "Win32_Processor";
ManagementClass osClass = new ManagementClass(name);
foreach (ManagementObject obj in osClass.GetInstances())
{
PropertyDataCollection pdc = obj.Properties;
foreach (PropertyData pd in pdc)
{
str.AppendLine(string.Format("{0}: {1}", pd.Name, pd.Value));
}
}
return str.ToString();
}
执行结果:
AddressWidth: 64
Architecture: 9
AssetTag: Fill By OEM
Availability: 3
Caption: Intel64 Family 6 Model 60 Stepping 3
Characteristics: 4
ConfigManagerErrorCode:
ConfigManagerUserConfig:
CpuStatus: 1
CreationClassName: Win32_Processor
CurrentClockSpeed: 3401
CurrentVoltage: 10
DataWidth: 64
Description: Intel64 Family 6 Model 60 Stepping 3
DeviceID: CPU0
ErrorCleared:
ErrorDescription:
ExtClock: 100
Family: 179
InstallDate:
L2CacheSize: 1024
L2CacheSpeed:
L3CacheSize: 8192
L3CacheSpeed: 0
LastErrorCode:
Level: 6
LoadPercentage: 8
Manufacturer: GenuineIntel
MaxClockSpeed: 3401
Name: Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
NumberOfCores: 4
NumberOfEnabledCore: 1
NumberOfLogicalProcessors: 8
OtherFamilyDescription:
PartNumber: Fill By OEM
PNPDeviceID:
PowerManagementCapabilities:
PowerManagementSupported: False
ProcessorId: BFEBFBFF000306C3
ProcessorType: 3
Revision: 15363
Role: CPU
SecondLevelAddressTranslationExtensions: True
SerialNumber:
SocketDesignation: SOCKET 0
Status: OK
StatusInfo: 3
Stepping:
SystemCreationClassName: Win32_ComputerSystem
SystemName: WIN-SHENGWU
ThreadCount: 2
UniqueId:
UpgradeMethod: 1
Version:
VirtualizationFirmwareEnabled: True
VMMonitorModeExtensions: True
VoltageCaps:
图片展示效果: