Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Reading Core2 Duo frequency?

postaquestion
Novice
1,124 Views

How can an application get CPU (only Core 2 Duo) frequency ? I tried the method with __rtdsc but the results are different every time I run the application. Reading frequency from Brand String is not satisfactory for me --I assume that user's CPU can be overclocked. Is there an MSR register or other way for getting current CPU frequency or FSB frequency?

0 Kudos
5 Replies
robert-reed
Valued Contributor II
1,124 Views

You don't indicate what OS you want to do this under. If the answer is Windows, try using QueryPerformanceFrequency (see http://msdn2.microsoft.com/en-us/library/bb173458.aspx).

On Linux, try looking in /proc/cpuinfo (see http://lwn.net/Articles/162548/).

--Robert

0 Kudos
TimP
Honored Contributor III
1,124 Views
These locations often show the idle core frequency, e.g. 1600 Mhz for a 2933 Mhz Core 2 Duo.
0 Kudos
tdw1
Beginner
1,124 Views
I'm sorry I forgot to write that it's about Windows. Well.... the problem with inaccurate readings is caused by QueryPerformanceFrequency. Each reading differs from previous on ~20 MHZ. For application that is ment to be helpfull for overclockers is too much. I'd be gratefull for other suggestions.


0 Kudos
TimP
Honored Contributor III
1,124 Views

I am seeing a possibly related problem with performance measurement by rdtsc on Core 2 Duo. When running a short benchmark, starting with an idle machine (CPU speed throttled way back), the number of "clock ticks" reported by rdtsc comes out significantly lower. If anything, the actual elapsed time has to be higher, but I can't measure it accurately. If the test is repeated 5 seconds later, it comes out normal.

When Demand Based Switching was introduced on Pentium D, we were sometimes advised to disable DBS (possibly a BIOS setup option) in order to avoid these anomalous results, by keeping CPU at full speed regardless of load. I wouldn't want to do that on a machine as hot as a full speed Pentiurm D.

0 Kudos
tsunghsunwu
Beginner
1,124 Views
I want to know how to get frequency for each core through assembly....
0 Kudos
Reply