Skip to content

Commit

Permalink
Warmup duration fix
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Cvetković <[email protected]>
  • Loading branch information
cvetkovic committed Dec 6, 2024
1 parent a4c7efc commit 9b40286
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/driver/trace_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, &currentPhase)

iat := time.Duration(IAT[iatIndex]) * time.Microsecond

schedulingDelay := time.Since(startOfExperiment).Microseconds() - previousIATSum
Expand Down Expand Up @@ -236,8 +238,6 @@ func (d *Driver) functionsDriver(list *list.List, announceFunctionDone *sync.Wai

iatIndex++

d.announceWarmupEnd(startOfExperiment, &currentPhase)

// counter updates
invocationSinceTheBeginningOfMinute++
if iatIndex > minuteIndexEnd {
Expand All @@ -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.")
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/driver/trace_driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9b40286

Please sign in to comment.