Next: 17 List of Demo
Up: 16.8 Taking Timing Measurements
Previous: 16.8.2 Achieving Accurate Timing
To benchmark performance for a particular code fragment, follow these steps:
- Determine how many polygons are being drawn and estimate how many pixels they cover on the screen. Have your program count the polygons when you read in the database.
To determine the number of pixels filled, start by making a visual estimate. Be sure
to include surfaces that are hidden behind other surfaces, and notice whether or not
backface elimination is enabled. For greater accuracy, use feedback mode and calculate
the actual number of pixels filled or use the stencil buffer technique described in
Section 14.3.
- Determine the transform and fill rates on the target system for the mode
settings you are using.
Refer to the product literature for the target system to determine some
transform and fill rates. Determine others by writing and running small benchmarks.
- Divide the number of polygons drawn by the transform rate to get the time spent
on per-polygon operations.
- Divide the number of pixels filled by the fill rate to get the time spent on
per-pixel operations.
- Measure the time spent in the application.
To determine time spent executing instructions in the application, stub out the OpenGL
calls and benchmark your application.
This process takes some effort to complete. In practice, it's best to make a quick
start by making some assumptions, then refine your understanding as you tune and
experiment. Ultimately, you need to experiment with different rendering techniques and
do repeated benchmarks, especially when the unexpected happens.
David Blythe
Thu Jul 17 21:24:28 PDT 1997