de.uni.leipzig.IR15.Benchmark
Class Benchmark

java.lang.Object
  extended by de.uni.leipzig.IR15.Benchmark.Benchmark
Direct Known Subclasses:
DEXBenchmark, ImportBenchmark, MySQLBenchmark, Neo4jBenchmark, OrientDBBenchmark

public abstract class Benchmark
extends java.lang.Object

This abstract base class must be extended by any benchmark in the suite. It defines some simple methods which are used during benchmark processing.

Author:
Martin 's1ck' Junghanns

Constructor Summary
Benchmark()
           
 
Method Summary
abstract  void afterRun()
          This method is called after each single call of run()
abstract  void beforeRun()
          This method is called before each single call of run()
 int getCurrentRun()
          Returns the number of current benchmark run
abstract  java.lang.String getName()
          Returns the Benchmarks name
 java.util.Map<java.lang.String,java.lang.Object> getResults(long[] runtimes)
          This method calculates some default measurement results: average, standard deviation, minimum and maximum value.
 int getRuns()
          Returns the number of benchmarks to run
abstract  void run()
          This method runs the benchmark
 void setCurrentRun(int currentRun)
          Set the number of current benchmark run
 void setRuns(int runs)
          Sets the number of benchmarks to run
abstract  void setUp()
          This method is called once before run() is invoked for the first time.
abstract  void tearDown()
          This method is called once after the last call of run()
abstract  void warmup()
          This method is called once before the benchmark starts
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Benchmark

public Benchmark()
Method Detail

setRuns

public void setRuns(int runs)
Sets the number of benchmarks to run

Parameters:
runs - number of benchmarks

getRuns

public int getRuns()
Returns the number of benchmarks to run

Returns:
number of benchmarks

setCurrentRun

public void setCurrentRun(int currentRun)
Set the number of current benchmark run

Parameters:
currentRun -

getCurrentRun

public int getCurrentRun()
Returns the number of current benchmark run

Returns:

setUp

public abstract void setUp()
This method is called once before run() is invoked for the first time.


run

public abstract void run()
This method runs the benchmark


tearDown

public abstract void tearDown()
This method is called once after the last call of run()


beforeRun

public abstract void beforeRun()
This method is called before each single call of run()


afterRun

public abstract void afterRun()
This method is called after each single call of run()


warmup

public abstract void warmup()
This method is called once before the benchmark starts


getName

public abstract java.lang.String getName()
Returns the Benchmarks name

Returns:
name of the benchmark

getResults

public java.util.Map<java.lang.String,java.lang.Object> getResults(long[] runtimes)
This method calculates some default measurement results: average, standard deviation, minimum and maximum value. The method can be overwritten and enhanced with custom benchmark results.

Parameters:
runtimes - an array with all benchmark results
Returns:
a map between measure name (e.g. "average") and its value (e.g. 23)