Поделиться через


Display Driver Performance Profiling (Windows Embedded CE 6.0)

1/6/2010

You can use the DispPerf utility to profile the performance of your display driver.

DispPerf builds a table that lists the following for each raster operation (ROP) code that is profiled:

  • Frequency count
  • Elapsed time in microseconds
  • Average elapsed time in microseconds

The table is specific to ROPs handled by the default GPE emulation, by the software emulation library, and by hardware accelerations.

To measure times accurately, DispPerf can be used only on run-time images that support QueryPerformanceCounter and QueryPerformanceFrequency with a recommended resolution of 1 microsecond.

All drivers in the %_WINCEROOT%\Public\Common\OAK\Drivers\Display tree demonstrate how to use the profiler for measuring performance of blits and line drawing. You can extend the profiler to measure the performance of additional display functions.

The following table shows where the source code exists for DispPerf and the ATI display drivers.

Driver or utility Directory

DispPerf

%_WINCEROOT%\Public\Common\OAK\Drivers\Display\DispPerf

ATI

%_WINCEROOT%\Public\Common\OAK\Drivers\Display\ATI

The driver starts profiling of blit operations during the call to the BltPrepare function when it calls the DispPerfStart function.

The following code example shows how the ATI driver, which is used as the example driver throughout this section, 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 can handle the ROP with hardware acceleration or software emulation, it changes its display function pointer appropriately. The driver also calls the DispPerfType function to record which type of acceleration is used to handle the ROP.

The following code example shows how the driver calls DispPerfType after the driver 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 BltComplete function stops profiling with a call to the DispPerfEnd function.

The DO_DISPPERF environment variable controls whether the code to support profiling is compiled into the display driver.

To learn how the environment variable causes the correct compiler directives to be set, see the Sources file for the ATI driver.

DispPerf can be invoked from the command prompt on a Windows Embedded CE–based platform, or it can be launched remotely from the Windows Embedded CE Debug Shell tool.

The following code example shows the command syntax for DispPerf.

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

The -c option clears the profiler buffer. If the letter w appears one or more times following the -c option, DispPerf calls the CreateWindow function that number of times and profiles the resulting display driver operations.

The -d option exports the profiler buffer output in tabular form. If the -d option is followed by > and 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 DispPerf clears its buffer of all profiling information.

Dispperf -cwwwwwd

Dispperf calls the CreateWindow function five times, profiling the performance of the display functions.

The following code example shows how DispPerf displays its table of profiling information to the console.

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

In this example, DispPerf clears its buffer of all profiling information. Microsoft® Word runs, and then opens the document Stat_rpt.pwd. DispPerf tracks the profiled display functions and writes its table of profiling information to the Results.txt file.

DispPerf Results

The following table provides descriptions for the data shown in the main columns of DispPerf's output table. All sample display drivers included with Windows CE .NET 4.2 or later are instrumented to support these metrics.

Heading Description

RopCode

The raster operations called during the profiling run.

The hexadecimal values in this column are related to the GDI ROP code values by the following formula, where RopCode is the value reported by DispPerf and ROP3 is the value in hexadecimal column in Ternary Raster Operations.

RopCode = ((ROP3 & 0x00ff0000 >> 16) | (ROP3 & 0xff0000 >> 8))

cTotal

The total number of times a ROP was called.

cGPE

The number of times a ROP was called from a GPE function.

For more information, see GPE Base Classes.

dwGPETime

The total amount of time, in microseconds, spent in a ROP from GPE calls.

Avg.GPETime

The average amount of time, in microseconds, for a ROP when called from GPE.

cEmul

The number of times a ROP was called from a BitBlt emulation library function.

For more information, see BitBlT Emulation Library Functions.

dwEmulTime

The total amount of time, in microseconds, spent in a ROP from BitBlt emulation library function calls.

Avg.EmulTime

The average amount of time, in microseconds, for a ROP when called from a BitBlt emulation library function.

cHardware

The number of times a ROP was called from hardware.

dwHardwareTime

The total amount of time, in microseconds, spent in a ROP from hardware calls.

Avg.HardwareTime

The average amount of time, in microseconds, for a ROP when called from hardware.

The following table shows the meanings of the additional column headings in DispPerf's output table. The sample display drivers that are included with Windows CE .NET 4.2 or later are not instrumented to support these metrics.

Heading Description

WaitTime

The time, in microseconds, spent in the function WaitForNotBusy during a ROP.

Color Lookup

The number of blits that required a lookup from a color palette.

Color Convert

The number of blits that required a color conversion.

Src In Video Mem

The number of blits that had the source surface in video memory

Dest In Video Mem

The number of blits that had the destination surface in video memory.

Color Black

This is the number of times a solid color of black was used.

Color White

This is the number of times a solid color of white was used.

Stretch Blt

The number of blits that required stretching or shrinking.

Transparent Blt

The number of blits that had a transparent color.

See Also

Concepts

Display Driver Performance
FLAT Sample Display Driver
ATI Sample Display Driver
ATI Sample Display Driver Optimization
Sample DrvEscape Function
Sample Blit Acceleration
Display Driver Registry Settings
Display Driver Development Concepts
Display Driver Extensions
Display Driver Recommendations

Other Resources

Kernel Profiler