forked from influxdata/kapacitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
edge_test.go
48 lines (42 loc) · 937 Bytes
/
edge_test.go
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
package kapacitor
import (
"log"
"os"
"testing"
"github.com/influxdata/kapacitor/models"
"github.com/influxdata/kapacitor/pipeline"
"github.com/influxdata/wlog"
)
func BenchmarkCollectPoint(b *testing.B) {
name := "point"
b.ReportAllocs()
ls := &logService{}
e := newEdge("BCollectPoint", "parent", "child", pipeline.StreamEdge, defaultEdgeBufferSize, ls)
p := models.Point{
Name: name,
Tags: models.Tags{
"tag1": "value1",
"tag2": "value2",
"tag3": "value3",
"tag4": "value4",
},
Group: models.ToGroupID(name, nil, models.Dimensions{}),
Fields: models.Fields{
"field1": 42,
"field2": 4.2,
"field3": 49,
"field4": 4.9,
},
}
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
e.CollectPoint(p)
e.NextPoint()
}
})
}
type logService struct{}
func (l *logService) NewLogger(prefix string, flag int) *log.Logger {
return wlog.New(os.Stderr, prefix, flag)
}