feat: support statistics summary for load testing

This commit is contained in:
xucong053
2022-03-16 21:42:35 +08:00
parent 7309623eb2
commit cfbad9ed09
3 changed files with 50 additions and 0 deletions
+13
View File
@@ -2,6 +2,9 @@ package boomer
import (
"math"
"os"
"os/signal"
"syscall"
"time"
"github.com/rs/zerolog/log"
@@ -95,6 +98,16 @@ func (b *Boomer) EnableMemoryProfile(memoryProfile string, duration time.Duratio
b.memoryProfileDuration = duration
}
// EnableGracefulQuit catch SIGINT and SIGTERM signals to quit gracefully
func (b *Boomer) EnableGracefulQuit() {
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)
go func() {
<-c
b.Quit()
}()
}
// Run accepts a slice of Task and connects to the locust master.
func (b *Boomer) Run(tasks ...*Task) {
if b.cpuProfile != "" {