Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB7
Expertise: Intermediate
Jun 15, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Determine type and number of CPUs

There is no method call that directly retuns information about the number and type of installed CPU(s). However, this information is stored in a few environment variables, so it's just a matter of extracting it with the Environment.GetEnvironmentVariable method:

' this code is meant to run under Windows NT, 2000, or XP
Console.WriteLine("Number of CPUs: {0}", Environment.GetEnvironmentVariable _
Console.WriteLine("CPU Architecture: {0}", Environment.GetEnvironmentVariable _
Console.WriteLine("CPU Identifier: {0}", Environment.GetEnvironmentVariable _
Console.WriteLine("CPU Level: {0}", Environment.GetEnvironmentVariable _
Console.WriteLine("CPU Revision: {0}", Environment.GetEnvironmentVariable _
This is a sample output produced by the previous code:

Number of CPUs: 1
CPU Architecture: x86
CPU Identifier: x86 Family 6 Model 6 Stepping 2, AuthenticAMD
CPU Level: 6
CPU Revision: 0602
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date