Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Measure CPU idle time

Posted on 2006-06-26
1
Medium Priority
?
836 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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Here in this article, you will get a step by step guidance on how to restore an Exchange database to a recovery database. Get a brief on Recovery Database and how it can be used to restore Exchange database in this section!
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
Suggested Courses

972 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