...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package mvcc
16
17 import (
18 "fmt"
19 "testing"
20
21 "go.etcd.io/etcd/server/v3/lease"
22 betesting "go.etcd.io/etcd/server/v3/mvcc/backend/testing"
23
24 "go.uber.org/zap"
25 )
26
27 func BenchmarkKVWatcherMemoryUsage(b *testing.B) {
28 be, tmpPath := betesting.NewDefaultTmpBackend(b)
29 watchable := newWatchableStore(zap.NewExample(), be, &lease.FakeLessor{}, StoreConfig{})
30
31 defer cleanup(watchable, be, tmpPath)
32
33 w := watchable.NewWatchStream()
34
35 b.ReportAllocs()
36 b.StartTimer()
37 for i := 0; i < b.N; i++ {
38 w.Watch(0, []byte(fmt.Sprint("foo", i)), nil, 0)
39 }
40 }
41
View as plain text