Package org.apache.batik.test
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 abstractTest
implementation instruments performance testing. Derived classes need only implement therunOp
and, optionally, therunRef
methods. ThesetReferenceScore
method is used to specify the last recorded score for the performance test and thesetAllowedScoreDeviation
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 Summary
Fields Modifier and Type Field Description protected double
allowedScoreDeviation
Allowed deviation from the reference score.protected double
lastScore
Score during last runprotected double
referenceScore
Reference score.-
Fields inherited from class org.apache.batik.test.AbstractTest
id, name, parent
-
-
Constructor Summary
Constructors Constructor Description PerformanceTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description double
getAllowedScoreDeviation()
double
getLastScore()
double
getReferenceScore()
TestReport
run()
Force implementations to only implementrunOp
and other performance specific methods.TestReport
runImpl()
This implementation of runImpl runs the reference operation (withrunRef
), then runs the operation (withrunOp
) and checks whether or not the score is within the allowed deviation of the reference score.boolean
runImplBasic()
Force implementations to only implementrunOp
and other performance specific methods.protected abstract void
runOp()
Runs the tested operationprotected void
runRef()
Runs the reference operation.void
setAllowedScoreDeviation(double allowedScoreDeviation)
void
setReferenceScore(double referenceScore)
protected void
sort(double[] a)
-
Methods inherited from class org.apache.batik.test.AbstractTest
assertEquals, assertEquals, assertNull, assertTrue, error, getId, getName, getParent, getQualifiedId, reportError, reportException, reportSuccess, setId, setName, setParent
-
-
-
-
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 implementrunOp
and other performance specific methods.- Specified by:
run
in interfaceTest
- Overrides:
run
in classAbstractTest
-
runImplBasic
public final boolean runImplBasic() throws java.lang.Exception
Force implementations to only implementrunOp
and other performance specific methods.- Overrides:
runImplBasic
in classAbstractTest
- Throws:
java.lang.Exception
-
runImpl
public final TestReport runImpl() throws java.lang.Exception
This implementation of runImpl runs the reference operation (withrunRef
), then runs the operation (withrunOp
) and checks whether or not the score is within the allowed deviation of the reference score.- Overrides:
runImpl
in classAbstractTest
- 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
-
-