jigcell.compare.tests
Class ElementBenchmark

java.lang.Object
  extended by jigcell.compare.tests.Benchmark
      extended by jigcell.compare.tests.ElementBenchmark

public class ElementBenchmark
extends Benchmark

A collection of tests for evaluating element performance.

This code is licensed under the DARPA BioCOMP Open Source License. See LICENSE for more details.

Author:
Nicholas Allen

Field Summary
protected static int[][] SIZES
          Parameter sizes for benchmarks
protected  IReadableDataSource source
          Source to load from
protected static java.lang.String[] TESTS
          Tests for the time series format
protected  IDataEditorTab view
          View to load in
 
Fields inherited from class jigcell.compare.tests.Benchmark
benchmarkRunnable, compare
 
Constructor Summary
ElementBenchmark(Compare compare)
          Creates a new tester for element creation performance.
 
Method Summary
 double[] benchmark(java.lang.Class clazz, int max, int size)
          Runs a creation benchmark on an element type.
static double[] benchmarkType(java.lang.Class clazz, int max, int size)
          Runs a creation benchmark for an element type.
protected static void fillPrint(java.lang.String text, int width)
          Prints a right aligned string.
static void main(java.lang.String[] args)
          Compares the performance of two implemetations of IEditableDataElement.
protected static double[] medianBenchmark(java.lang.Class clazz, int max, int size)
          Runs benchmarks on an element type and reports the median speed and memory results.
protected  void runOffEventThread()
          Performs the tester computations that do not interact with the interface.
protected  void runOnEventThread(int state)
          Performs an operation that interacts with the interface.
static void test(java.lang.Class clazz)
          Performs validation tests on an element type.
static void test(Compare compare)
          Runs a creation benchmark on all known element types.
 
Methods inherited from class jigcell.compare.tests.Benchmark
createBenchmarkReport, currentTime, loadInView, reset, runState, timeRunState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TESTS

protected static final java.lang.String[] TESTS
Tests for the time series format


SIZES

protected static final int[][] SIZES
Parameter sizes for benchmarks


view

protected IDataEditorTab view
View to load in


source

protected IReadableDataSource source
Source to load from

Constructor Detail

ElementBenchmark

public ElementBenchmark(Compare compare)
Creates a new tester for element creation performance.

Parameters:
compare - Comparator to abuse
Method Detail

benchmarkType

public static double[] benchmarkType(java.lang.Class clazz,
                                     int max,
                                     int size)
                              throws java.lang.Exception
Runs a creation benchmark for an element type.

Parameters:
clazz - Implementation to test
max - Number of elements to create
size - Size of the elements
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
Compares the performance of two implemetations of IEditableDataElement.

Parameters:
args - The first two arguments are the names of the classes to test

test

public static void test(Compare compare)
Runs a creation benchmark on all known element types.

Parameters:
compare - Comparator to abuse

test

public static void test(java.lang.Class clazz)
                 throws java.lang.Exception
Performs validation tests on an element type.

Parameters:
clazz - Implementation to test
Throws:
java.lang.Exception

fillPrint

protected static void fillPrint(java.lang.String text,
                                int width)
Prints a right aligned string.

Parameters:
text - Text
width - Amount of space to fill

medianBenchmark

protected static double[] medianBenchmark(java.lang.Class clazz,
                                          int max,
                                          int size)
                                   throws java.lang.Exception
Runs benchmarks on an element type and reports the median speed and memory results.

Parameters:
clazz - Implementation to test
max - Number of elements to create
size - Size of the elements
Throws:
java.lang.Exception

benchmark

public double[] benchmark(java.lang.Class clazz,
                          int max,
                          int size)
                   throws java.lang.Exception
Runs a creation benchmark on an element type.

Parameters:
clazz - Implementation to test
max - Number of elements to create
size - Size of the elements
Throws:
java.lang.Exception

runOffEventThread

protected void runOffEventThread()
                          throws java.lang.Exception
Performs the tester computations that do not interact with the interface. This method will be called at the start of the test.

Specified by:
runOffEventThread in class Benchmark
Throws:
java.lang.Exception

runOnEventThread

protected void runOnEventThread(int state)
                         throws java.lang.Exception
Performs an operation that interacts with the interface. After the operation completes, the thread needs to notify the benchmark.

Specified by:
runOnEventThread in class Benchmark
Parameters:
state - Indicates which interface operation is next
Throws:
java.lang.Exception