SELF - when extending this class, please add your class as the SELF. ie.
public class ExampleBenchmarksState extends BenchmarksState<ExampleBenchmarksState> {
...
}
public class BenchmarksState<SELF extends BenchmarksState<SELF>> extends Object
runForSync(Function) and runForAsync(Function)
respectively.| Modifier and Type | Field and Description |
|---|---|
protected BenchmarksSettings |
settings |
| Constructor and Description |
|---|
BenchmarksState(BenchmarksSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterAll() |
protected void |
beforeAll() |
com.codahale.metrics.Histogram |
histogram(String name)
Returns histogram with specified name.
|
com.codahale.metrics.Meter |
meter(String name)
Returns meter with specified name.
|
void |
runForAsync(Function<SELF,Function<Long,org.reactivestreams.Publisher<?>>> func)
Runs given function on this state.
|
void |
runForSync(Function<SELF,Function<Long,Object>> func)
Runs given function in the state.
|
reactor.core.scheduler.Scheduler |
scheduler() |
void |
shutdown()
Executes shutdown process of the state, also it includes running of
afterAll(). |
void |
start()
Executes starting of the state, also it includes running of
beforeAll(). |
com.codahale.metrics.Timer |
timer(String name)
Returns timer with specified name.
|
protected final BenchmarksSettings settings
public BenchmarksState(BenchmarksSettings settings)
protected void beforeAll()
protected void afterAll()
public final void start()
beforeAll().public final void shutdown()
afterAll().public reactor.core.scheduler.Scheduler scheduler()
public com.codahale.metrics.Timer timer(String name)
name - namepublic com.codahale.metrics.Meter meter(String name)
name - namepublic com.codahale.metrics.Histogram histogram(String name)
name - namepublic final void runForSync(Function<SELF,Function<Long,Object>> func)
start() before and
shutdown() after.
NOTICE: It's only for synchronous code.
func - a function that should return the execution to be tested for the given SELF. This execution would run
on all positive values of Long (i.e. the benchmark itself) the return value is ignored.public final void runForAsync(Function<SELF,Function<Long,org.reactivestreams.Publisher<?>>> func)
start() before and
shutdown() after.
NOTICE: It's only for asynchronous code.
func - a function that should return the execution to be tested for the given SELF. This execution would run
on all positive values of Long (i.e. the benchmark itself) On the return value, as it is a Publisher, The
benchmark test would subscribe, And upon all subscriptions - await
for termination.Copyright © 2015–2018. All rights reserved.