Package net.imglib2.util
Class BenchmarkHelper
- java.lang.Object
-
- net.imglib2.util.BenchmarkHelper
-
public class BenchmarkHelper extends java.lang.Object
Tools for setting up basic benchmarks. Callbenchmark(int, Runnable)
with the number of iterations and aRunnable
to benchmark to obtain a list of run-times in milliseconds.- Author:
- Tobias Pietzsch
-
-
Constructor Summary
Constructors Constructor Description BenchmarkHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.ArrayList<java.lang.Long>
benchmark(int numRuns, java.lang.Runnable benchmark)
Run a benchmark numRuns times and record the milliseconds taken for each run.static void
benchmarkAndPrint(int numRuns, boolean printIndividualTimes, java.lang.Runnable b)
Run a benchmark numRuns times and print the results toSystem.out
.
-
-
-
Method Detail
-
benchmark
public static java.util.ArrayList<java.lang.Long> benchmark(int numRuns, java.lang.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, java.lang.Runnable b)
Run a benchmark numRuns times and print the results toSystem.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.
-
-