-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (32 loc) · 693 Bytes
/
main.go
File metadata and controls
36 lines (32 loc) · 693 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
package main
import (
"fmt"
"time"
"github.com/tinywell/loadgen/lib"
"github.com/tinywell/loadgen/mock"
"github.com/tinywell/loadgen/model"
)
func main() {
caller := mock.NewMockCaller()
tickets, _ := lib.NewTickets(2)
set := lib.ParamSet{
Caller: caller,
Tickets: tickets,
Lps: 200,
TimeoutNS: time.Second * 2,
DurationNS: time.Second * 10,
ResultChan: make(chan *model.LDResult, 10),
}
gen := lib.NewGenerator(set)
if ok := gen.Start(); ok {
fmt.Println("ok")
}
readRes(set.ResultChan)
// time.Sleep(time.Second * 1)
// gen.Stop()
}
func readRes(resChan chan *model.LDResult) {
for res := range resChan {
fmt.Println(res.ID, ":", res)
}
}