com.google.caliper
Class SimpleBenchmark

java.lang.Object
  extended by com.google.caliper.api.Benchmark
      extended by com.google.caliper.SimpleBenchmark
All Implemented Interfaces:
Benchmark

public abstract class SimpleBenchmark
extends Benchmark
implements Benchmark

A convenience class for implementing benchmarks in plain code. Implementing classes must have a no-arguments constructor.

Benchmarks

The benchmarks of a suite are defined by . They may be static. They are not permitted to take parameters . . ..

Parameters

See the Param documentation to learn about parameters.


Method Summary
 double bytesToUnits(long bytes)
           
 ConfiguredBenchmark createBenchmark(Map<String,String> parameterValues)
           
 Map<String,Integer> getInstanceUnitNames()
           
 Map<String,Integer> getMemoryUnitNames()
           
 Map<String,Integer> getTimeUnitNames()
          A mapping of units to their values.
 double instancesToUnits(long instances)
           
 double nanosToUnits(double nanos)
          Converts nanoseconds to the smallest unit defined in Benchmark.getTimeUnitNames().
 Scenario normalizeScenario(Scenario scenario)
           
 Set<String> parameterNames()
           
 Set<String> parameterValues(String parameterName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parameterNames

public Set<String> parameterNames()
Specified by:
parameterNames in interface Benchmark

parameterValues

public Set<String> parameterValues(String parameterName)
Specified by:
parameterValues in interface Benchmark

createBenchmark

public ConfiguredBenchmark createBenchmark(Map<String,String> parameterValues)
Specified by:
createBenchmark in interface Benchmark

normalizeScenario

public Scenario normalizeScenario(Scenario scenario)

getTimeUnitNames

public Map<String,Integer> getTimeUnitNames()
Description copied from interface: Benchmark
A mapping of units to their values. Their values must be integers, but all values are relative, so if one unit is 1.5 times the size of another, then these units can be expressed as {"unit1"=10,"unit2"=15}. The smallest unit given by the function will be used to display immediate results when running at the command line. e.g. 0% Scenario{...} 16.08; σ=1.72 @ 3 trials

Specified by:
getTimeUnitNames in interface Benchmark

nanosToUnits

public double nanosToUnits(double nanos)
Description copied from interface: Benchmark
Converts nanoseconds to the smallest unit defined in Benchmark.getTimeUnitNames().

Specified by:
nanosToUnits in interface Benchmark

getInstanceUnitNames

public Map<String,Integer> getInstanceUnitNames()
Specified by:
getInstanceUnitNames in interface Benchmark

instancesToUnits

public double instancesToUnits(long instances)
Specified by:
instancesToUnits in interface Benchmark

getMemoryUnitNames

public Map<String,Integer> getMemoryUnitNames()
Specified by:
getMemoryUnitNames in interface Benchmark

bytesToUnits

public double bytesToUnits(long bytes)
Specified by:
bytesToUnits in interface Benchmark


Copyright © 2009-2011 Google, Inc.. All Rights Reserved.