### IStartStopTimingTest

  IStartStopTimingTest is an abstract framework class for timing measurements too complicated to do with ITimingTest. It is a subclass of ITimingTest with the following:
  1. Lower precision
  2. The ability to start and stop the timer.

  It is used when the timer needs to be started and stopped multiple times. Because this results in a loss of precision, use ITimingTest whenever possible.

  To use, subclass and override startStopTimingTest much as you would override ITimingTest::timingTest.

### IStartStopTimingTest - Member Functions and Data by Group

### Constructors & Destructor

Class constructors and destructors.

~IStartStopTimingTest

      public:
      virtual ~IStartStopTimingTest()

  Destructs objects of this class.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

IStartStopTimingTest

  Overload 1

      public:
      IStartStopTimingTest(const IStartStopTimingTest& other)

  Copy constructor that accepts the IStartStopTimingTest to be copied.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      IStartStopTimingTest( unsigned long timingCount,
                            unsigned long sampleCount )

  Constructor that explicitly sets timing count and sample count.
  timingCount
    Explicit timing count.
  sampleCount
    Explicit sample count.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 3

      protected:
      IStartStopTimingTest()

  This is the default constructor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Assignment Operators

Standard assignment operators.

operator =

      public:
      IStartStopTimingTest&
        operator =( const IStartStopTimingTest& other )

  Standard assignment operator which accepts the IStartStopTimingTest object used in the assignment.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Specialization Methods

Advanced specialized subclass methods to be used only by those users with a good understanding of the Timing Test classes.

doUntimedTest

      protected:
      virtual void doUntimedTest()

  Runs the startStopTimingTest without performing the timing. For example, execute only timingSetup, startStopTimingTest, and timingCleanup. Useful to debug the startStopTimingTest without concern for the timing aspects.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

oneEmptySample

      protected:
      virtual double oneEmptySample()

  Runs an empty sample. Useful to determine the amount of time necessary for the overhead of doing the timing.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

oneSample

      protected:
      virtual double oneSample()

  Determines the time it takes to run one sample.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

samplingErrorMicroseconds

      protected:
      virtual double samplingErrorMicroseconds() const

  Returns the sampling error.

  For start-stop tests, the sampling error per sample is `k alpha`, where k is the number of calls to start or stop per call to startStopTimingTest.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Timing Methods

Methods used to start and stop the timing test.

emptyStartStopTimingTest

      protected:
      virtual void
        emptyStartStopTimingTest( ITimingTestStopwatch& )

  This class calls the timer repeatedly to calibrate times and account for the overhead involved in starting or stoppping the timer. If your startStopTimingTest method starts and stops the timer more than once, override emptyStartStopTimingTest. In your version, start and stop the timer as many times as you do in startStopTimingTest. The class will use this method to calibrate times and to account for the overhead involved in starting or stopping the timer.

  The ITimingTestStopwatch is the stopwatch object which you should start and stop. In your overridden version, start and stop this object as many times as you do in startStopTimingTest. For example: Start, stop, start, stop. IStartStopTimingTest uses this function to calibrate times and account for the overhead involved in starting or stopping the timer.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

startStopTimingTest

      protected:
      virtual void startStopTimingTest(ITimingTestStopwatch&) = 0

  This method is analogous to ITimingTest::timingTest. Subclasses override this method to do the following:
  - Do necessary setup
  - Start the timer (which is passed into the method)
  - Do the timed operation
  - Stop the timer
  - Do necessary cleanup

  For example:

          {
            // Setup the test
            timer.start();
            // Do the operation to be timed
            // ...
            // Stop the timer
            timer.stop();
            // Cleanup
          };

  If necessary, the timer can be started and stopped more than once, but this should be avoided if at all possible.

  The startStopTimingTest method should always assume the timer is stopped on entry into the method, and should always stop the timer before exiting the method.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IStartStopTimingTest - Inherited Member Functions and Data

#### Inherited Public Functions

  ITest

  -     virtual ~ITest()

  -     void copyInputs(int& argc, char * *& argv) const

  -     virtual EStage exceptionStage() const

  -     virtual bool lookupInfo(const IString& key, IString& info)

  -     ITest& operator =(const ITest& test)

  -     ITieredTextBuffer& outputTextStream()

  -     virtual void run()

  -     virtual unsigned long runCount() const

  -     void setInputs(const int argc, const char * const* argv)

  -     bool success() const

  ITimingTest

  -     virtual ~ITimingTest()

  -     double automaticSampleTolerance() const

  -     bool automaticSampling() const

  -     void calibrate()

  -     double calibratedMeanMicroseconds()

  -     double calibratedMedianMicroseconds()

  -     double clockNowOverhead() const

  -     bool continualCalibration() const

  -     virtual void copyInfo()

  -     void copySamples(long& count, double *&) const

  -     double correlationMicroseconds() const

  -     bool correlationTooLarge() const

  -     double errorMicroseconds() const

  -     bool errorTooLarge() const

  -     ITimingTest(const ITimingTest& source)

  -     double maximumAllowedMedianMicroseconds() const

  -     unsigned long maximumSampleWindows() const

  -     double minimumSampleCorrelation() const

  -     ITimingTest& operator =(const ITimingTest& rhs)

  -     double relativeErrorMicroseconds() const

  -     unsigned long sampleCount() const

  -     unsigned long samplesDiscarded() const

  -     unsigned long samplesTaken() const

  -     void setAutomaticSampleTolerance(double tolerance)

  -     void setAutomaticSampling(bool doAutomaticSampling)

  -     void setContinualCalibration(bool continuallyCalibrate)

  -     void setMaximumAllowedMedianMicroseconds(double timeLimit)

  -     void setMaximumSampleWindows(unsigned long maxWindows)

  -     void setMinimumSampleCorrelation(double minSampleCorr)

  -     void setSampleCount(unsigned long sampleCount)

  -     void setTimingCount(unsigned long timingCount)

  -     void setTimingOn(bool timingOn)

  -     unsigned long timingCount() const

  -     bool timingOn() const

#### Inherited Public Data

  ITest

  -     static const IString & _Import kComponentKey

  -     static const IString& kComponentKey

  -     static const IString & _Import kDescriptionKey

  -     static const IString& kDescriptionKey

  -     static const IString& kInputSyntaxKey

  -     static const IString & _Import kInputSyntaxKey

  -     static const IString& kTargetClassKey

  -     static const IString & _Import kTargetClassKey

  -     static const IString& kTestNameKey

  -     static const IString & _Import kTestNameKey

  -     static const IString& kTestTypeKey

  -     static const IString & _Import kTestTypeKey

  -     static const IString& kTestVersionKey

  -     static const IString & _Import kTestVersionKey

  ITimingTest

  -     static const double kDefaultAutomaticSamplingTolerance

  -     static const double kDefaultMinimumCorrelation

#### Inherited Protected Functions

  ITest

  -     virtual void addInfo(const IString&, const IString&)

  -     virtual bool isReset() const

  -     virtual bool isSuccessUndecided() const

  -     ITest()

  -     ITest(const ITest& test)

  -     virtual void print(ITieredTextBuffer&)

  -     virtual void reset()

  -     virtual void setStickySuccess(bool success)

  -     virtual void setSuccess(bool success)

  -     virtual void test() = 0

  ITimingTest

  -     virtual void cleanup()

  -     ITimingTest( unsigned long timingCount,
                     unsigned long sampleCount )

  -     ITimingTest()

  -     virtual void print(ITieredTextBuffer& out)

  -     virtual void setup()

  -     virtual void test()

  -     virtual void timingCleanup()

  -     virtual void timingSetup()

  -     virtual void timingTest() = 0

#### Inherited Protected Data

  - None