public class NanoTimer extends SimpleCounter
Modifier and Type | Field and Description |
---|---|
private long |
start
start of the operation
|
publish
enabled, enabler
Modifier | Constructor and Description |
---|---|
protected |
NanoTimer(java.util.function.LongConsumer publish)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static NanoTimer |
getInstance(OptionalCounter counter)
Create and register instance
|
void |
start()
Start operation
|
void |
stop()
Stop operation and update counter
|
void |
timer(Operation r)
Execute operation and measure execution time
|
update
getEnabler, isEnabled, setEnabled, setEnabler
protected NanoTimer(java.util.function.LongConsumer publish)
publish
- samples' consumerpublic static NanoTimer getInstance(OptionalCounter counter)
counter
- Counter MBeanNanoTimer
instancepublic void start()
public void stop()
public void timer(Operation r)
r
- operation to be executed