-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtimer.go
More file actions
55 lines (46 loc) · 794 Bytes
/
timer.go
File metadata and controls
55 lines (46 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package metrics
import (
"github.com/rcrowley/go-metrics"
"time"
)
type Timer interface {
Metric
Count() int64
Max() int64
Mean() float64
Min() int64
Percentile(float64) float64
Percentiles([]float64) []float64
Rate1() float64
Rate5() float64
Rate15() float64
RateMean() float64
StdDev() float64
Sum() int64
Variance() float64
Time(func())
Update(time.Duration)
UpdateSince(time.Time)
CreateSnapshot() Timer
}
type timerImpl struct {
metrics.Timer
dispose func()
}
func (t *timerImpl) CreateSnapshot() Timer {
return &timerSnapshot{
Timer: t.Snapshot(),
}
}
func (t *timerImpl) Dispose() {
t.Stop()
t.dispose()
}
type timerSnapshot struct {
metrics.Timer
}
func (t *timerSnapshot) Dispose() {
}
func (t *timerSnapshot) CreateSnapshot() Timer {
return t
}