Package org.apache.sling.commons.metrics

# Interface Timer

All Superinterfaces:
  `Counting`, `Metric`

@ProviderType public interface Timer extends Counting, Metric
A timer metric which aggregates timing durations and provides duration statistics.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`Timer.Context`
A timing context.

## Method Summary

Modifier and Type
Method
Description
`Timer.Context`
`time()`
Returns a new `Timer.Context`.
`void`
`update(long duration, TimeUnit unit)`
Adds a recorded duration.

### Methods inherited from interface org.apache.sling.commons.metrics.Counting

`getCount`

### Methods inherited from interface org.apache.sling.commons.metrics.Metric

`adaptTo`

## Method Details

### update

void update(long duration, TimeUnit unit)
Adds a recorded duration.

Parameters:
  `duration` - the length of the duration
  `unit` - the scale unit of `duration`

### time

Timer.Context time()
Returns a new `Timer.Context`.

Returns:
  a new `Timer.Context`
See Also:
  - `Timer.Context`