Solved

Measure CPU idle time

Posted on 2006-06-26
1
811 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What does Survey Monkey cost? 7 103
Peachtree 2012 Help 2 61
Free Text Editor for Large files? 11 59
PDFMate free PDF Merger. Security concern 8 87
A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
A short article about problems I had with the new location API and permissions in Marshmallow
This video shows how use content aware, what it’s used for, and when to use it over other tools.
Viewers will learn how to use the Hootsuite Dashboard.

920 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

13 Experts available now in Live!

Get 1:1 Help Now