473,287 Members | 3,319 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

How do I get the PC's Processor speed?

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?

Thanks!

Mike

Nov 6 '07 #1
11 6450
On Nov 6, 2007 1:18 PM, <ky******@gmail.comwrote:
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, see
http://msdn2.microsoft.com/en-us/library/aa394373.aspx.

MSDN should always be your first stop with WMI questions, by the way.
Nov 6 '07 #2
On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:
On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:
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/scr....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

Nov 6 '07 #3
On Nov 6, 2007 2:12 PM, <ky******@gmail.comwrote:
On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:
On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:
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/scr....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).

System Properties probably uses current clock speed, which will
usually be lower than max clock speed on modern processors, which
scale their speed with load.
Nov 6 '07 #4
http://www.linuxhardware.org/feature.../1514233.shtml

AMD has historically used model numbers that are slightly higher than
the actual clock speed. I have a 2300 that runs at 1.9.

-Jeff

On Nov 6, 2007, at 3:27 PM, Chris Mellon wrote:
On Nov 6, 2007 2:12 PM, <ky******@gmail.comwrote:
>On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:
>>On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:

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/scr....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).


System Properties probably uses current clock speed, which will
usually be lower than max clock speed on modern processors, which
scale their speed with load.
--
http://mail.python.org/mailman/listinfo/python-list
Nov 6 '07 #5
On Nov 6, 2:27 pm, "Chris Mellon" <arka...@gmail.comwrote:
On Nov 6, 2007 2:12 PM, <kyoso...@gmail.comwrote:
On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:
On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:
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/scr...python/pyindex....
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).

System Properties probably uses current clock speed, which will
usually be lower than max clock speed on modern processors, which
scale their speed with load.
I don't think so. For example, my PC has an "AMD Athlon(tm) 64
Processor 3800+", which is what's reported in System Properties. On
one of the problem PCs, System Properties lists it as "AMD Athlon(tm)
1.73 Ghz".

The 3800+ on my machine is reflected in the registry key I mentioned
and WMI also finds that somewhere. But the 1.73 Ghz is in neither of
these places. However, using MaxClockSpeed and dividing by 1000 along
with some string manipulation gets me closer...although I think this
may cause potential problems.

Thanks for the feedback.

Mike

Nov 6 '07 #6
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?
This information is hardware dependent and probably unreliable.

Why not run a benchmark and report the results instead?
Like bogomips? <URL:http://en.wikipedia.org/wiki/Bogomips>

Nov 6 '07 #7
On Nov 6, 2:51 pm, "Michael Bacarella" <m...@gpshopper.comwrote:
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?

This information is hardware dependent and probably unreliable.

Why not run a benchmark and report the results instead?
Like bogomips? <URL:http://en.wikipedia.org/wiki/Bogomips>
That's an interesting idea, but this is in a login script, so I can't
exactly run benchmarks while logging in as the users will get
impatient quite quickly. They already think the scripts take too long
as it is.

While this information may be unreliable, it is desired by my boss for
the express purpose of budgeting upgrades in our organization.

Thanks!

Mike

Nov 6 '07 #8
Is this a WMI function or a PyWin32 function? I guess I'm not seeing
how to actually implement this in Python. Sounds intriguing though.
Neither, nor. It's a Win32 function, period (not Py). You would have to
use ctypes or some such to call it. See

http://msdn2.microsoft.com/en-us/library/ms724509.aspx

Regards,
Martin
Nov 6 '07 #9
On Nov 6, 2007 3:09 PM, <ky******@gmail.comwrote:
On Nov 6, 2:51 pm, "Michael Bacarella" <m...@gpshopper.comwrote:
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?
This information is hardware dependent and probably unreliable.

Why not run a benchmark and report the results instead?
Like bogomips? <URL:http://en.wikipedia.org/wiki/Bogomips>

That's an interesting idea, but this is in a login script, so I can't
exactly run benchmarks while logging in as the users will get
impatient quite quickly. They already think the scripts take too long
as it is.

While this information may be unreliable, it is desired by my boss for
the express purpose of budgeting upgrades in our organization.
For this purpose, the make/model of the CPU is probably much more
useful than any measure (maximum or scaled) of the actual clock speed.
Incidentally, it's also faster to gather.
Nov 6 '07 #10
This information is hardware dependent and probably unreliable.

Why not run a benchmark and report the results instead?
Like bogomips? <URL:http://en.wikipedia.org/wiki/Bogomips>

That's an interesting idea, but this is in a login script, so I can't
exactly run benchmarks while logging in as the users will get
impatient quite quickly. They already think the scripts take too long
as it is.
Bogomips can be easily calculated in 10ms. The Linux kernel calculates it
during
system boot. There's an ANSI C utility floating around that you could
distribute.
Just a thought...
While this information may be unreliable, it is desired by my boss for
the express purpose of budgeting upgrades in our organization.
The information that gets displayed in the System Properties / General tab
is,
I believe, a string copied out of the CPU. I've had systems where it used
to simply say "Pentium" in that box as well. That's why it strikes me as
unreliable.

Executing the CPUID instruction may be helpful if you can figure out how
these guys are using it:
http://www.cpuid.com/cpuz.php

Nov 6 '07 #11
On Nov 6, 3:56 pm, "Michael Bacarella" <m...@gpshopper.comwrote:
This information is hardware dependent and probably unreliable.
Why not run a benchmark and report the results instead?
Like bogomips? <URL:http://en.wikipedia.org/wiki/Bogomips>
That's an interesting idea, but this is in a login script, so I can't
exactly run benchmarks while logging in as the users will get
impatient quite quickly. They already think the scripts take too long
as it is.

Bogomips can be easily calculated in 10ms. The Linux kernel calculates it
during
system boot. There's an ANSI C utility floating around that you could
distribute.
Just a thought...
While this information may be unreliable, it is desired by my boss for
the express purpose of budgeting upgrades in our organization.

The information that gets displayed in the System Properties / General tab
is,
I believe, a string copied out of the CPU. I've had systems where it used
to simply say "Pentium" in that box as well. That's why it strikes me as
unreliable.

Executing the CPUID instruction may be helpful if you can figure out how
these guys are using it:
http://www.cpuid.com/cpuz.php
Good point. I'm not sure where to start, but I may give it a whack
tomorrow if things stay quiet.

Thanks,

Mike

Nov 6 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tom Locke | last post by:
Hi All, I'd be grateful if anyone could provide insight into choosing a good i386 processor for Python performance. Are any of the following of particular importance, or less relevant, with...
1
by: santhosh_176 | last post by:
:I Created a Pocket PC application for iPAQ 5450. Every thing went fine even installer creation. I could run the setup and install it into the actual device and worked fine. The application enables...
5
by: Oliver Huppert | last post by:
Hi all, can someone tell me what I need to develop applications for PPC2003 with C#? I have read several meanings about this topic. Do I need Visual Studio .NET or is Visual C# .NET Standard...
17
by: Jim Strickland | last post by:
We currently are running a data intensive web service on a Mac using 4D. The developers of our site are looking at converting this web service to PostgreSQL. We will have a backup of our three...
0
by: rajkar001 | last post by:
Hi everybody, I would be glad if anybody can help me in retrieving a unique PC id. I believe only Processor id and MAC addr are unique for a PC. But MAC addr is unique until u do not change...
5
by: nano2k | last post by:
Hi I need to protect my application in a way. Just a "soft" protection, not a very strong one. So, using WMI I get the processor ID and compare it against a key. Protection works well, until...
5
blossam
by: blossam | last post by:
hi frnds, this is my first question, hope u will help me i want to find some uniw no from pc using which i can identify all pc uniqly like processor no, motherbord id or any processor serial no ...
5
by: Terry Metcalfe | last post by:
I have an Asus A696 pocket PC. I have written a small test program in VB6 called "Pocket PC" and compiled it just as I would normally do to run on my desk top. It runs on my desk top perfectly...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.