feat: refactor benchmark
This commit is contained in:
parent
1697e354f4
commit
79771bebb4
|
@ -44,7 +44,7 @@ func doRequest(wg *sync.WaitGroup, host, employeeID string, errChan chan error)
|
|||
return nil
|
||||
}
|
||||
|
||||
func Benchmark() error {
|
||||
func Benchmark(totalRequests int) error {
|
||||
cr := crono.New()
|
||||
defer cr.Table()
|
||||
host := "http://127.0.0.1:45654"
|
||||
|
@ -52,7 +52,6 @@ func Benchmark() error {
|
|||
wg := &sync.WaitGroup{}
|
||||
errChan := make(chan error, 1)
|
||||
wg.Add(1)
|
||||
totalRequests := 5000
|
||||
go func(errChan chan error) {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
|
|
|
@ -7,7 +7,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
go_benchmark "gitea.urkob.com/urko/ess-etl-go/benchmark/go"
|
||||
// go_benchmark "gitea.urkob.com/urko/ess-etl-go/benchmark/go"
|
||||
nest_benchmark "gitea.urkob.com/urko/ess-etl-go/benchmark/nest"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -21,11 +22,12 @@ func main() {
|
|||
defer f.Close()
|
||||
log.SetOutput(f)
|
||||
|
||||
if err := go_benchmark.Benchmark(); err != nil {
|
||||
log.Fatalln("go_benchmark.Benchmark", err)
|
||||
}
|
||||
|
||||
// if err := nest_benchmark.Benchmark(); err != nil {
|
||||
// log.Fatalln("nest_benchmark.Benchmark", err)
|
||||
totalRequests := 5000
|
||||
// if err := go_benchmark.Benchmark(totalRequests); err != nil {
|
||||
// log.Fatalln("go_benchmark.Benchmark", err)
|
||||
// }
|
||||
|
||||
if err := nest_benchmark.Benchmark(totalRequests); err != nil {
|
||||
log.Fatalln("nest_benchmark.Benchmark", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ func doRequest(wg *sync.WaitGroup, host string, employeeID int, errChan chan err
|
|||
return nil
|
||||
}
|
||||
|
||||
func Benchmark() error {
|
||||
func Benchmark(totalRequests int) error {
|
||||
cr := crono.New()
|
||||
defer cr.Table()
|
||||
|
||||
|
@ -79,7 +79,6 @@ func Benchmark() error {
|
|||
wg := &sync.WaitGroup{}
|
||||
errChan := make(chan error, 1)
|
||||
wg.Add(1)
|
||||
totalRequests := 5000
|
||||
go func(errChan chan error) {
|
||||
defer wg.Done()
|
||||
defer func() {
|
||||
|
|
Loading…
Reference in New Issue