GetIdleTime (Compact 2013)
3/28/2014
This function returns the amount of time, in milliseconds, that the master processor has been idle.
Syntax
DWORD GetIdleTime (void);
Parameters
None.
Return Value
The number of milliseconds that the master processor has been idle. If GetIdleTime returns MAXDWORD, your platform does not support this functionality.
Remarks
To get the idle time for processors other than the master in a Symmetric Multiprocessing (SMP) environment, use CeGetIdleTimeEx. The following two function calls are equivalent:
dwIdleTime = GetIdleTime();
CeGetIdleTimeEx (1, &dwIdleTime);
Example
The following example code shows how to determine how long the master processor has been idle by wrapping a call to GetIdleTime with calls to GetTickCount.
dwStartTick = GetTickCount();
dwIdleSt = GetIdleTime();
// You must insert a call to the Sleep(sleep_time) function to allow
// idle time to accrue. An example of an appropriate sleep time is
// 1000 ms.
sleep(1000);
dwStopTick = GetTickCount();
dwIdleEd = GetIdleTime();
PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));
Requirements
Header |
winbase.h |
Library |
coredll.lib |
See Also
Reference
Time Functions
GetTickCount
Sleep