stupid question: API that returns processor speed?

This seems like a dumb question, but I am having a hard time finding an answer…

Is there an API (kernel mode or user mode) that returns the speed of the processor?

Thanks!

-Zach

Hi Gray,

You can read that from the registry entry HKEY_LOCAL_MACHINE\Hardware\Description\System\CetralProcessor{ProcessorID}~MHZ.

 

Good Luck,



From: “Gray, Zachary C”

>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] stupid question: API that returns processor speed?
>Date: Mon, 8 Mar 2004 13:29:55 -0800
>
>This seems like a dumb question, but I am having a hard time finding an answer…
>
>Is there an API (kernel mode or user mode) that returns the speed of the processor?
>
>Thanks!
>
> -Zach
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Contact brides & grooms FREE! Only on www.shaadi.com. Register now!

Just remember that ~MHZ is set while the system is booting. On laptops,
the actual CPU speed is often variable, based on whether you’re on AC or
battery power. If the idea is to take a different action based on the
current CPU speed, the ~MHZ value isn’t accurate. If the idea is just
to display something to the user, the ProcessorNameString value might be
a better choice.

–John

-----Original Message-----
From: yatindra vaishnav
Sent: Monday, March 08, 2004 3:53 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] stupid question: API that returns processor
speed?

Hi Gray,

You can read that from the registry entry
HKEY_LOCAL_MACHINE\Hardware\Description\System\CetralProcessor{Processo
rID}~MHZ.

Good Luck,



>From: “Gray, Zachary C”
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] stupid question: API that returns processor
speed?
>Date: Mon, 8 Mar 2004 13:29:55 -0800
>
>This seems like a dumb question, but I am having a hard time
finding an answer…
>
>Is there an API (kernel mode or user mode) that returns the
speed of the processor?
>
>Thanks!
>
> -Zach

Try CallNtPowerInformation() with ProcessorInformation.

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]


From: xxxxx@intel.com[SMTP:xxxxx@intel.com]
Reply To: xxxxx@lists.osr.com
Sent: Monday, March 08, 2004 10:29 PM
To: xxxxx@lists.osr.com
Subject: [ntdev] stupid question: API that returns processor speed?

This seems like a dumb question, but I am having a hard time finding an
answer…

Is there an API (kernel mode or user mode) that returns the speed of the
processor?

Thanks!

-Zach


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: michal.vodicka@st.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi John,

It is just an indication that where u can get the details. As i found from certain application that they uses this queried value from this only and i dont think that the processor speed will be having so tremendous variation if the power supply is changed in case of laptop.

 



From: “McNamee, John” <john.mcnamee>

>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] stupid question: API that returns processor speed?
>Date: Mon, 8 Mar 2004 16:01:57 -0600
>
>Just remember that ~MHZ is set while the system is booting. On laptops,
>the actual CPU speed is often variable, based on whether you’re on AC or
>battery power. If the idea is to take a different action based on the
>current CPU speed, the ~MHZ value isn’t accurate. If the idea is just
>to display something to the user, the ProcessorNameString value might be
>a better choice.
>
>–John
>
>
> -----Original Message-----
> From: yatindra vaishnav
> Sent: Monday, March 08, 2004 3:53 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] stupid question: API that returns processor
>speed?
>
>
>
> Hi Gray,
>
> You can read that from the registry entry
>HKEY_LOCAL_MACHINE\Hardware\Description\System\CetralProcessor{Processo
>rID}~MHZ.
>
> Good Luck,
>
>
>
>
>
> >From: “Gray, Zachary C”
> >Reply-To: “Windows System Software Devs Interest List”
> >To: “Windows System Software Devs Interest List”
> >Subject: [ntdev] stupid question: API that returns processor
>speed?
> >Date: Mon, 8 Mar 2004 13:29:55 -0800
> >
> >This seems like a dumb question, but I am having a hard time
>finding an answer…
> >
> >Is there an API (kernel mode or user mode) that returns the
>speed of the processor?
> >
> >Thanks!
> >
> > -Zach
>
>
>
>
>—
>Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
</john.mcnamee>


The world of entertainment. With all its spice & gossip! Specially for you!

On Mon, 2004-03-08 at 16:26, yatindra vaishnav wrote:

i dont think that the processor speed will be having so tremendous
variation if the power supply is changed in case of laptop.

50% isn’t significant?

-sd

The difference can be significant. My own laptop runs at 1.2GHz on AC
power, but only 800 MHz on batteries.

-----Original Message-----
From: yatindra vaishnav
Sent: Monday, March 08, 2004 4:27 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] stupid question: API that returns processor
speed?

Hi John,

It is just an indication that where u can get the details. As i
found from certain application that they uses this queried value from
this only and i dont think that the processor speed will be having so
tremendous variation if the power supply is changed in case of laptop.



>From: “McNamee, John”
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] stupid question: API that returns
processor speed?
>Date: Mon, 8 Mar 2004 16:01:57 -0600
>
>Just remember that ~MHZ is set while the system is booting. On
laptops,
>the actual CPU speed is often variable, based on whether you’re
on AC or
>battery power. If the idea is to take a different action based
on the
>current CPU speed, the ~MHZ value isn’t accurate. If the idea
is just
>to display something to the user, the ProcessorNameString value
might be
>a better choice.
>
>–John
>
>
> -----Original Message-----
> From: yatindra vaishnav
> Sent: Monday, March 08, 2004 3:53 PM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] stupid question: API that returns
processor
>speed?
>
>
>
> Hi Gray,
>
> You can read that from the registry entry

>HKEY_LOCAL_MACHINE\Hardware\Description\System\CetralProcessor{Process
o
>rID}~MHZ.
>
> Good Luck,
>
>
>
>
>
> >From: “Gray, Zachary C”
> >Reply-To: “Windows System Software Devs Interest List”
> >To: “Windows System Software Devs Interest List”
> >Subject: [ntdev] stupid question: API that returns processor
>speed?
> >Date: Mon, 8 Mar 2004 13:29:55 -0800
> >
> >This seems like a dumb question, but I am having a hard time
>finding an answer…
> >
> >Is there an API (kernel mode or user mode) that returns the
>speed of the processor?
> >
> >Thanks!
> >
> > -Zach

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0

~MHz REG_DWORD will give you the really measured CPU speed.

Dunno how this interacts with power-saving modes supported on XP+.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Gray, Zachary C”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, March 09, 2004 12:29 AM
Subject: [ntdev] stupid question: API that returns processor speed?

> This seems like a dumb question, but I am having a hard time finding an
answer…
>
> Is there an API (kernel mode or user mode) that returns the speed of the
processor?
>
> Thanks!
>
> -Zach
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Message ProcessorNameString is “official” speed suggested by the vendor.

In case of overclocking, it will differ from ~MHz which is the really measured speed, measured at the same time when the KeStallExecutionProcessor delay loop is calibrated early on boot.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: McNamee, John
To: Windows System Software Devs Interest List
Sent: Tuesday, March 09, 2004 1:01 AM
Subject: RE: [ntdev] stupid question: API that returns processor speed?

Just remember that ~MHZ is set while the system is booting. On laptops, the actual CPU speed is often variable, based on whether you’re on AC or battery power. If the idea is to take a different action based on the current CPU speed, the ~MHZ value isn’t accurate. If the idea is just to display something to the user, the ProcessorNameString value might be a better choice.

–John

-----Original Message-----
From: yatindra vaishnav
Sent: Monday, March 08, 2004 3:53 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] stupid question: API that returns processor speed?

Hi Gray,

You can read that from the registry entry HKEY_LOCAL_MACHINE\Hardware\Description\System\CetralProcessor{ProcessorID}~MHZ.

Good Luck,



>From: “Gray, Zachary C”
>Reply-To: “Windows System Software Devs Interest List”
>To: “Windows System Software Devs Interest List”
>Subject: [ntdev] stupid question: API that returns processor speed?
>Date: Mon, 8 Mar 2004 13:29:55 -0800
>
>This seems like a dumb question, but I am having a hard time finding an answer…
>
>Is there an API (kernel mode or user mode) that returns the speed of the processor?
>
>Thanks!
>
> -Zach


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Yes, the difference is really this major.

The recent ACPI spec and the recent CPU/chipsets supports managing the CPU
speed “on the fly”.

Starting from XP, the ACPI support layer (ACPI.SYS and a HAL) really uses
these facilities. The choice of the processor speed depends on power management
scheme, it is always maximum for “Always On” scheme and is lowered for another
schemes.

On another hand, the scheme choice depends on whether the notebook runs off
battery or off AC power.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Steve Dispensa”
To: “Windows System Software Devs Interest List”
Sent: Tuesday, March 09, 2004 1:25 AM
Subject: RE: [ntdev] stupid question: API that returns processor speed?

> On Mon, 2004-03-08 at 16:26, yatindra vaishnav wrote:
> > i dont think that the processor speed will be having so tremendous
> > variation if the power supply is changed in case of laptop.
>
> 50% isn’t significant?
>
> -sd
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

> ----------

From: xxxxx@storagecraft.com[SMTP:xxxxx@storagecraft.com]
Reply To: xxxxx@lists.osr.com
Sent: Monday, March 08, 2004 11:55 PM
To: xxxxx@lists.osr.com
Subject: Re: [ntdev] stupid question: API that returns processor
speed?

HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0

~MHz REG_DWORD will give you the really measured CPU speed.

Dunno how this interacts with power-saving modes supported on XP+.

API I mentioned previously supports it:

CPU #0 info:
MaxMHz: 1694
CurrentMhz: 592
MhzLimit: 1694
MaxIdleState: C3
CurrentIdleState: C2

Best regards,

Michal Vodicka
STMicroelectronics Design and Application s.r.o.
[michal.vodicka@st.com, http:://www.st.com]

QueryPerformanceFrequency in user mode and KeQueryPerformanceCounter in KM
work for me.

Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com

-----Original Message-----
From: Gray, Zachary C [mailto:xxxxx@intel.com]
Sent: Monday, March 08, 2004 4:30 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] stupid question: API that returns processor speed?

This seems like a dumb question, but I am having a hard time
finding an answer…

Is there an API (kernel mode or user mode) that returns the
speed of the processor?

Thanks!

-Zach


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ati.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

> ProcessorNameString is “official” speed suggested by the vendor.

In case of overclocking, it will differ from ~MHz which is the really
measured speed, measured at the same time when the
KeStallExecutionProcessor delay loop is calibrated early on boot.

ok, so how does KeStallExecutionProcessor delay accurately when the actual
processor speed is all over the place, as many have just said?

QueryPerformanceFrequency() doesn’t always use TSC as the time source.
Many HALs use ACPI timer as the time source for QueryPerformanceFrequency().
Some high-end servers have custom HALs with a totally different time source.

Anyway, why one has to know CPU clock frequency? Clock rate is a bad
indicator of the system performance/speed.

Dmitriy Budko VMware

-----Original Message-----
From: Calvin Guan [mailto:xxxxx@ati.com]
Sent: Monday, March 08, 2004 3:32 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] stupid question: API that returns processor speed?

QueryPerformanceFrequency in user mode and KeQueryPerformanceCounter in KM
work for me.

Dunno. Probably they burst the speed to its maximum before delay loop.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: Justin Schoenwald
To: Windows System Software Devs Interest List
Sent: Tuesday, March 09, 2004 3:31 AM
Subject: Re: [ntdev] stupid question: API that returns processor speed?

ProcessorNameString is “official” speed suggested by the vendor.

In case of overclocking, it will differ from ~MHz which is the really measured speed, measured at the same time when the KeStallExecutionProcessor delay loop is calibrated early on boot.

ok, so how does KeStallExecutionProcessor delay accurately when the actual processor speed is all over the place, as many have just said?

Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks to everyone for the help on this, it was a much greater learning experience than I anticipated!

-Zach

A simple answer might be (I haven’t seen the source of course :-): it’s
only ever guaranteed to wait *at least* as long as the interval you
specify… :-)…

Justin Schoenwald wrote:

> ProcessorNameString is “official” speed suggested by the vendor.
>
> In case of overclocking, it will differ from ~MHz which is the
> really measured speed, measured at the same time when the
> KeStallExecutionProcessor delay loop is calibrated early on boot.

ok, so how does KeStallExecutionProcessor delay accurately when the
actual processor speed is all over the place, as many have just said?


…/ray..