By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

How to detect a multiprocessor host computer

P: n/a
Hi,

Is there a way to detect when my program is running on a multiprocessor host
computer?
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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" <rd*@nospam.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
Hi,

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

Nov 21 '05 #2

P: n/a
"Bob Altman" <rd*@nospam.com> schrieb:
Is there a way to detect when my program is running on a multiprocessor
host
computer?


\\\
Imports System
..
..
..
.... = Environment.GetEnvironmentVariable("NUMBER_OF_PROC ESSORS")
///

..NET 2.0: 'Environment.ProcessorCount'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

P: n/a
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.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uv**************@TK2MSFTNGP10.phx.gbl...
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" <rd*@nospam.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
Hi,

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

Nov 21 '05 #4

P: n/a
This is even easier than using the System.Management classes. Thanks!
Environment.GetEnvironmentVariable("NUMBER_OF_PROC ESSORS")

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.