#### ITimingTest

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

ITimingTest is the principle class used to measure CPU performance. It measures the time taken to execute a well-defined operation--for example, adding a member to an IACollection subclass.

ITimingTest expects the operation to show some variation in execution time because of multitasking, varying CPU load, and other variable conditions. Consequently, the class takes multiple measurements and reports the median.

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

#### IStartStopTimingTest

When possible, you should use ITimingTest because it has been designed to have very high accuracy. In some cases, however, you will not be able to use ITimingTest. For example, consider a class INetThing that queries the network. Only the first instantiation of INetThing performs a certain action. If you wished to test the initial object-constructor time of INetThing, you would need to delete each existing INetThing before the next one is constructed. What you need is a sequence like the following within the timing loop:

1. Begin timing.
2. Instantiate INetThing.
3. Stop timing.
4. Delete INetThing.

IStartStopTimingTest makes this kind of timing test possible at the cost of a loss of precision. Because it takes a substantial amount of time to actually measure time, when the timer is started or stopped, IStartStopTimingTest can only measure times in milliseconds.