1

I'm having a bit of trouble finding a reliable method of determining CPU frequency in Windows (7).

I've tried using Perfmon, but it has a maximum sampling frequency of 1 Hz. Also, I don't have kernel-level access, so I can't use machine specific registers. There are a number of C functions which can determine the maximum frequency of the processor, but SpeedStep and Turbo Boost make these methods unreliable, as the ones I have tried use an on-chip timer which runs at a constant rate, and thus doesn't reflect the variable processor frequency.

I know that programs such as CPU-Z are able to directly measure the CPU frequency, but I'm at a loss as to how they are actually doing so. Any help is greatly appreciated!

Edit: I've also been looking into the possibility of using ACPI to monitor the CPU P-States... is this an option?

Edit2: I'm currently looking into using the machine-specific registers (http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-software-developer-vol-3b-part-2-manual.pdf) to get this information... I feel like this might be overkill for the solution, but it's the best lead I've got at the moment.

Shookit
  • 1,162
  • 2
  • 13
  • 29
  • Just read it from the registry, HKLM\Hardware\Description\System\CentralProcessor\0\~Mhz value. – Hans Passant Jun 12 '12 at 20:25
  • Unfortunately, this registry entry doesn't vary with SpeedStep frequency changes. It provides the standard maximum CPU frequency, but doesn't change when the system reduces CPU frequency due to low load. – Shookit Jun 12 '12 at 20:52
  • Pretty pointless to try to measure the variable frequency. The result you get entirely depends on the way you measure. The more accurate you try to make it, the higher it becomes :) – Hans Passant Jun 12 '12 at 21:10
  • I'm not quite sure I understand... I'm trying to measure what the frequency is at a given point in time, not just figure out what the processor's maximum frequency is. I'm doing some power analysis, and the instantaneous frequency greatly affects power consumption... I understand that there's an observer effect going on, but it should be negligible compared to the total number of CPU cycles. – Shookit Jun 12 '12 at 21:18

2 Answers2

1

I was able to determine the CPU frequency via a Windows driver which analyzes the aperf and mperf rato, as outlined in the following link: Hardware Processor Counters Incorrectly Resetting

Community
  • 1
  • 1
Shookit
  • 1,162
  • 2
  • 13
  • 29
0

Please check this link.

  • In this link one simple WDM IOCTL driver with application is given with good explaination . I was able to find frequency using this code. Frequency is calculated using MSR(Model-specific Registers) APERF and MPERF values.
RDX
  • 409
  • 6
  • 22