Timer

public interface Timer extends Metric, Metered, Sampling

Represents a metric that collects the durations of timed operations.

Methods

time

Context time()

Initiate a new timing context.

Returns:the context

update

void update(long duration, TimeUnit unit)

Add a recorded duration.

Parameters:
  • duration – the length of the duration
  • unit – the time unit of the duration