-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
49 lines (42 loc) · 811 Bytes
/
main.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
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"time"
)
const (
GBVersion = "0.1.9"
MaxExecutionTimeout = time.Duration(30) * time.Second
MaxRequests = 50000 // for timelimit
)
var (
Verbosity = 0
GoMaxProcs int
ContinueOnError bool
)
func main() {
if config, err := LoadConfig(); err != nil {
fmt.Println(err)
flag.Usage()
os.Exit(-1)
} else {
context := NewContext(config)
if err := DetectHost(context); err != nil {
log.Fatal(err)
} else {
runtime.GOMAXPROCS(GoMaxProcs)
startBenchmark(context)
}
}
}
func startBenchmark(context *Context) {
PrintHeader()
benchmark := NewBenchmark(context)
monitor := NewMonitor(context, benchmark.collector)
go monitor.Run()
go benchmark.Run()
PrintReport(context, <-monitor.output)
}