public class MicroBenchmark extends Object
Every benchmark has three parts:
All time is measured in nanoseconds.
Constructor and Description |
---|
MicroBenchmark()
Create default micro benchmark measurer
|
MicroBenchmark(int warmup,
int iterations)
Create micro benchmark measurer.
|
Modifier and Type | Method and Description |
---|---|
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics |
measure(@NotNull Runnable test)
Run the benchmark and measure run-time statistics in nanoseconds.
|
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics |
measure(@Nullable Runnable pre,
@NotNull Runnable test,
@Nullable Runnable post)
Run the benchmark and measure run-time statistics in nanoseconds.
|
public MicroBenchmark()
public MicroBenchmark(int warmup, int iterations)
warmup
- number of test calls for warmupiterations
- number of test calls for measurementpublic org.apache.commons.math3.stat.descriptive.DescriptiveStatistics measure(@Nullable @Nullable Runnable pre, @NotNull @NotNull Runnable test, @Nullable @Nullable Runnable post)
Before the run the warm-up phase is executed.
pre
- Optional pre-test setuptest
- Mandatory testpost
- Optional post-test cleanuppublic org.apache.commons.math3.stat.descriptive.DescriptiveStatistics measure(@NotNull @NotNull Runnable test)
Before the run the warm-up phase is executed. No pre or post operations are executed.
test
- test to measureCopyright © 2018. All rights reserved.