uk.org.skeet.jbench.tasks
Class ArrayFill

java.lang.Object
  |
  +--uk.org.skeet.jbench.tasks.ArrayFill
All Implemented Interfaces:
BenchTask
Direct Known Subclasses:
ArrayFill3dButler, ArrayFill3dOriginal, ArrayFillPlain

public abstract class ArrayFill
extends java.lang.Object
implements BenchTask

Abstract class to enable simple array-fill benchmarking. It is assumed that all subclasses will try to fill the same amount of data (otherwise the benchmark is useless). To this end, subclasses should use the size parameter to determine the size of array to fill. (There may, of course, be one set of subclasses which are compatible with each other but incompatible with another set; so long as they use size in the same way, this is fine.)


Constructor Summary
ArrayFill()
           
 
Method Summary
 void checkConfiguration()
          Checks that we have a positive size and number of iterations
 void checkResults()
          No checking - we're lazy by default.
protected abstract  void fillArray()
          Fills the array.
 java.lang.String getDescription()
          Default description which gives the name of the actual class, the size of the array, and the number of iterations.
protected  int getSize()
          Returns the size to test
abstract  void prepareTest()
          Creates the array to be filled during the test.
 void runTest()
          Simply calls fillArray() however many times has been specified by iterations.
 void setIterations(int value)
          Sets the number of iterations per test
 void setSize(int value)
          Sets the size to test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayFill

public ArrayFill()
Method Detail

setIterations

public void setIterations(int value)
Sets the number of iterations per test

setSize

public void setSize(int value)
Sets the size to test

getSize

protected int getSize()
Returns the size to test

checkConfiguration

public void checkConfiguration()
                        throws ConfigurationException
Checks that we have a positive size and number of iterations
Specified by:
checkConfiguration in interface BenchTask
Following copied from interface: uk.org.skeet.jbench.BenchTask
Throws:
ConfigurationException - if the configuration specified is incomplete or invalid.

runTest

public void runTest()
             throws TaskException
Simply calls fillArray() however many times has been specified by iterations. This is done to increase the length of the task - it is assumed that no further preparation is actually necessary for reset.
Specified by:
runTest in interface BenchTask
Following copied from interface: uk.org.skeet.jbench.BenchTask
Throws:
TaskException - if the test failed to complete normally.

fillArray

protected abstract void fillArray()
                           throws TaskException
Fills the array.

prepareTest

public abstract void prepareTest()
                          throws TaskException
Creates the array to be filled during the test.
Specified by:
prepareTest in interface BenchTask
Following copied from interface: uk.org.skeet.jbench.BenchTask
Throws:
TaskException - if the preparation failed.

checkResults

public void checkResults()
No checking - we're lazy by default. Subclasses can always do checking if they want.
Specified by:
checkResults in interface BenchTask
Following copied from interface: uk.org.skeet.jbench.BenchTask
Throws:
TaskException - if the test failed.

getDescription

public java.lang.String getDescription()
Default description which gives the name of the actual class, the size of the array, and the number of iterations.
Specified by:
getDescription in interface BenchTask