There are several different processor information that you can get information about: The number of physical processors, core quantities, and number of logical processors, which can be different. Two dual-core Hyper-Threading (enabled) processors are available in the case of 2 physical processors, 4 cores, and 8 logical processors.
The number of logical processors is obtained through the environment class, but other information is available only through WMI (you may need to install some patches or service packs):
Physical Processor:
foreach (var item in the New System.Management.ManagementObjectSearcher ("SELECT * from Win32_ComputerSystem"). Get ())
{
Console.WriteLine ("Number of physical processors: {0}", item["NumberOfProcessors"]);
Kernel:
int corecount = 0;
foreach (var item in the New System.Management.ManagementObjectSearcher ("SELECT * from Win32_Processor"). Get ())
{
corecount = Int. Parse (item["NumberOfCores"). ToString ());
}
Console.WriteLine ("Number of cores: {0}", Corecount);
Logical Processor:
Console.WriteLine("Number Of Logical Processors: {0}", Environment.ProcessorCount);
Or
foreach (var item in the New System.Management.ManagementObjectSearcher ("SELECT * from Win32_ComputerSystem"). Get ())
{
Console.WriteLine ("Number of Logical processors: {0}", item["numberoflogicalprocessors"]);
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, but also hope that a lot of support cloud Habitat community!