BenchmarkRuleKt

public final class BenchmarkRuleKt


Summary

Public methods

static final void

Benchmark a block of code.

Public methods

BenchmarkRuleKt.measureRepeated

public static final void BenchmarkRuleKt.measureRepeated(
    BenchmarkRule receiver,
    @ExtensionFunctionType Function1<BenchmarkRule.ScopeUnit> block
)

Benchmark a block of code.

@get:Rule
val benchmarkRule = BenchmarkRule();

@Test
fun myBenchmark() {
...
benchmarkRule.measureRepeated {
doSomeWork()
}
...
}
Parameters
@ExtensionFunctionType Function1<BenchmarkRule.ScopeUnit> block

The block of code to benchmark.