Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

CPU frequency measurement

podien
Beginner
137 Views

Hallo,

on the new core duo cpus the frequency measurement only measures a constant frequency, although speedstep changes the frequency via multiplier.

int i,tdiff;

DWORD_PTR oldaff=NULL;

unsigned _int64 rtanfang,rt1,rt2;

LARGE_INTEGER t1,t2,tanfang,freq;

timeb zeitanfang,zeitende;

ftime(&zeitanfang);

rtanfang=__rdtsc();

Sleep (500);

ftime(&zeitende);

rt1 = __rdtsc();

time_t rdif;

time_t rdif1;

rdif = zeitende.time-zeitanfang.time;

rdif1 = zeitende.millitm-zeitanfang.millitm + rdif * 1000;

int rcy = (int)(rt1-rtanfang);

*frequenz = (

int)(rcy / rdif1 / 100);

There is no change if you takeQueryPerformanceCounter for better accuracy. Any idea to get cpu frequency dependent values with core duo chips?

0 Kudos
0 Replies
Reply