@FunctionalInterface public interface NanoSampler
NanoSampler interface provides a contract for recording samples where the duration of each sample
is measured in nanoseconds. It is a functional interface, meaning it is intended to be used with lambda expressions
or method references.
Classes implementing this interface, such as Histogram, should record samples with nanosecond precision.
The NanoSampler interface is marked as SingleThreaded, indicating that implementations are not
thread-safe and must only be accessed by a single thread at a time.
| Modifier and Type | Method and Description |
|---|---|
void |
sampleNanos(long durationNs)
Records a sample with the provided duration in nanoseconds.
|
void sampleNanos(long durationNs)
This method must be called from a single thread only. If called from multiple threads or if provided with a negative duration, the result is unspecified and no errors or exceptions should be thrown.
durationNs - The duration of the sample in nanoseconds. Must be non-negative.Copyright © 2024. All rights reserved.