Re: How do I get the PC's Processor speed?



On Nov 6, 1:35 pm, "Chris Mellon" <arka...@xxxxxxxxx> wrote:
On Nov 6, 2007 1:18 PM, <kyoso...@xxxxxxxxx> wrote:



Hi,

We use a script here at work that runs whenever someone logs into
their machine that logs various bits of information to a database. One
of those bits is the CPU's model and speed. While this works in 95% of
the time, we have some fringe cases where the only thing returned is
the processor name. We use this data to help us decide which PCs need
to be updated, so it would be nice to have the processor speed in all
cases.

Currently, this script is run on Windows boxes only, most of which
have Windows XP on them. Right now I am having Python check the
following registry key for the CPU info: HKEY_LOCAL_MACHINE\HARDWARE\
\DESCRIPTION\\System\\CentralProcessor\\0

I've also used Tim Golden's WMI module like so:

<code>

import wmi
c = wmi.WMI()
for i in c.Win32_Processor ():
cputype = i.Name

</code>

On the problem PCs, both of these methods give me the same information
(i.e. only the processor name). However, if I go to "System
Properties" and look at the "General" tab, it lists the CPU name and
processor speed. Does anyone else know of another way to get at this
information?

You'd want the MaxClockSpeed property. There's a few other clock speed
properties as well, seehttp://msdn2.microsoft.com/en-us/library/aa394373.aspx.

MSDN should always be your first stop with WMI questions, by the way.

That's true, but I didn't just use WMI to try to get this information.
I also looked in the registry...although I forgot to mention that I
used the _winreg module to do so.

I did see that when I looked at Microsoft's Python scripts here:
http://www.microsoft.com/technet/scriptcenter/scripts/python/pyindex.mspx?mfr=true

MaxClockSpeed doesn't report the speed the same way MS does in the
System Properties, but I suppose I can work around that. Although this
will make AMD 3800+ procs look much slower (i.e. 2.4 Ghz in this
case).

Mike

.



Relevant Pages

  • Re: How do I get the PCs Processor speed?
    ... following registry key for the CPU info: ... You'd want the MaxClockSpeed property. ... MSDN should always be your first stop with WMI questions, ... System Properties, but I suppose I can work around that. ...
    (comp.lang.python)
  • Re: How do I get the PCs Processor speed?
    ... AMD has historically used model numbers that are slightly higher than the actual clock speed. ... You'd want the MaxClockSpeed property. ... MSDN should always be your first stop with WMI questions, ... System Properties, but I suppose I can work around that. ...
    (comp.lang.python)