Class PerformanceTest

  • All Implemented Interfaces:
    Test
    Direct Known Subclasses:
    OnePerformanceTest, PerformanceTestValidator.SimplePerformanceTest

    public abstract class PerformanceTest
    extends AbstractTest
    This abstract Test implementation instruments performance testing. Derived classes need only implement the runOp and, optionally, the runRef methods. The setReferenceScore method is used to specify the last recorded score for the performance test and the setAllowedScoreDeviation method is used to specify the allowed deviation from the reference score.
    Version:
    $Id: PerformanceTest.java 1733416 2016-03-03 07:07:13Z gadams $
    • Field Detail

      • referenceScore

        protected double referenceScore
        Reference score. -1 means there is no reference score
      • allowedScoreDeviation

        protected double allowedScoreDeviation
        Allowed deviation from the reference score. 10% by default
      • lastScore

        protected double lastScore
        Score during last run
    • Constructor Detail

      • PerformanceTest

        public PerformanceTest()
    • Method Detail

      • getLastScore

        public double getLastScore()
      • getReferenceScore

        public double getReferenceScore()
      • setReferenceScore

        public void setReferenceScore​(double referenceScore)
      • getAllowedScoreDeviation

        public double getAllowedScoreDeviation()
      • setAllowedScoreDeviation

        public void setAllowedScoreDeviation​(double allowedScoreDeviation)
      • run

        public final TestReport run()
        Force implementations to only implement runOp and other performance specific methods.
        Specified by:
        run in interface Test
        Overrides:
        run in class AbstractTest
      • runImplBasic

        public final boolean runImplBasic()
                                   throws java.lang.Exception
        Force implementations to only implement runOp and other performance specific methods.
        Overrides:
        runImplBasic in class AbstractTest
        Throws:
        java.lang.Exception
      • runImpl

        public final TestReport runImpl()
                                 throws java.lang.Exception
        This implementation of runImpl runs the reference operation (with runRef), then runs the operation (with runOp) and checks whether or not the score is within the allowed deviation of the reference score.
        Overrides:
        runImpl in class AbstractTest
        Throws:
        java.lang.Exception
        See Also:
        runRef(), runOp()
      • sort

        protected void sort​(double[] a)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • runRef

        protected void runRef()
        Runs the reference operation. By default, this runs the same BufferedImage drawing operation 10000 times
      • runOp

        protected abstract void runOp()
                               throws java.lang.Exception
        Runs the tested operation
        Throws:
        java.lang.Exception