开发者

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 point开发者_运维百科er :

The code for Wince device is:

LARGE_INTEGER FrequnecyCounter;

QueryPerformanceFrequency(&FrequnecyCounter);

CString temp;

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

Thanks,

Mukesh


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜