How to Profile and Optimize a Display Driver

Windows CE and Platform Builder ship with a number of tools that can help you improve the performance of your display driver. Profiling tools, such as Monte Carlo profiling, help you understand which functions in your platform are most heavily used. Performance tools, such as DispPerf.exe, provide you with time-oriented measurements of your platform's operations. For more information see Monte Carlo Profiling and Display Driver Performance Profiling. You can use these tools to determine which functions in your system are most frequently called during a usage scenario, as well as provide metrics for the specific raster operations in your display driver.

The following table shows the steps to profile a graphics application and optimize a specific color conversion in the FLAT display driver. These steps work on any display-based device and they assume that you are already familiar with the process of building and downloading a platform. You can select the check box next to each step to track your progress.

  Step Topic
1. Create an empty display-based operating OS.

By default, the platform that you create uses the FLAT display driver.

Creating an Empty Display-Based OS
2. Add the Console Window feature to your platform. It can be found at Catalog\Core OS\Display-based Devices\Shell and User Interface\Shell\Command Shell\Console Window. Adding a Feature from the Catalog
3. Enable Monte Carlo profiling for your platform. Enabling Monte Carlo Profiling on Your Platform
4. Activate the instrumentation code for profiling your display driver with DispPerf.exe by setting the environment variable DO_DISPPERF = 1.

As with all sample display drivers shipped with Windows CE .NET, the FLAT driver is already instrumented to support DispPerf, the display driver performance profiling tool. Typically, the code to support DispPerf within the FLAT driver is turned off, but setting DO_DISPPERF = 1 turns it on. For more information, see Display Driver Performance Profiling.

Setting or Clearing an Environment Variable
5. Set up Platform Builder to build the code in the public directories outside of your platform directory.

To do so, from the Tools menu, select Options, and then select the Build tab.

Verify that the Enable deptree build check box is selected.

This step forces Platform Builder to compile all of the common Windows CE OS code, which includes the sample display driver code and the platform code. For more information, see Master Build Tool.

Not applicable.
6. Create an application that uses your platform's graphics routines, thus providing a target for profiling your display driver. Creating a Target Application for Profiling the FLAT Display Driver
7. Within your platform, create a project for the application that gathers the profiling data for the display driver, DispPerf.exe. Building DispPerf.exe
8. Force Platform Builder to rebuild the display drivers by updating a file that the drivers depend on.

To do this:

  • Open the file %_WINCEROOT%\Public\Common\OAK\Inc\Gpe.h.
  • Add and delete a single space to the file. This registers as a change in the file.
  • Save the file in its original location.

When Platform Builder detects that the header file Gpe.h is more current than the driver binaries that depend on it, Platform Builder rebuilds the drivers to update them. This time, however, the DispPerf instrumentation code is enabled.

Not applicable.
9. Build a release configuration for your platform.

The first time through this process, choosing Build Platform from the Build menu is the same as choosing Rebuild Platform. For subsequent builds, changes made to the code outside of the platform, such as the common OS and display driver code, have to be built using Rebuild Platform to clean the intermediate files from the previous build and assure that the revised code actually gets built.

Because the platform has deptree builds enabled, the initial build is longer than usual and produces a very large build log as the build system compiles all of the platform code.

Building a Platform
10. Once the build is complete, configure your download and debugging connections. Configuring a Connection for Downloading and Debugging
11. Download the OS image to your device. Downloading an OS Image to a Target Device
12. Once your platform is loaded, begin profiling ProfApp.exe to obtain a set of performance data. Obtaining a Performance Profile for a Display Driver
13. Analyze the profiling and performance data to find heavily used functions that can be optimized. Display Device Performance Profile Analysis
14. From the Target menu in Platform Builder, choose Disconnect to return to the platform development environment. Not applicable.
15. Add a new function to the BitBlt emulation library to improve the performance of the FLAT display driver when running ProfApp.exe on your platform. For more information see BitBlT Emulation Library Functions. Optimizing a GPE Emulation Function
16. From the Build menu, choose Rebuild Platform. Not applicable.
17. Once your platform is rebuilt, download it onto your device and rerun the profiling steps to obtain a set of post-optimization profiling and performance data. Downloading an OS Image to a Target Device

Obtaining a Performance Profile for a Display Driver

18. Evaluate the results of the optimization. Optimized GPE Emulation Function Analysis

**Note   **If your project and platforms build but exhibit unexpected behavior, verify that the settings you made for your projects and platforms were all made for the release configuration of your platform.

See Also

Display Driver Performance | Device Driver How-to Topics | Display Driver Samples | Driver Development

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.