5 // Timer acts as a stopwatch, sending observations to a wrapped histogram.
6 // It's a bit of helpful syntax sugar for h.Observe(time.Since(x)).
13 // NewTimer wraps the given histogram and records the current time.
14 func NewTimer(h Histogram) *Timer {
22 // ObserveDuration captures the number of seconds since the timer was
23 // constructed, and forwards that observation to the histogram.
24 func (t *Timer) ObserveDuration() {
25 d := float64(time.Since(t.t).Nanoseconds()) / float64(t.u)
32 // Unit sets the unit of the float64 emitted by the timer.
33 // By default, the timer emits seconds.
34 func (t *Timer) Unit(u time.Duration) {