diff --git a/pkg/driver/trace_driver.go b/pkg/driver/trace_driver.go index 67fc7cf2..81ce8ef6 100644 --- a/pkg/driver/trace_driver.go +++ b/pkg/driver/trace_driver.go @@ -196,6 +196,8 @@ func (d *Driver) functionsDriver(list *list.List, announceFunctionDone *sync.Wai break // end of experiment for this individual function driver } + d.announceWarmupEnd(minuteIndex, ¤tPhase) + iat := time.Duration(IAT[iatIndex]) * time.Microsecond schedulingDelay := time.Since(startOfExperiment).Microseconds() - previousIATSum @@ -236,8 +238,6 @@ func (d *Driver) functionsDriver(list *list.List, announceFunctionDone *sync.Wai iatIndex++ - d.announceWarmupEnd(startOfExperiment, ¤tPhase) - // counter updates invocationSinceTheBeginningOfMinute++ if iatIndex > minuteIndexEnd { @@ -257,8 +257,8 @@ func (d *Driver) functionsDriver(list *list.List, announceFunctionDone *sync.Wai atomic.AddInt64(totalIssued, int64(iatIndex)) } -func (d *Driver) announceWarmupEnd(start time.Time, currentPhase *common.ExperimentPhase) { - if *currentPhase == common.WarmupPhase && hasMinuteExpired(start) { +func (d *Driver) announceWarmupEnd(minuteIndex int, currentPhase *common.ExperimentPhase) { + if *currentPhase == common.WarmupPhase && minuteIndex >= d.Configuration.LoaderConfiguration.WarmupDuration { *currentPhase = common.ExecutionPhase log.Infof("Warmup phase has finished. Starting the execution phase.") } diff --git a/pkg/driver/trace_driver_test.go b/pkg/driver/trace_driver_test.go index 8d224f64..1e0195b3 100644 --- a/pkg/driver/trace_driver_test.go +++ b/pkg/driver/trace_driver_test.go @@ -392,7 +392,11 @@ func TestDriverCompletely(t *testing.T) { driver := createTestDriver(test.invocationStats) if test.withWarmup { - driver.Configuration.LoaderConfiguration.WarmupDuration = 1 + if test.traceGranularity == common.MinuteGranularity { + driver.Configuration.LoaderConfiguration.WarmupDuration = 1 + } else { + driver.Configuration.LoaderConfiguration.WarmupDuration = 60 + } } driver.Configuration.TraceDuration = test.experimentDurationMin driver.Configuration.TraceGranularity = test.traceGranularity