Solved

Measure CPU idle time

Posted on 2006-06-26
1
809 Views
Last Modified: 2013-12-27
Hi!

I need a way to measure CPU idle time on a Windows Mobile 5 device. Preferably by using C/C++.

Thankful for any suggestions!
0
Comment
Question by:10goto20
1 Comment
 
LVL 6

Accepted Solution

by:
umahesh earned 500 total points
ID: 16990168
As for windows CE based devices,

DWORD GetIdleTime (void);
This function returns the amount of time, The number of milliseconds that the system has been idle. If GetIdleTime returns MAXDWORD, functionality is not supported by your platform.

The support for this function is dependent on the OEM's implementation of the curridlelow, curridlehigh, and idleconv variables in the OEM adaptation layer (OAL).

For ISVs, if the OEM does not set the curridlelow, curridlehigh, and idleconv variables in the OAL, the value returned from GetIdleTime never increases and is usually equal to 0.

The following code example shows how to determine how long the device has idled by wrapping a call to GetIdleTime with calls to GetTickCount.

dwStartTick = GetTickCount();
dwIdleSt = GetIdleTime();
Sleep();
dwStopTick = GetTickCount();
dwIdleEd = GetIdleTime();
PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));
The Sleep function is required to allow other threads in the system to run during a period of time.

Goodluck
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Skype is a P2P (Peer to Peer) instant messaging and VOIP (Voice over IP) service – as well as a whole lot more.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now