Class PerformanceTest

java.lang.Object
org.apache.batik.test.AbstractTest
org.apache.batik.test.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 Details

    • 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 Details

    • PerformanceTest

      public PerformanceTest()
  • Method Details

    • 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 Exception
      Force implementations to only implement runOp and other performance specific methods.
      Overrides:
      runImplBasic in class AbstractTest
      Throws:
      Exception
    • runImpl

      public final TestReport runImpl() throws 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:
      Exception
      See Also:
    • sort

      protected void sort(double[] a) throws Exception
      Throws:
      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 Exception
      Runs the tested operation
      Throws:
      Exception