Take measurements on a quiet system. Verify that no unusual activity
is taking place on your system while you take timing measurements. Terminate
other applications. For example, do not have a clock or a network application
like sendmail running while you are benchmarking.

Choose timing trials that are not limited by the clock resolution.

Use a high-resolution clock and make measurements over a period of time that's
at least one hundred times the clock resolution. A good rule of thumb is to
benchmark something that takes at least two seconds so that the uncertainty
contributed by the clock reading is less than one percent of the total
error. To measure something that's faster, write a loop to execute the test
code repeatedly.

Benchmark static frames.

Verify that the code you are timing behaves identically for each frame of a
given timing trial. If the scene changes, the current bottleneck in the
graphics pipeline may change, making your timing measurements meaningless. For
example, if you are benchmarking the drawing of a rotating airplane, choose
a single frame and draw it repeatedly, instead of letting the airplane rotate,
or make sure the rotation covers the same angles every time. Once a single
frame has been analyzed and tuned, look at frames that stress the graphics
pipeline in different ways, then analyze and tune them individually.

Compare multiple trials.

Run your program multiple times and try to understand variance in the
trials. Variance may be due to other programs running, system activity,
prior memory placement, or other factors.

Call glFinish() before reading the clock at the start and at the
end of the time trial.

This is important if you are using a machine with hardware acceleration
because the graphics commands are put into a hardware queue in the graphics
subsystem, to be processed as soon as the graphics pipeline is ready. The
CPU can immediately do other work, including issuing more graphics commands
until the queue fills up.

When benchmarking a piece of graphics code, you must include in your
measurements the time it takes to process all the work left in the queue after
the last graphics call. Call glFinish() at the end of your timing trial,
just before sampling the clock. Also call glFinish() before sampling the
clock and starting the trial, to ensure no graphics calls remain in the
graphics queue ahead of the process you are timing.