Timing test concepts

The TTimingTest base class enables you to write tests that measure the time taken by a specific operation to complete. The derived class TStartStopTimingTest allows you more control in timing events.

TTimingTest contains three framework member functions: TimingSetup, TimingTest, and TimingCleanup. Only the TimingTest member function is timed. The TimingSetup and TimingCleanup member functions run before and after TimingTest, but are not themselves timed.

TTimingTest expects the operation to show some variation in execution time due to multitasking, varying CPU load, and other variable conditions. Consequently, the class takes multiple measurements and reports the median. Figure 1 shows the test timing loops.


TTimingTest measures the time needed to execute the TimingTest member function. It does this by taking some number of samples, the sample count. Each sample consists of a call to TimingSetup, some number of calls to TimingTest, and a call to TimingCleanup.

The calls to TimingTest happen in a tight loop, the timing loop. Derived classes, or the caller through a RunTest option, can control how many iterations comprise the timing loop by changing the timing count. The total time taken by the timing loop is divided by the number of iterations to get a single sample time. The median of all sample times is taken as the estimate of the time to execute the TimingTest member function.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker