diff options
| author | Sacheendra Talluri <sacheendra.t@gmail.com> | 2025-04-02 17:54:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-02 17:54:53 +0200 |
| commit | 3a370ece860b0eba25cd1c7a366d767ae458192b (patch) | |
| tree | 2f02db79ffddfa24ccf0a9345ac0472f5aa00f70 /opendc-experiments/opendc-experiments-base/src/main/kotlin | |
| parent | af632099d05636af3274ee95ada6b962703a67f0 (diff) | |
Separate timeshift into an interface and add it to memorizing (#329)
* Separate timeshift into an interface and add it to memorizing
* Run spotless apply
* Remove random from memorizing sched test
* Record time on task termination
* spotless apply
Diffstat (limited to 'opendc-experiments/opendc-experiments-base/src/main/kotlin')
| -rw-r--r-- | opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/experiment/specs/allocation/AllocationPolicySpec.kt | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/experiment/specs/allocation/AllocationPolicySpec.kt b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/experiment/specs/allocation/AllocationPolicySpec.kt index 21d2f994..bc96562c 100644 --- a/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/experiment/specs/allocation/AllocationPolicySpec.kt +++ b/opendc-experiments/opendc-experiments-base/src/main/kotlin/org/opendc/experiments/base/experiment/specs/allocation/AllocationPolicySpec.kt @@ -28,6 +28,7 @@ import org.opendc.compute.simulator.scheduler.ComputeScheduler import org.opendc.compute.simulator.scheduler.ComputeSchedulerEnum import org.opendc.compute.simulator.scheduler.FilterScheduler import org.opendc.compute.simulator.scheduler.createPrefabComputeScheduler +import org.opendc.compute.simulator.scheduler.timeshift.MemorizingTimeshift import org.opendc.compute.simulator.scheduler.timeshift.TaskStopper import org.opendc.compute.simulator.scheduler.timeshift.TimeshiftScheduler import java.time.InstantSource @@ -68,6 +69,7 @@ public data class TimeShiftAllocationPolicySpec( val longForecastThreshold: Double = 0.35, val forecastSize: Int = 24, val taskStopper: TaskStopperSpec? = null, + val memorize: Boolean = true, ) : AllocationPolicySpec public fun createComputeScheduler( @@ -85,10 +87,22 @@ public fun createComputeScheduler( is TimeShiftAllocationPolicySpec -> { val filters = spec.filters.map { createHostFilter(it) } val weighers = spec.weighers.map { createHostWeigher(it) } - TimeshiftScheduler( - filters, weighers, spec.windowSize, clock, spec.subsetSize, spec.forecast, - spec.shortForecastThreshold, spec.longForecastThreshold, spec.forecastSize, seeder, - ) + if (spec.memorize) { + MemorizingTimeshift( + filters, + spec.windowSize, + clock, + spec.forecast, + spec.shortForecastThreshold, + spec.longForecastThreshold, + spec.forecastSize, + ) + } else { + TimeshiftScheduler( + filters, weighers, spec.windowSize, clock, spec.subsetSize, spec.forecast, + spec.shortForecastThreshold, spec.longForecastThreshold, spec.forecastSize, seeder, + ) + } } } } |
