org.javasimon.utils
Class BenchmarkUtils

java.lang.Object
  extended by org.javasimon.utils.BenchmarkUtils

public class BenchmarkUtils
extends Object

Utility class for benchmark execution.

Since:
3.1
Author:
virgo47@gmail.com

Nested Class Summary
static class BenchmarkUtils.Task
          Helper object that requires implementing the BenchmarkUtils.Task.perform() method with benchmarked block of code.
 
Field Summary
private static Manager MANAGER
           
 
Constructor Summary
BenchmarkUtils()
           
 
Method Summary
private static void measure(int measuredRuns, BenchmarkUtils.Task[] tasks)
           
private static void presentSummary(BenchmarkUtils.Task[] tasks)
           
static StopwatchSample[] run(int warmupRuns, int measuredRuns, BenchmarkUtils.Task... tasks)
          Runs the list of tasks to be benchmarked and returns StopwatchSample array with measured results.
private static void warmup(int warmupRuns, BenchmarkUtils.Task[] tasks)
           
private static void warmupTask(BenchmarkUtils.Task task)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANAGER

private static final Manager MANAGER
Constructor Detail

BenchmarkUtils

public BenchmarkUtils()
Method Detail

run

public static StopwatchSample[] run(int warmupRuns,
                                    int measuredRuns,
                                    BenchmarkUtils.Task... tasks)
Runs the list of tasks to be benchmarked and returns StopwatchSample array with measured results. Number of warmup runs (without measuring) and measured runs must be specified. BenchmarkUtils.Task provides the name of the Stopwatch that will store results.

Tasks should not be extremely short - see BenchmarkUtils.Task javadoc for more.

Parameters:
warmupRuns - number of runs before the measuring starts
measuredRuns - number of measured runs
tasks - list of tasks to measure
Returns:
result of the measured runs as an array of stopwatch objects in the order of the tasks

warmup

private static void warmup(int warmupRuns,
                           BenchmarkUtils.Task[] tasks)

warmupTask

private static void warmupTask(BenchmarkUtils.Task task)

measure

private static void measure(int measuredRuns,
                            BenchmarkUtils.Task[] tasks)

presentSummary

private static void presentSummary(BenchmarkUtils.Task[] tasks)


Copyright © 2013. All Rights Reserved.