mukesh
mukesh

Reputation: 21

Unable to get Processor Speed in Device

Hi i am using QueryperformanceFrequency to get the No of cycle i.e processor speed. But it is showing me the wrong value. It is written in the specicfication is the Processor is about 400MHz, but what we are getting through code is something 16MHz.

Please porvide any pointer :

The code for Wince device is:

LARGE_INTEGER FrequnecyCounter;

QueryPerformanceFrequency(&FrequnecyCounter);

CString temp;

temp.Format(L"%lld",FrequnecyCounter.QuadPart)`AfxMessageBox(temp);

Thanks,

Mukesh

Upvotes: 1

Views: 453

Answers (2)

Stack Overflow is garbage
Stack Overflow is garbage

Reputation: 248199

QPF doesn't return the CPU clock speed. It returns the frequency of a high performance timer. On a few systems, it might actually measure CPU cycles. On other systems, it might use s a separate timer running at the same frequency. (but which is unaffected by things like SpeedStep which can change the clock speed of the CPU). Often, it uses a separate timer entirely, one which may not even be on the CPU itself, but may be part of the motherboard.

QueryPerformanceCounter/QueryPerformanceFrequency only promise that they use the best timer available on the system. They make no promises about what that timer might be.

Upvotes: 1

Rohit J
Rohit J

Reputation:

QueryPerformanceFrequency returns frequency of the counter peripheral not of the processor. These peripheral typically runs at the original Crystal clock frequency. 16Mhz should be good enough resolution for you to measure fine grain intervals.

Upvotes: 2

Related Questions