How to detect a multiprocessor host computer

  • Thread starter Thread starter Bob Altman
  • Start date Start date
B

Bob Altman

Hi,

Is there a way to detect when my program is running on a multiprocessor host
computer?
 
Hi,

I believe you will get more than one record back in mutilprocessor
systems. Add a reference to system.management.dll.


Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Processor")

moReturn = moSearch.Get

For Each mo In moReturn

Dim strout As String = String.Format("{0} - {1}", mo("Name"),
mo("CurrentClockSpeed"))

Debug.WriteLine(strout)

Next



Ken
 
Bob Altman said:
Is there a way to detect when my program is running on a multiprocessor
host
computer?

\\\
Imports System
..
..
..
.... = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS")
///

..NET 2.0: 'Environment.ProcessorCount'.
 
Thanks, that's just what I was looking for. It's funny how these things
work... I just got through reading an article in either CoDe or MSDN
magazine where the author was touting the benefits of the dreaded WMI
wrapper classes.
 
This is even easier than using the System.Management classes. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top