Jump to content

Recommended Posts

Guest tkishore
Posted

I am developing an application in which I want to display CPU load on the screen.

I am using following code to calculate the CPU load

------------------------

DWORD dwStartTick = GetTickCount();

DWORD dwIdleSt = GetIdleTime();

Sleep(500);

DWORD dwStopTick = GetTickCount();

DWORD dwIdleEd = GetIdleTime();

DWORD PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));

TCHAR buf[20];

swprintf(buf, TEXT("CPU Load:%d%%"), 100-PercentIdle);

-------------------------

This code works on most of devices, but on some devices it displays always 100% or –ve number.

In WinCE .Net Help it is mention that “The support of GetIdleTime() function is dependent on the OEM's implementation”. I think because of this I am getting unrealistic values.

Is there any other way of calculating CPU load?

Any suggestions in this regard will be greatly appreciated.

Posted

firstly I'd ask that these sort of questions went into the developer group, dont really think software is the best place for them

secondly you should be aware that the spv doesn't run WinCE, it runs Smartphone2002 OS

alas I dont know of an idle command in SP2002 OS :)

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.