PCJ API
Version 1.2

bak.pcj.benchmark
Class Benchmark

java.lang.Object
  extended bybak.pcj.benchmark.Benchmark
Direct Known Subclasses:
CollectionBenchmark, IntCollectionBenchmark, IntKeyIntMapBenchmark, IntKeyMapBenchmark, MapBenchmark

public abstract class Benchmark
extends Object

This class represents benchmark tests. All benchmarks should inherit this class. When writing a benchmark, create public methods starting with "benchmark" and taking one argument of class DataSet. After invoking each of these methods, the benchmark runner will read the benchmark's timer to produce a result. Within such a benchmark method, the timer should be started when initialization is done and stopped when the operations are done. The pattern is this:

      public String benchmarkXXXXX(DataSet dataSet) {
          <initialize>
          startTimer();
          <operations to benchmark>
          stopTimer();
          <clean up>
          return "description of task";
      }
  

Since:
1.0

Constructor Summary
Benchmark()
           
 
Method Summary
abstract  String getClassId()
          Returns the name of the class that is benchmarked.
 long readTimer()
          Returns the last timing result.
protected  void startTimer()
          Starts the timer to measure operations.
protected  void stopTimer()
          Starts the timer to measure operations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Benchmark

public Benchmark()
Method Detail

startTimer

protected void startTimer()
Starts the timer to measure operations.


stopTimer

protected void stopTimer()
Starts the timer to measure operations.


readTimer

public long readTimer()
Returns the last timing result. If no timing result is available, the return value is undefined.

Returns:
the last timing result.

getClassId

public abstract String getClassId()
Returns the name of the class that is benchmarked.

Returns:
the name of the class that is benchmarked.

PCJ API
Version 1.2

Report a bug or request a feature.
Further information on the development and latest release of PCJ can be found at the project homepage.

Primitive Collections for Java is released under the GNU Lesser General Public License.
Copyright © 2002, 2003 Søren Bak. All Rights Reserved.

Hosted by SourceForge.net
SourceForge.net Logo