File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 6
6
"log"
7
7
"sync"
8
8
"testing"
9
+ "time"
9
10
)
10
11
11
12
const FANOUT = 128
@@ -114,7 +115,7 @@ func Example() {
114
115
115
116
// Threadsafe registration
116
117
t := GetOrRegisterTimer ("db.get.latency" , nil )
117
- t .Time (func () {})
118
+ t .Time (func () { time . Sleep ( 10 * time . Millisecond ) })
118
119
t .Update (1 )
119
120
120
121
fmt .Println (c .Count ())
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ func TestTimerStop(t *testing.T) {
47
47
func TestTimerFunc (t * testing.T ) {
48
48
tm := NewTimer ()
49
49
tm .Time (func () { time .Sleep (50e6 ) })
50
- if max := tm .Max (); 45e6 > max || max > 55e6 {
51
- t .Errorf ("tm.Max(): 45e6 > %v || %v > 55e6 \n " , max , max )
50
+ if max := tm .Max (); 35e6 > max || max > 95e6 {
51
+ t .Errorf ("tm.Max(): 35e6 > %v || %v > 95e6 \n " , max , max )
52
52
}
53
53
}
54
54
You can’t perform that action at this time.
0 commit comments