如何获得PC的处理器速度? [英] How do I get the PC's Processor speed?

查看:67
本文介绍了如何获得PC的处理器速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我们在工作中使用一个脚本,只要有人登录到他们的机器,将各种信息记录到数据库就会运行。这些位中的一个是
是CPU的模型和速度。虽然这个时间占95%的时间,但我们有一些边缘情况,其中唯一返回的是处理器名称

。我们使用这些数据来帮助我们决定哪些PC需要更新,所以在所有

的情况下处理器速度会很高。


目前,这个脚本只在Windows机器上运行,其中大部分是b / b
。现在我正在使用Python查看以下注册表项后的$ / b $ b $:$ HK $ _ $ $ $ $ $ $ $ $ $ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ CentralProcessor \\ 0


我也使用了Tim Golden的WMI模块:


< code>


导入wmi

c = wmi.WMI()

for i in c.Win32_Processor():

cputype = i.Name


< / code>

在有问题的个人电脑上,这两种方法都让我一样信息

(即只有处理器名称)。但是,如果我转到系统

属性,并查看一般选项卡,它列出了CPU名称和

处理器速度。有没有其他人知道另一种获取这个

信息的方法?


谢谢!


Mike

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

推荐答案

2007年11月6日下午1:18,< ky ****** @ gmail.comwrote:
On Nov 6, 2007 1:18 PM, <ky******@gmail.comwrote:




我们在工作中使用一个脚本,只要有人登录他们的机器就会运行将各种信息记录到数据库中。这些位中的一个是
是CPU的模型和速度。虽然这个时间占95%的时间,但我们有一些边缘情况,其中唯一返回的是处理器名称

。我们使用这些数据来帮助我们决定哪些PC需要更新,所以在所有

的情况下处理器速度会很高。


目前,这个脚本只在Windows机器上运行,其中大部分是b / b
。现在我正在使用Python查看以下注册表项后的$ / b $ b $:$ HK $ _ $ $ $ $ $ $ $ $ $ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ CentralProcessor \\ 0


我也使用了Tim Golden的WMI模块:


< code>


导入wmi

c = wmi.WMI()

for i in c.Win32_Processor():

cputype = i.Name


< / code>

在有问题的个人电脑上,这两种方法都让我一样信息

(即只有处理器名称)。但是,如果我转到系统

属性,并查看一般选项卡,它列出了CPU名称和

处理器速度。有没有其他人知道另一种方法来获取这个

的信息?
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?



你需要MaxClockSpeed属性。还有一些其他时钟速度

属性,请参阅
http://msdn2.microsoft.com/en-us/library/aa394373.aspx


MSDN应该始终顺便说一句,这是你对WMI问题的第一站。

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.


11月6日下午1点35分,Chris Mellon < arka ... @ gmail.comwrote:
On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:

2007年11月6日下午1:18,< kyoso ... @ gmail.comwrote:
On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:

您好,
Hi,


我们在工作中使用脚本,只要有人登录就会运行br />
他们的机器将各种信息记录到数据库中。这些位中的一个是
是CPU的模型和速度。虽然这个时间占95%的时间,但我们有一些边缘情况,其中唯一返回的是处理器名称

。我们使用这些数据来帮助我们决定哪些PC需要更新,所以在所有

的情况下处理器速度会更好。
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.


目前,此脚本仅在Windows机器上运行,其中大多数是b
$ b。现在我正在使用Python查看以下注册表项后的$ / b $ b $:$ HK $ _ $ $ $ $ $ $ $ $ $ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ CentralProcessor \\\\
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


我也使用了Tim Golden的WMI模块:
I''ve also used Tim Golden''s WMI module like so:


< code>
<code>


import wmi

c = wmi.WMI()

for i in c.Win32_Processor ():

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


< / code>
</code>


在问题PC上,这两种方法都给我相同的信息

(即只有处理器名称)。但是,如果我转到系统

属性,并查看一般选项卡,它列出了CPU名称和

处理器速度。有没有其他人知道另一种获取这个

信息的方法?
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?



您需要MaxClockSpeed属性。还有一些其他的时钟速度

属性,请访问:http://msdn2.microsoft.com/en-us/library/aa394373.aspx。

$ b顺便说一下,$ b MSDN应该始终是WMI问题的第一站。


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.



这是真的,但我并没有使用WMI来尝试获取这些信息。

我也看了注册表...虽然我忘了提到我

使用了_winreg模块这样做。


当我看到微软时,我确实看到了这里的Python脚本:
http://www.microsoft.com/technet/scr....mspx?mfr=true


MaxClockSpeed并没有报告相同的速度MS在

系统属性中的作用,但我想我可以解决这个问题。虽然这个

会使AMD 3800+触发看起来慢得多(即这个

的情况下为2.4 Ghz)。


Mike

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


2007年11月6日下午2:12,< ky ****** @ gmail.comwrote:
On Nov 6, 2007 2:12 PM, <ky******@gmail.comwrote:

11月6日下午1点35分,Chris Mellon < arka ... @ gmail.comwrote:
On Nov 6, 1:35 pm, "Chris Mellon" <arka...@gmail.comwrote:

2007年11月6日下午1:18,< kyoso ... @ gmail.comwrote:
On Nov 6, 2007 1:18 PM, <kyoso...@gmail.comwrote:

您好,
Hi,


我们在工作中使用脚本,只要有人登录就会运行br />
他们的机器将各种信息记录到数据库中。这些位中的一个是
是CPU的模型和速度。虽然这个时间占95%的时间,但我们有一些边缘情况,其中唯一返回的是处理器名称

。我们使用这些数据来帮助我们决定哪些PC需要更新,所以在所有

的情况下处理器速度会更好。
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.


目前,此脚本仅在Windows机器上运行,其中大多数是b
$ b。现在我正在使用Python查看以下注册表项后的$ / b $ b $:$ HK $ _ $ $ $ $ $ $ $ $ $ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ CentralProcessor \\\\
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


我也使用了Tim Golden的WMI模块:
I''ve also used Tim Golden''s WMI module like so:


< code>
<code>


import wmi

c = wmi.WMI()

for i in c.Win32_Processor ():

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


< / code>
</code>


在问题PC上,这两种方法都给我相同的信息

(即只有处理器名称)。但是,如果我转到系统

属性,并查看一般选项卡,它列出了CPU名称和

处理器速度。有没有其他人知道另一种获取这个

信息的方法?
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?



您需要MaxClockSpeed属性。还有一些其他的时钟速度

属性,请访问:http://msdn2.microsoft.com/en-us/library/aa394373.aspx。

$ b顺便说一下,$ b MSDN应该始终是WMI问题的第一站。

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.



这是真的,但我并没有使用WMI来尝试获取这些信息。

我也看了注册表...虽然我忘了提到我

使用了_winreg模块这样做。


当我看到微软时,我确实看到了这里的Python脚本:
http://www.microsoft.com/technet/scr....mspx?mfr=true


MaxClockSpeed并没有报告相同的速度MS在

系统属性中的作用,但我想我可以解决这个问题。虽然这个

会使AMD 3800+触控看起来慢得多(即这个

的情况下为2.4 Ghz)。


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



系统属性可能使用当前时钟速度,这将在现代处理器上低于最大时钟速度,b / b
按负载扩展速度。

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.


这篇关于如何获得PC的处理器速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆