"not_a_commie" <no********@gmail.comwrote in message
news:11********************@j4g2000prf.googlegroup s.com...
>No, but if you are only interested in a single CPU's properties, you can
do
the following to get at a specific instance.
...
socketType = service.Properties["SocketDesignation"].Value.ToString();
I'm interested in the count of unique SocketDesignation values --
nothing else. It's creating instances of these objects that takes the
time, not the WQL. I was hoping to get all the information I needed
using WQL.
What takes time is starting up the WMI service (when not actually running)
and connecting to the WMI Service (through LPC for local connections and
DCOM over SMB for remote connections). Creating an instance takes no
measurable time as these are static instances , stored in WMI's metabase. On
the slowest box available, the query below took less than 700msecs. to
finish the first query, following queries, that is after WMI was running,
finished in less than 150msec. Did you actually instrumented your code, in
order to see what is taking most of the time?
Note that GetInstances returns all instances of the class, that means that
the number of instances IS the number of sockets.
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection mos = mc.GetInstances();
int sockets = mos.Count;
Willy.