-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark_test.go
52 lines (46 loc) · 1.1 KB
/
benchmark_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
49
50
51
52
package ali_log
import (
"fmt"
"testing"
"time"
)
type appConf struct {
Url string
AccessKey string
AccessKeySecret string
LogStore string
Topic string
C int
AliLogMapChan chan map[string]string
}
func BenchmarkAliLogRecordGorountine(b *testing.B) {
conf := appConf{
Url: "vslog.cn-hangzhou.log.aliyuncs.com",
AccessKey: "xxxxxxxxxxxxxxxxxxxxxx",
AccessKeySecret: "xxxxxxxxxxxxxxxxxxxxxx",
LogStore: "go-log-service",
Topic: "async-service",
C: 100,
}
conf.AliLogMapChan = make(chan map[string]string, conf.C)
AliLogRecordGoroutine(
conf.Topic,
NewLogstore(
conf.LogStore,
NewAliLogClient(
conf.Url,
conf.AccessKey,
conf.AccessKeySecret,
)),
conf.AliLogMapChan)
for i := 0; i < b.N; i++ {
conf.AliLogMapChan <- map[string]string{
"IP": "192.168.1.70",
"OccurTimeStamp": fmt.Sprintf("%v", time.Now().Unix()),
"AppName": "logs",
"OptName": "test",
"InputParams": "InputParams-test",
"Err": "success",
}
}
}