Timing a single event

To create a timed test in which you control the timer to time a single event:

  1. Derive your test class from TStartStopTimingTest
  2. Override TimingSetup, if necessary.
  3. Override StartStopTimingTest.
  4. Override TimingCleanup, if necessary.
This example uses a simple loop to show how to start and stop the timer once during a test.

      void TSampleStartStopTest::StartStopTimingTest(TTimingTestStopwatch& stopwatch)
      {
              stopwatch.Start();
          for (short i=0; i<1000;i++); 
              stopwatch.Stop();
      }
This is the output fromTSampleStartStopTest::StartStopTimingTest:

    Test TSampleStartStopTest ( Pass ) {time 188 +/- 67 us}

[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