blob: 38e8eab80a6aef2cc6430f580d4dd79ddbefb239 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
package stats
import "time"
// Stopper calls Client.BumpSum and Client.BumpHistogram when End'ed
type Stopper struct {
Key string
Start time.Time
Client Client
}
// End the Stopper
func (s *Stopper) End() {
since := time.Since(s.Start).Seconds() * 1000.0
s.Client.BumpSum(s.Key+".total", since)
s.Client.BumpHistogram(s.Key, since)
}
|