fern.benchmark
Class Benchmark

java.lang.Object
  extended by fern.benchmark.Benchmark
Direct Known Subclasses:
RandomNumber, SimulatorPerformance

public abstract class Benchmark
extends Object

Base class for all benchmark classes. Gives methods for measuring elapsed time as well as methods for creating test sets and benchmark data handling.

Author:
Florian Erhard

Constructor Summary
Benchmark()
           
 
Method Summary
 void addData(double[] d)
          Adds benchmark data to the data pool.
 void clearData()
          Clears all collected benchmark data.
 double[] createRandomDoubleArray(int size, cern.jet.random.AbstractDistribution dist)
          Creates a test set containing size random numbers of the distribution dist.
 long end()
          Gets the elapsed time since the last call of start in nanoseconds
 int getNumBins()
          Gets the number of bins that are used for creating gnuplot histograms.
 void setNumBins(int numBins)
          Sets the number of bins that are used for creating gnuplot histograms.
 void start()
          sets a start time for the benchmark system
 GnuPlot toGnuplot(GnuPlot gnuplot, String[] dataLabels, String[] styles)
          Adds the benchmark data without conversion to a given GnuPlot object.
 GnuPlot toGnuplot(String[] dataLabels, String[] styles)
          Adds the benchmark data without conversion to a new GnuPlot object.
 GnuPlot toGnuPlotAsHistogram(GnuPlot gnuplot, String[] dataLabels, String[] styles)
          Adds the benchmark data as histogram to a given GnuPlot object.
 GnuPlot toGnuPlotAsHistogram(String[] dataLabels, String[] styles)
          Adds the benchmark data as histogram to a new GnuPlot object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Benchmark

public Benchmark()
Method Detail

getNumBins

public int getNumBins()
Gets the number of bins that are used for creating gnuplot histograms. Default is 100.

Returns:
number of bins

setNumBins

public void setNumBins(int numBins)
Sets the number of bins that are used for creating gnuplot histograms. Default is 100.

Parameters:
numBins - number of bins

addData

public void addData(double[] d)
Adds benchmark data to the data pool.

Parameters:
d - benchmark data

clearData

public void clearData()
Clears all collected benchmark data.


toGnuplot

public GnuPlot toGnuplot(String[] dataLabels,
                         String[] styles)
Adds the benchmark data without conversion to a new GnuPlot object.

Parameters:
dataLabels - labels for the benchmark data
styles - styles for the benchmark data
Returns:
a GnuPlot object containing the benchmark data
See Also:
GnuPlot

toGnuplot

public GnuPlot toGnuplot(GnuPlot gnuplot,
                         String[] dataLabels,
                         String[] styles)
Adds the benchmark data without conversion to a given GnuPlot object.

Parameters:
dataLabels - labels for the benchmark data
styles - styles for the benchmark data
Returns:
a GnuPlot object containing the benchmark data
See Also:
GnuPlot

toGnuPlotAsHistogram

public GnuPlot toGnuPlotAsHistogram(String[] dataLabels,
                                    String[] styles)
Adds the benchmark data as histogram to a new GnuPlot object.

Parameters:
dataLabels - labels for the benchmark data
styles - styles for the benchmark data
Returns:
a GnuPlot object containing the benchmark data
See Also:
GnuPlot

toGnuPlotAsHistogram

public GnuPlot toGnuPlotAsHistogram(GnuPlot gnuplot,
                                    String[] dataLabels,
                                    String[] styles)
Adds the benchmark data as histogram to a given GnuPlot object.

Parameters:
dataLabels - labels for the benchmark data
styles - styles for the benchmark data
Returns:
a GnuPlot object containing the benchmark data
See Also:
GnuPlot

start

public void start()
sets a start time for the benchmark system


end

public long end()
Gets the elapsed time since the last call of start in nanoseconds

Returns:
elapsed time in ns

createRandomDoubleArray

public double[] createRandomDoubleArray(int size,
                                        cern.jet.random.AbstractDistribution dist)
Creates a test set containing size random numbers of the distribution dist.

Parameters:
size - the size of the test set
dist - the probability distribution
Returns:
test set