Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

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 _
    ("NUMBER_OF_PROCESSORS"))
Console.WriteLine("CPU Architecture: {0}", Environment.GetEnvironmentVariable _
    ("PROCESSOR_ARCHITECTURE"))
Console.WriteLine("CPU Identifier: {0}", Environment.GetEnvironmentVariable _
    ("PROCESSOR_IDENTIFIER"))
Console.WriteLine("CPU Level: {0}", Environment.GetEnvironmentVariable _
    ("PROCESSOR_LEVEL"))
Console.WriteLine("CPU Revision: {0}", Environment.GetEnvironmentVariable _
    ("PROCESSOR_REVISION"))
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.

 

 

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