Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions gobench.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ func NewConfiguration() *Configuration {

go func() {
<-timeout
if runtime.GOOS == "windows" {
printResults(results, startTime)
os.Exit(0)
}
pid := os.Getpid()
proc, _ := os.FindProcess(pid)
err := proc.Signal(os.Interrupt)
Expand Down Expand Up @@ -294,12 +298,14 @@ func client(configuration *Configuration, result *Result, done *sync.WaitGroup)
done.Done()
}

var results map[int]*Result = make(map[int]*Result)

var startTime time.Time

func main() {

startTime := time.Now()
startTime = time.Now()
var done sync.WaitGroup
results := make(map[int]*Result)

signalChannel := make(chan os.Signal, 2)
signal.Notify(signalChannel, os.Interrupt)
go func() {
Expand Down Expand Up @@ -328,6 +334,9 @@ func main() {

}
fmt.Println("Waiting for results...")

done.Wait()
fmt.Println("wait is done")
printResults(results, startTime)
}