diff --git a/lib/executor/constant_arrival_rate.go b/lib/executor/constant_arrival_rate.go index 751b424c39d..4c1a9e0d49f 100644 --- a/lib/executor/constant_arrival_rate.go +++ b/lib/executor/constant_arrival_rate.go @@ -291,7 +291,7 @@ func (car ConstantArrivalRate) Run(parentCtx context.Context, out chan<- stats.S vusFmt := pb.GetFixedLengthIntFormat(maxVUs) progIters := fmt.Sprintf( pb.GetFixedLengthFloatFormat(arrivalRatePerSec, 0)+" iters/s", arrivalRatePerSec) - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { spent := time.Since(startTime) currActiveVUs := atomic.LoadUint64(&activeVUsCount) vusInBuffer := uint64(len(activeVUs)) @@ -310,8 +310,8 @@ func (car ConstantArrivalRate) Run(parentCtx context.Context, out chan<- stats.S return math.Min(1, float64(spent)/float64(duration)), right } - car.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, &car, progresFn) + car.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, &car, progressFn) runIterationBasic := getIterationRunner(car.executionState, car.logger) runIteration := func(vu lib.ActiveVU) { diff --git a/lib/executor/constant_vus.go b/lib/executor/constant_vus.go index be21030b285..11a1c7a5685 100644 --- a/lib/executor/constant_vus.go +++ b/lib/executor/constant_vus.go @@ -155,7 +155,7 @@ func (clv ConstantVUs) Run(parentCtx context.Context, out chan<- stats.SampleCon logrus.Fields{"vus": numVUs, "duration": duration, "type": clv.config.GetType()}, ).Debug("Starting executor run...") - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { spent := time.Since(startTime) right := []string{fmt.Sprintf("%d VUs", numVUs)} if spent > duration { @@ -166,8 +166,8 @@ func (clv ConstantVUs) Run(parentCtx context.Context, out chan<- stats.SampleCon pb.GetFixedLengthDuration(spent, duration), duration)) return float64(spent) / float64(duration), right } - clv.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, clv, progresFn) + clv.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, clv, progressFn) // Actually schedule the VUs and iterations... activeVUs := &sync.WaitGroup{} diff --git a/lib/executor/externally_controlled.go b/lib/executor/externally_controlled.go index d6e733bf035..643132ba2c4 100644 --- a/lib/executor/externally_controlled.go +++ b/lib/executor/externally_controlled.go @@ -401,7 +401,7 @@ func (rs *externallyControlledRunState) retrieveStartMaxVUs() error { return nil } -func (rs *externallyControlledRunState) progresFn() (float64, []string) { +func (rs *externallyControlledRunState) progressFn() (float64, []string) { // TODO: simulate spinner for the other case or cycle 0-100? currentActiveVUs := atomic.LoadInt64(rs.activeVUsCount) currentMaxVUs := atomic.LoadInt64(rs.maxVUs) @@ -536,8 +536,8 @@ func (mex *ExternallyControlled) Run(parentCtx context.Context, out chan<- stats return err } - mex.progress.Modify(pb.WithProgress(runState.progresFn)) // Keep track of the progress - go trackProgress(parentCtx, ctx, ctx, mex, runState.progresFn) + mex.progress.Modify(pb.WithProgress(runState.progressFn)) // Keep track of the progress + go trackProgress(parentCtx, ctx, ctx, mex, runState.progressFn) err = runState.handleConfigChange( // Start by setting MaxVUs to the starting MaxVUs ExternallyControlledConfigParams{MaxVUs: mex.config.MaxVUs}, currentControlConfig, diff --git a/lib/executor/per_vu_iterations.go b/lib/executor/per_vu_iterations.go index 15419fad6b6..302ded8799d 100644 --- a/lib/executor/per_vu_iterations.go +++ b/lib/executor/per_vu_iterations.go @@ -171,7 +171,7 @@ func (pvi PerVUIterations) Run(parentCtx context.Context, out chan<- stats.Sampl vusFmt := pb.GetFixedLengthIntFormat(numVUs) itersFmt := pb.GetFixedLengthIntFormat(int64(totalIters)) - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { spent := time.Since(startTime) progVUs := fmt.Sprintf(vusFmt+" VUs", numVUs) currentDoneIters := atomic.LoadUint64(doneIters) @@ -188,8 +188,8 @@ func (pvi PerVUIterations) Run(parentCtx context.Context, out chan<- stats.Sampl return float64(currentDoneIters) / float64(totalIters), right } - pvi.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, pvi, progresFn) + pvi.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, pvi, progressFn) // Actually schedule the VUs and iterations... activeVUs := &sync.WaitGroup{} diff --git a/lib/executor/ramping_arrival_rate.go b/lib/executor/ramping_arrival_rate.go index 98503ce944e..d996dc51161 100644 --- a/lib/executor/ramping_arrival_rate.go +++ b/lib/executor/ramping_arrival_rate.go @@ -378,7 +378,7 @@ func (varr RampingArrivalRate) Run(parentCtx context.Context, out chan<- stats.S vusFmt := pb.GetFixedLengthIntFormat(maxVUs) itersFmt := pb.GetFixedLengthFloatFormat(maxArrivalRatePerSec, 0) + " iters/s" - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { currActiveVUs := atomic.LoadUint64(&activeVUsCount) currentTickerPeriod := atomic.LoadInt64(&tickerPeriod) vusInBuffer := uint64(len(activeVUs)) @@ -405,8 +405,8 @@ func (varr RampingArrivalRate) Run(parentCtx context.Context, out chan<- stats.S return math.Min(1, float64(spent)/float64(duration)), right } - varr.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, varr, progresFn) + varr.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, varr, progressFn) regDurationDone := regDurationCtx.Done() runIterationBasic := getIterationRunner(varr.executionState, varr.logger) diff --git a/lib/executor/ramping_vus.go b/lib/executor/ramping_vus.go index 50a85380ed4..08d4a2e1bd7 100644 --- a/lib/executor/ramping_vus.go +++ b/lib/executor/ramping_vus.go @@ -564,7 +564,7 @@ func (vlv RampingVUs) Run(parentCtx context.Context, out chan<- stats.SampleCont activeVUsCount := new(int64) vusFmt := pb.GetFixedLengthIntFormat(int64(maxVUs)) regularDurationStr := pb.GetFixedLengthDuration(regularDuration, regularDuration) - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { spent := time.Since(startTime) currentlyActiveVUs := atomic.LoadInt64(activeVUsCount) vus := fmt.Sprintf(vusFmt+"/"+vusFmt+" VUs", currentlyActiveVUs, maxVUs) @@ -575,8 +575,8 @@ func (vlv RampingVUs) Run(parentCtx context.Context, out chan<- stats.SampleCont progDur := pb.GetFixedLengthDuration(spent, regularDuration) + "/" + regularDurationStr return float64(spent) / float64(regularDuration), []string{progVUs, progDur} } - vlv.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, vlv, progresFn) + vlv.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, vlv, progressFn) // Actually schedule the VUs and iterations, likely the most complicated // executor among all of them... diff --git a/lib/executor/shared_iterations.go b/lib/executor/shared_iterations.go index 10cfa164861..9367a25c9c3 100644 --- a/lib/executor/shared_iterations.go +++ b/lib/executor/shared_iterations.go @@ -200,7 +200,7 @@ func (si SharedIterations) Run(parentCtx context.Context, out chan<- stats.Sampl doneIters := new(uint64) vusFmt := pb.GetFixedLengthIntFormat(numVUs) itersFmt := pb.GetFixedLengthIntFormat(int64(totalIters)) - progresFn := func() (float64, []string) { + progressFn := func() (float64, []string) { spent := time.Since(startTime) progVUs := fmt.Sprintf(vusFmt+" VUs", numVUs) currentDoneIters := atomic.LoadUint64(doneIters) @@ -212,8 +212,8 @@ func (si SharedIterations) Run(parentCtx context.Context, out chan<- stats.Sampl return float64(currentDoneIters) / float64(totalIters), right } - si.progress.Modify(pb.WithProgress(progresFn)) - go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, &si, progresFn) + si.progress.Modify(pb.WithProgress(progressFn)) + go trackProgress(parentCtx, maxDurationCtx, regDurationCtx, &si, progressFn) var attemptedIters uint64