Class BenchmarkHelper

java.lang.Object
net.imglib2.util.BenchmarkHelper

public class BenchmarkHelper extends Object
Tools for setting up basic benchmarks. Call benchmark(int, Runnable) with the number of iterations and a Runnable to benchmark to obtain a list of run-times in milliseconds.
Author:
Tobias Pietzsch
  • Constructor Details

    • BenchmarkHelper

      public BenchmarkHelper()
  • Method Details

    • benchmark

      public static ArrayList<Long> benchmark(int numRuns, Runnable benchmark)
      Run a benchmark numRuns times and record the milliseconds taken for each run.
      Parameters:
      numRuns - how many times to run the benchmark.
      benchmark - the benchmark.
      Returns:
      run-times for each run (in milliseconds).
    • benchmarkAndPrint

      public static void benchmarkAndPrint(int numRuns, boolean printIndividualTimes, Runnable b)
      Run a benchmark numRuns times and print the results to System.out .
      Parameters:
      numRuns - how many times to run the benchmark.
      printIndividualTimes - whether to print the time for every individual run or just the median.
      b - the benchmark.