Share via


Platform Profiling

Windows CE supports three profiling techniques to measure operating system performance on a targeted platform.

Profiling technique Description
Instrumented kernel Computes minimum, maximum, and average time where preemption is disabled in the kernel.
Monte Carlo Counts/measures per-routine CPU occupation.
Hardware-assisted Tracks process/thread creation and destruction and thread context switches; makes time measurements.

Instrumented kernel and Monte Carlo profiling depend on a profile-enabled build of the kernel.

Profile-enabled kernel

The profile-enabled kernel is the same as a release kernel, with the addition of timing-related functions. Instrumented kernel profiling and Monte Carlo profiling work together to profile the performance of the Windows CE kernel and OS features running on a target device. Building a profile-enabled kernel requires setting the appropriate environment variables. For more information, see Creating a Profile-Enabled OS Image for a CEPC.

To support instrumented kernel profiling and Monte Carlo profiling, you must implement the OEMProfileTimerDisable and OEMProfileTimerEnable functions in your OEM adaptation layer (OAL) using Platform Builder. The kernel calls these functions to perform the profiling. You then enable these two profiling methods by calling the ProfileStart and ProfileStop functions. For more information, see Implementing Profiling.

Instrumented kernel profiling

Instrumented kernel profiling analyzes kernel calls. These are kernel routines during which the kernel turns off thread scheduling preemption and does not allow other threads to run. The worst-case time that a real-time thread is kept from running can be characterized as the worst-case kernel call time in the kernel. These times do not represent interrupt service routine (ISR) execution times, but they do represent lower-priority thread execution times, such as interrupt service threads (IST). Instrumented kernel profiling also provides the duration of the NextThread kernel call. This is the amount of time the kernel spends setting up the IST.

Instrumented kernel profiling records all kernel call times, including minimum, maximum, and average times. The instrumented kernel is useful for reporting possible worst-case times. It profiles all scheduling latencies — those cases where an IST is ready to run but is blocked while execution continues within a noninterruptible portion of the kernel.

Monte Carlo profiling

Monte Carlo profiling involves interrupting the system at a high rate and recording the interrupted address. By interrupting at a high rate, the samples give a good representation of what routines are running most of time. For more information, see Monte Carlo Profiling.

Hardware-assisted profiling

Windows CE also supports hardware-assisted profiling, including an application programming interface (API) library that supports process-level tracking. You can use this library to write an application that can be notified when a process or thread is created or terminated, or when a thread is scheduled to run.

You can use the information that the system passes to the application to perform custom profiling functions. To enable hardware-assisted profiling, assign function addresses to global pointers in the OAL. The kernel uses these pointers to pass information to the functions that you implement in the OAL.

You can also obtain performance measurements from an application using the GetThreadTimes and QueryPerformanceCounter functions.

For more information, see Hardware-Assisted Profiling.

See Also

Keyboard Profiling Shortcuts | Real-Time Performance | Event Tracking

 Last updated on Friday, October 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.