Microsoft Windows CE 3.0  

Profiling Display Driver Performance

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The Platform Builder includes a sample profiling tool, DispPerf, that the display driver writer can use to profile the performance of a display driver. DispPerf builds a table that lists, for each ROP code that is profiled, the frequency count, elapsed time in microseconds and average elapsed time in microseconds for ROPs handled by the default GPE emulation, by the software emulation library, and by hardware accelerations. To measure these times accurately, DispPerf can be used only on Windows CE–based platforms that support the QueryPerformanceCounterand QueryPerformanceFrequencyfunctions with a recommended resolution of 1 microsecond.

The ATI driver demonstrates how to use the profiler for measuring performance of blits and line drawing. The display driver writer may extend the profiler to measure the performance of additional display functions. Source code for DispPerf is in the Platform\Cepc\Drivers\Display\ directory.

The driver starts profiling of blit operations during the call to the BltPreparefunction when it calls the DispPerfStartfunction. The following code example shows how the driver initializes its display function pointer to use the default emulation that is provided by the GPE.

SCODE ATI::BltPrepare(GPEBltParms *pBltParms) {
DispPerfStart (pBltParms->rop4); pBltParms->pBlt =
EmulatedBlt; // Catch all

When the driver is able to handle the ROP with hardware acceleration or software emulation, it changes its display function pointer appropriately. The driver also calls the DispPerfTypefunction to record which type of acceleration is used to handle the ROP. For example, the following code example demonstrates how the driver calls DispPerfTypeafter the driver successfully sets the display function pointer to a hardware-accelerated function.

// Performance Logging Type if
(pBltParms->pBlt != EmulatedBlt) {
DispPerfType(DISPPERF_ACCEL_HARDWARE); }

When the blit operation completes, the BltCompletefunction stops profiling with a call to the DispPerfEndfunction.

The DO_DISPPERF environment variable controls whether the code to support profiling is compiled into the display driver. Refer to the Sources file for the ATI driver to see how the environment variable causes the correct compiler directives to be set.

DispPerfcan be invoked from the Command Shell on a Windows CE–based platform, or it can be launched remotely from the Windows CE Debug Shell. The following example shows the command syntax for DispPerf.

dispperf [-c[w*]] [-d [> 
file]]

The -coption clears the profiler buffer. If the letter "w" appears one or more times following the -coption, DispPerfcalls the CreateWindowfunction that number of times and profiles the resulting display driver operations. The -doption dumps the profiler buffer in tabular form. If the -doption is followed by (>) plus a file name, the output is written to the named file. Otherwise, it appears on the console where the command was issued.

The following code example shows how DispPerfclears its buffer of all profiling information.

Dispperf –cwwwwwd

It then calls the CreateWindowfunction five times, profiling the performance of the display functions. The following code example shows how DispPerfdisplays its table of profiling information to the console.

Dispperf –c Pword stat_rpt.pwd Dispperf –d >
results.txt

In this example, DispPerfclears its buffer of all profiling information. The Microsoft Word application for the Windows CE OS is launched and opens the document Stat_rpt.pwd. DispPerftracks the profiled display functions that are called by Pocket Word. Finally, DispPerfwrites its table of profiling information to the Results.txt file.



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.