From 402a8f55342c4565431c2a2e7287a70592f3fe33 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 12:51:27 +0200 Subject: style: Eliminate use of wildcard imports This change updates the repository to remove the use of wildcard imports everywhere. Wildcard imports are not allowed by default by Ktlint as well as Google's Java style guide. --- .../opendc/simulator/compute/SimMachineBenchmarks.kt | 8 +++++++- .../org/opendc/simulator/compute/SimAbstractMachine.kt | 8 +++++++- .../org/opendc/simulator/compute/SimBareMetalMachine.kt | 3 ++- .../org/opendc/simulator/compute/device/SimPsu.kt | 2 +- .../opendc/simulator/compute/kernel/SimHypervisor.kt | 9 +++++++-- .../compute/kernel/interference/VmInterferenceMember.kt | 2 +- .../compute/kernel/interference/VmInterferenceModel.kt | 3 ++- .../opendc/simulator/compute/power/PStatePowerDriver.kt | 2 +- .../org/opendc/simulator/compute/SimMachineTest.kt | 17 ++++++++++++++--- .../compute/kernel/SimFairShareHypervisorTest.kt | 6 ++++-- .../compute/kernel/SimSpaceSharedHypervisorTest.kt | 14 +++++++++++--- .../simulator/compute/workload/SimTraceWorkloadTest.kt | 5 ++++- .../org/opendc/simulator/kotlin/SimulationBuilders.kt | 5 ++++- .../simulator/kotlin/SimulationCoroutineDispatcher.kt | 8 ++++++-- .../test/kotlin/org/opendc/simulator/TaskQueueTest.kt | 5 ++++- .../kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt | 10 +++++++--- .../simulator/flow/internal/FlowConsumerContextImpl.kt | 7 +++++-- .../org/opendc/simulator/flow/internal/FlowDeque.kt | 2 +- .../opendc/simulator/flow/internal/FlowEngineImpl.kt | 7 +++++-- .../simulator/flow/mux/ForwardingFlowMultiplexer.kt | 8 +++++++- .../opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt | 9 ++++++++- .../opendc/simulator/flow/FlowConsumerContextTest.kt | 7 +++++-- .../org/opendc/simulator/flow/FlowForwarderTest.kt | 14 +++++++++++--- .../kotlin/org/opendc/simulator/flow/FlowSinkTest.kt | 8 ++++++-- .../simulator/flow/mux/ForwardingFlowMultiplexerTest.kt | 6 +++++- .../simulator/flow/mux/MaxMinFlowMultiplexerTest.kt | 3 ++- .../org/opendc/simulator/network/SimNetworkSink.kt | 6 +++++- .../opendc/simulator/network/SimNetworkSwitchVirtual.kt | 4 +++- .../org/opendc/simulator/network/SimNetworkLinkTest.kt | 4 +++- .../org/opendc/simulator/network/SimNetworkSinkTest.kt | 10 ++++++++-- .../simulator/network/SimNetworkSwitchVirtualTest.kt | 5 ++++- .../main/kotlin/org/opendc/simulator/power/SimPdu.kt | 5 ++++- .../main/kotlin/org/opendc/simulator/power/SimUps.kt | 5 ++++- .../org/opendc/simulator/power/SimPowerSourceTest.kt | 5 ++++- 34 files changed, 172 insertions(+), 50 deletions(-) (limited to 'opendc-simulator') diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt index b319a677..651c3b63 100644 --- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt @@ -36,7 +36,13 @@ import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import java.util.SplittableRandom import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.TimeUnit diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt index ef0cd323..71784567 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimAbstractMachine.kt @@ -30,7 +30,13 @@ import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.NetworkAdapter import org.opendc.simulator.compute.model.StorageDevice import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.batch /** * Abstract implementation of the [SimMachine] interface. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt index 0df897b6..ee56c8c8 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt @@ -26,8 +26,9 @@ import org.opendc.simulator.compute.device.SimPsu import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.PowerDriver -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink import kotlin.math.max /** diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt index caff4dc3..243790b9 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt @@ -26,7 +26,7 @@ import org.opendc.simulator.compute.power.PowerDriver import org.opendc.simulator.flow.FlowConnection import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.power.SimPowerInlet -import java.util.* +import java.util.TreeMap /** * A power supply of a [SimBareMetalMachine]. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt index 7594bf4d..20d946a4 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.compute.kernel -import org.opendc.simulator.compute.* +import org.opendc.simulator.compute.SimAbstractMachine +import org.opendc.simulator.compute.SimMachine +import org.opendc.simulator.compute.SimMachineContext +import org.opendc.simulator.compute.SimProcessingUnit import org.opendc.simulator.compute.kernel.cpufreq.ScalingGovernor import org.opendc.simulator.compute.kernel.cpufreq.ScalingPolicy import org.opendc.simulator.compute.kernel.interference.VmInterferenceDomain @@ -31,7 +34,9 @@ import org.opendc.simulator.compute.kernel.interference.VmInterferenceProfile import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.workload.SimWorkload -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexer import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import java.util.SplittableRandom diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt index 762bb568..4b56a058 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceMember.kt @@ -22,7 +22,7 @@ package org.opendc.simulator.compute.kernel.interference -import java.util.* +import java.util.SplittableRandom /** * A participant of an interference domain. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt index 018c6e3d..36fad4c3 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt @@ -22,7 +22,8 @@ package org.opendc.simulator.compute.kernel.interference -import java.util.* +import java.util.TreeMap +import java.util.TreeSet /** * An interference model that models the resource interference between virtual machines on a host. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt index f71446f8..ce7225d2 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/PStatePowerDriver.kt @@ -24,7 +24,7 @@ package org.opendc.simulator.compute.power import org.opendc.simulator.compute.SimMachine import org.opendc.simulator.compute.SimProcessingUnit -import java.util.* +import java.util.TreeMap import kotlin.math.max import kotlin.math.min diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt index b7af6803..1eddf82c 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/SimMachineTest.kt @@ -22,11 +22,22 @@ package org.opendc.simulator.compute -import kotlinx.coroutines.* -import org.junit.jupiter.api.* +import kotlinx.coroutines.CancellationException +import kotlinx.coroutines.cancel +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import org.junit.jupiter.api.Assertions.assertAll import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.compute.device.SimNetworkAdapter -import org.opendc.simulator.compute.model.* +import org.opendc.simulator.compute.model.MachineModel +import org.opendc.simulator.compute.model.MemoryUnit +import org.opendc.simulator.compute.model.NetworkAdapter +import org.opendc.simulator.compute.model.ProcessingNode +import org.opendc.simulator.compute.model.ProcessingUnit +import org.opendc.simulator.compute.model.StorageDevice import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.LinearPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt index aae8d139..9ff492cc 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt @@ -22,7 +22,9 @@ package org.opendc.simulator.compute.kernel -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test @@ -44,7 +46,7 @@ import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.SplittableRandom /** * Test suite for the [SimHypervisor] class. diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt index 664bb2da..7a8da325 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt @@ -24,7 +24,11 @@ package org.opendc.simulator.compute.kernel import kotlinx.coroutines.launch import kotlinx.coroutines.yield -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertDoesNotThrow +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows @@ -36,11 +40,15 @@ import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.compute.runWorkload -import org.opendc.simulator.compute.workload.* +import org.opendc.simulator.compute.workload.SimFlopsWorkload +import org.opendc.simulator.compute.workload.SimRuntimeWorkload +import org.opendc.simulator.compute.workload.SimTrace +import org.opendc.simulator.compute.workload.SimTraceFragment +import org.opendc.simulator.compute.workload.SimTraceWorkload import org.opendc.simulator.flow.FlowEngine import org.opendc.simulator.flow.mux.FlowMultiplexerFactory import org.opendc.simulator.kotlin.runSimulation -import java.util.* +import java.util.SplittableRandom /** * A test suite for a space-shared [SimHypervisor]. diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt index 70aea3f4..83e1f81c 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/workload/SimTraceWorkloadTest.kt @@ -27,7 +27,10 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.opendc.simulator.compute.SimBareMetalMachine -import org.opendc.simulator.compute.model.* +import org.opendc.simulator.compute.model.MachineModel +import org.opendc.simulator.compute.model.MemoryUnit +import org.opendc.simulator.compute.model.ProcessingNode +import org.opendc.simulator.compute.model.ProcessingUnit import org.opendc.simulator.compute.power.ConstantPowerModel import org.opendc.simulator.compute.power.SimplePowerDriver import org.opendc.simulator.compute.runWorkload diff --git a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt index c4cc0171..882a0fc5 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt +++ b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationBuilders.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.kotlin -import kotlinx.coroutines.* +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.Job +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.async import org.opendc.simulator.SimulationScheduler import kotlin.coroutines.ContinuationInterceptor import kotlin.coroutines.CoroutineContext diff --git a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt index 21ad1a86..cacbbbf7 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt +++ b/opendc-simulator/opendc-simulator-core/src/main/kotlin/org/opendc/simulator/kotlin/SimulationCoroutineDispatcher.kt @@ -22,11 +22,15 @@ package org.opendc.simulator.kotlin -import kotlinx.coroutines.* +import kotlinx.coroutines.CancellableContinuation +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Delay +import kotlinx.coroutines.DisposableHandle +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.InternalCoroutinesApi import org.opendc.simulator.SimulationScheduler import java.lang.Runnable import java.time.Clock -import java.util.* import kotlin.coroutines.CoroutineContext /** diff --git a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt index a4d779cb..f1559ce3 100644 --- a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt +++ b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt @@ -22,7 +22,10 @@ package org.opendc.simulator -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test diff --git a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt index 86fbe8e4..58f84d82 100644 --- a/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-flow/src/jmh/kotlin/org/opendc/simulator/flow/FlowBenchmarks.kt @@ -22,13 +22,18 @@ package org.opendc.simulator.flow -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch import org.opendc.simulator.flow.mux.ForwardingFlowMultiplexer import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer import org.opendc.simulator.flow.source.TraceFlowSource import org.opendc.simulator.kotlin.runSimulation -import org.openjdk.jmh.annotations.* +import org.openjdk.jmh.annotations.Benchmark +import org.openjdk.jmh.annotations.Fork +import org.openjdk.jmh.annotations.Measurement +import org.openjdk.jmh.annotations.Scope +import org.openjdk.jmh.annotations.Setup +import org.openjdk.jmh.annotations.State +import org.openjdk.jmh.annotations.Warmup import java.util.concurrent.ThreadLocalRandom import java.util.concurrent.TimeUnit @@ -36,7 +41,6 @@ import java.util.concurrent.TimeUnit @Fork(1) @Warmup(iterations = 2, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 5, time = 3, timeUnit = TimeUnit.SECONDS) -@OptIn(ExperimentalCoroutinesApi::class) class FlowBenchmarks { private lateinit var trace: Sequence diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index bc6bae71..393a2635 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -23,8 +23,11 @@ package org.opendc.simulator.flow.internal import mu.KotlinLogging -import org.opendc.simulator.flow.* -import java.util.* +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.batch +import java.util.ArrayDeque import kotlin.math.min /** diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt index 94232954..403a9aec 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowDeque.kt @@ -22,7 +22,7 @@ package org.opendc.simulator.flow.internal -import java.util.* +import java.util.ArrayDeque /** * A specialized [ArrayDeque] that tracks the [FlowConsumerContextImpl] instances that have updated in an interpreter diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt index 3c79d54e..6fd1ef31 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowEngineImpl.kt @@ -26,9 +26,12 @@ import kotlinx.coroutines.Delay import kotlinx.coroutines.DisposableHandle import kotlinx.coroutines.InternalCoroutinesApi import kotlinx.coroutines.Runnable -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import java.time.Clock -import java.util.* +import java.util.ArrayDeque import kotlin.coroutines.ContinuationInterceptor import kotlin.coroutines.CoroutineContext diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt index c50e9bbc..53f94a94 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexer.kt @@ -22,7 +22,13 @@ package org.opendc.simulator.flow.mux -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowCounters +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSource import java.util.ArrayDeque /** diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt index f2a4c1a4..a52a5b0e 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt @@ -22,7 +22,14 @@ package org.opendc.simulator.flow.mux -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowConsumerContext +import org.opendc.simulator.flow.FlowConsumerLogic +import org.opendc.simulator.flow.FlowConvergenceListener +import org.opendc.simulator.flow.FlowCounters +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.internal.D_MS_TO_S import org.opendc.simulator.flow.internal.MutableFlowCounters import kotlin.math.min diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt index d782d036..f89133dd 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowConsumerContextTest.kt @@ -22,8 +22,11 @@ package org.opendc.simulator.flow -import io.mockk.* -import org.junit.jupiter.api.* +import io.mockk.spyk +import io.mockk.verify +import net.bytebuddy.matcher.ElementMatchers.any +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.internal.FlowConsumerContextImpl import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt index 2025dd52..f75e5037 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowForwarderTest.kt @@ -22,9 +22,17 @@ package org.opendc.simulator.flow -import io.mockk.* -import kotlinx.coroutines.* -import org.junit.jupiter.api.Assertions.* +import io.mockk.spyk +import io.mockk.verify +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield +import net.bytebuddy.matcher.ElementMatchers.any +import org.junit.jupiter.api.Assertions.assertAll +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt index 22a84edb..746d752d 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/FlowSinkTest.kt @@ -24,9 +24,13 @@ package org.opendc.simulator.flow import io.mockk.spyk import io.mockk.verify -import kotlinx.coroutines.* -import org.junit.jupiter.api.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.yield import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.flow.source.FlowSourceRateAdapter diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt index cfd2bdf0..1a71580b 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt @@ -27,7 +27,11 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource +import org.opendc.simulator.flow.consume import org.opendc.simulator.flow.internal.FlowEngineImpl import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.flow.source.FlowSourceRateAdapter diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt index 4e242292..34198f17 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt @@ -25,8 +25,9 @@ package org.opendc.simulator.flow.mux import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch import kotlinx.coroutines.yield -import org.junit.jupiter.api.* +import org.junit.jupiter.api.Assertions.assertAll import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test import org.opendc.simulator.flow.FlowSink import org.opendc.simulator.flow.consume import org.opendc.simulator.flow.internal.FlowEngineImpl diff --git a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt index 675ac1c3..684b4a14 100644 --- a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt +++ b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSink.kt @@ -22,7 +22,11 @@ package org.opendc.simulator.network -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConnection +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource /** * A network sink which discards all received traffic and does not generate any traffic itself. diff --git a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt index 6667c80c..c59c44f1 100644 --- a/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt +++ b/opendc-simulator/opendc-simulator-network/src/main/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtual.kt @@ -22,7 +22,9 @@ package org.opendc.simulator.network -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer /** diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt index 3480c9df..9863507d 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkLinkTest.kt @@ -23,7 +23,9 @@ package org.opendc.simulator.network import io.mockk.mockk -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt index 944c4d6a..78bd533d 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSinkTest.kt @@ -26,11 +26,17 @@ import io.mockk.every import io.mockk.mockk import io.mockk.spyk import io.mockk.verify -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt index ff6cb66e..ecf80818 100644 --- a/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt +++ b/opendc-simulator/opendc-simulator-network/src/test/kotlin/org/opendc/simulator/network/SimNetworkSwitchVirtualTest.kt @@ -27,7 +27,10 @@ import io.mockk.verify import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowSink +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.source.FixedFlowSource import org.opendc.simulator.kotlin.runSimulation diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt index 9f88fecc..69ac97ab 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.power -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowConsumer +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowMapper +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.FlowMultiplexer import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt index 46d659f8..00b2926e 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt @@ -22,7 +22,10 @@ package org.opendc.simulator.power -import org.opendc.simulator.flow.* +import org.opendc.simulator.flow.FlowEngine +import org.opendc.simulator.flow.FlowForwarder +import org.opendc.simulator.flow.FlowMapper +import org.opendc.simulator.flow.FlowSource import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer /** diff --git a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt index b83b6ba7..963ba710 100644 --- a/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt +++ b/opendc-simulator/opendc-simulator-power/src/test/kotlin/org/opendc/simulator/power/SimPowerSourceTest.kt @@ -26,7 +26,10 @@ import io.mockk.every import io.mockk.mockk import io.mockk.spyk import io.mockk.verify -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.assertThrows -- cgit v1.2.3 From 47357afd16f928260db34d4dd3e686fb9ee7c5ff Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 6 Oct 2022 13:13:10 +0200 Subject: build: Switch to Spotless for formatting This change updates the build configuration to use Spotless for code formating of both Kotlin and Java. --- .../opendc/simulator/compute/SimMachineBenchmarks.kt | 4 +++- .../opendc/simulator/compute/SimBareMetalMachine.kt | 2 +- .../org/opendc/simulator/compute/device/SimPsu.kt | 2 +- .../opendc/simulator/compute/kernel/SimHypervisor.kt | 1 + .../kernel/interference/VmInterferenceModel.kt | 5 +++-- .../simulator/compute/power/AsymptoticPowerModel.kt | 7 ++++--- .../compute/power/InterpolationPowerModel.kt | 5 +++-- .../opendc/simulator/compute/power/MsePowerModel.kt | 2 +- .../compute/power/ZeroIdlePowerDecorator.kt | 5 +++-- .../opendc/simulator/compute/workload/SimTrace.kt | 2 +- .../opendc/simulator/compute/device/SimPsuTest.kt | 2 +- .../compute/kernel/SimFairShareHypervisorTest.kt | 6 +++--- .../compute/kernel/SimSpaceSharedHypervisorTest.kt | 2 +- .../simulator/compute/power/PStatePowerDriverTest.kt | 8 ++++---- .../opendc/simulator/compute/power/PowerModelTest.kt | 4 ++-- .../org/opendc/simulator/SimulationScheduler.java | 5 +++-- .../main/java/org/opendc/simulator/TaskQueue.java | 10 ++++++---- .../kotlin/org/opendc/simulator/TaskQueueTest.kt | 16 ++++++++-------- .../org/opendc/simulator/flow/FlowForwarder.kt | 5 +++-- .../flow/internal/FlowConsumerContextImpl.kt | 20 ++++++++++++-------- .../simulator/flow/mux/MaxMinFlowMultiplexer.kt | 8 ++++---- .../flow/mux/ForwardingFlowMultiplexerTest.kt | 2 +- .../simulator/flow/mux/MaxMinFlowMultiplexerTest.kt | 4 ++-- .../main/kotlin/org/opendc/simulator/power/SimPdu.kt | 2 +- .../main/kotlin/org/opendc/simulator/power/SimUps.kt | 2 +- 25 files changed, 73 insertions(+), 58 deletions(-) (limited to 'opendc-simulator') diff --git a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt index 651c3b63..220b97cc 100644 --- a/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt +++ b/opendc-simulator/opendc-simulator-compute/src/jmh/kotlin/org/opendc/simulator/compute/SimMachineBenchmarks.kt @@ -79,7 +79,9 @@ class SimMachineBenchmarks { return runSimulation { val engine = FlowEngine(coroutineContext, clock) val machine = SimBareMetalMachine( - engine, machineModel, SimplePowerDriver(ConstantPowerModel(0.0)) + engine, + machineModel, + SimplePowerDriver(ConstantPowerModel(0.0)) ) return@runSimulation machine.runWorkload(SimTraceWorkload(trace)) } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt index ee56c8c8..4c824440 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/SimBareMetalMachine.kt @@ -46,7 +46,7 @@ public class SimBareMetalMachine( engine: FlowEngine, model: MachineModel, powerDriver: PowerDriver, - public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0)), + public val psu: SimPsu = SimPsu(500.0, mapOf(1.0 to 1.0)) ) : SimAbstractMachine(engine, model) { /** * The current power usage of the machine (without PSU loss) in W. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt index 243790b9..3d3703ae 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/device/SimPsu.kt @@ -36,7 +36,7 @@ import java.util.TreeMap */ public class SimPsu( private val ratedOutputPower: Double, - energyEfficiency: Map, + energyEfficiency: Map ) : SimPowerInlet() { /** * The power draw of the machine at this instant. diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt index 20d946a4..e1486d71 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/SimHypervisor.kt @@ -211,6 +211,7 @@ public class SimHypervisor( */ override val counters: SimHypervisorCounters get() = _counters + @JvmField val _counters = VmCountersImpl(cpus, null) /** diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt index 36fad4c3..238bffc0 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/kernel/interference/VmInterferenceModel.kt @@ -129,10 +129,11 @@ public class VmInterferenceModel private constructor( } cmp = scores[l].compareTo(scores[r]) // Higher penalty first (this means lower performance score first) - if (cmp != 0) + if (cmp != 0) { cmp - else + } else { l.compareTo(r) + } } ) diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt index 62b85e12..46c397fe 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/AsymptoticPowerModel.kt @@ -39,15 +39,16 @@ public class AsymptoticPowerModel( private val maxPower: Double, private val idlePower: Double, private val asymUtil: Double, - private val isDvfsEnabled: Boolean, + private val isDvfsEnabled: Boolean ) : PowerModel { private val factor: Double = (maxPower - idlePower) / 100 public override fun computePower(utilization: Double): Double = - if (isDvfsEnabled) + if (isDvfsEnabled) { idlePower + (factor * 100) / 2 * (1 + utilization.pow(3) - E.pow(-utilization.pow(3) / asymUtil)) - else + } else { idlePower + (factor * 100) / 2 * (1 + utilization - E.pow(-utilization / asymUtil)) + } override fun toString(): String = "AsymptoticPowerModel[max=$maxPower,idle=$idlePower,asymptotic=$asymUtil]" } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt index 2694700c..b17b87a9 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/InterpolationPowerModel.kt @@ -44,10 +44,11 @@ public class InterpolationPowerModel(private val powerValues: List) : Po val powerCil: Double = getAveragePowerValue(utilizationCil) val delta = (powerCil - powerFlr) / 10 - return if (utilization % 0.1 == 0.0) + return if (utilization % 0.1 == 0.0) { getAveragePowerValue((clampedUtilization * 10).toInt()) - else + } else { powerFlr + delta * (clampedUtilization - utilizationFlr.toDouble() / 10) * 100 + } } override fun toString(): String = "InterpolationPowerModel[entries=${powerValues.size}]" diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt index 612ce2fc..e9e72da8 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/MsePowerModel.kt @@ -37,7 +37,7 @@ import kotlin.math.pow public class MsePowerModel( private val maxPower: Double, private val idlePower: Double, - private val calibrationParam: Double, + private val calibrationParam: Double ) : PowerModel { private val factor: Double = (maxPower - idlePower) / 100 diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt index 886227e1..05ab4631 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/power/ZeroIdlePowerDecorator.kt @@ -29,10 +29,11 @@ package org.opendc.simulator.compute.power */ public class ZeroIdlePowerDecorator(private val delegate: PowerModel) : PowerModel { override fun computePower(utilization: Double): Double { - return if (utilization == 0.0) + return if (utilization == 0.0) { 0.0 - else + } else { delegate.computePower(utilization) + } } override fun toString(): String = "ZeroIdlePowerDecorator[delegate=$delegate]" diff --git a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt index e66227b5..db6a4629 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt +++ b/opendc-simulator/opendc-simulator-compute/src/main/kotlin/org/opendc/simulator/compute/workload/SimTrace.kt @@ -39,7 +39,7 @@ public class SimTrace( private val usageCol: DoubleArray, private val deadlineCol: LongArray, private val coresCol: IntArray, - private val size: Int, + private val size: Int ) { init { require(size >= 0) { "Invalid trace size" } diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt index 5481cad2..0a6cb29f 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/device/SimPsuTest.kt @@ -75,7 +75,7 @@ internal class SimPsuTest { val energyEfficiency = sortedMapOf( 0.3 to 0.9, 0.7 to 0.92, - 1.0 to 0.94, + 1.0 to 0.94 ) val engine = FlowEngine(coroutineContext, clock) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt index 9ff492cc..6b498119 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimFairShareHypervisorTest.kt @@ -76,7 +76,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val engine = FlowEngine(coroutineContext, clock) @@ -116,7 +116,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val workloadB = SimTraceWorkload( @@ -206,7 +206,7 @@ internal class SimFairShareHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 28.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val workloadB = SimTraceWorkload( diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt index 7a8da325..57fe3766 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/kernel/SimSpaceSharedHypervisorTest.kt @@ -78,7 +78,7 @@ internal class SimSpaceSharedHypervisorTest { SimTraceFragment(duration * 1000, duration * 1000, 3500.0, 1), SimTraceFragment(duration * 2000, duration * 1000, 0.0, 1), SimTraceFragment(duration * 3000, duration * 1000, 183.0, 1) - ), + ) ) val engine = FlowEngine(coroutineContext, clock) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt index f557c8d3..3c0a55a6 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PStatePowerDriverTest.kt @@ -41,7 +41,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -61,7 +61,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -86,7 +86,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to ConstantPowerModel(200.0), 3300.0 to ConstantPowerModel(300.0), - 3600.0 to ConstantPowerModel(350.0), + 3600.0 to ConstantPowerModel(350.0) ) ) @@ -106,7 +106,7 @@ internal class PStatePowerDriverTest { sortedMapOf( 2800.0 to LinearPowerModel(200.0, 100.0), 3300.0 to LinearPowerModel(250.0, 150.0), - 4000.0 to LinearPowerModel(300.0, 200.0), + 4000.0 to LinearPowerModel(300.0, 200.0) ) ) diff --git a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt index 7852534a..67532d5b 100644 --- a/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt +++ b/opendc-simulator/opendc-simulator-compute/src/test/kotlin/org/opendc/simulator/compute/power/PowerModelTest.kt @@ -72,7 +72,7 @@ internal class PowerModelTest { { assertEquals(189.0, powerModel.computePower(0.8)) }, { assertEquals(189.0 + 0.7 * 10 * (205 - 189) / 10, powerModel.computePower(0.87)) }, { assertEquals(205.0, powerModel.computePower(0.9)) }, - { assertEquals(222.0, powerModel.computePower(1.0)) }, + { assertEquals(222.0, powerModel.computePower(1.0)) } ) } @@ -87,7 +87,7 @@ internal class PowerModelTest { Arguments.of(SqrtPowerModel(350.0, 200.0), 342.302), Arguments.of(MsePowerModel(350.0, 200.0, 1.4), 340.571), Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, false), 338.765), - Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072), + Arguments.of(AsymptoticPowerModel(350.0, 200.0, 0.3, true), 323.072) ) } } diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java index a70c1cda..305bdf5e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/SimulationScheduler.java @@ -67,7 +67,7 @@ public final class SimulationScheduler implements Executor { * @param initialTimeMs The initial virtual time of the scheduler in milliseconds since epoch. */ public SimulationScheduler(long initialTimeMs) { - this.currentTime = initialTimeMs; + this.currentTime = initialTimeMs; } /** @@ -104,7 +104,8 @@ public final class SimulationScheduler implements Executor { */ public int schedule(long delayMs, Runnable task) { if (delayMs < 0) { - throw new IllegalArgumentException("Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); + throw new IllegalArgumentException( + "Attempted scheduling an event earlier in time (delay " + delayMs + " ms)"); } long target = currentTime + delayMs; diff --git a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java index 7d867b5d..f677e74e 100644 --- a/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java +++ b/opendc-simulator/opendc-simulator-core/src/main/java/org/opendc/simulator/TaskQueue.java @@ -193,7 +193,8 @@ final class TaskQueue { /** * Sift up an entry in the heap. */ - private static void siftUp(long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { + private static void siftUp( + long[] deadlines, int[] ids, Runnable[] tasks, int k, long deadline, int id, Runnable task) { while (k > 0) { int parent = (k - 1) >>> 1; long parentDeadline = deadlines[parent]; @@ -218,11 +219,12 @@ final class TaskQueue { /** * Sift down an entry in the heap. */ - private static void siftDown(long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { - int half = n >>> 1; // loop while a non-leaf + private static void siftDown( + long[] deadlines, int[] ids, Runnable[] tasks, int k, int n, long deadline, int id, Runnable task) { + int half = n >>> 1; // loop while a non-leaf while (k < half) { - int child = (k << 1) + 1; // assume left child is least + int child = (k << 1) + 1; // assume left child is least long childDeadline = deadlines[child]; int childId = ids[child]; diff --git a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt index f1559ce3..56dd83aa 100644 --- a/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt +++ b/opendc-simulator/opendc-simulator-core/src/test/kotlin/org/opendc/simulator/TaskQueueTest.kt @@ -47,7 +47,7 @@ class TaskQueueTest { fun testPollEmpty() { assertAll( { assertEquals(Long.MAX_VALUE, queue.peekDeadline()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -63,7 +63,7 @@ class TaskQueueTest { assertAll( { assertEquals(100, queue.peekDeadline()) }, { assertEquals(entry, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -86,7 +86,7 @@ class TaskQueueTest { { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -109,7 +109,7 @@ class TaskQueueTest { { assertEquals(entryA, queue.poll()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -136,7 +136,7 @@ class TaskQueueTest { { assertEquals(entryD, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -160,7 +160,7 @@ class TaskQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryC, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -184,7 +184,7 @@ class TaskQueueTest { { assertEquals(58, queue.peekDeadline()) }, { assertEquals(entryC, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } @@ -208,7 +208,7 @@ class TaskQueueTest { { assertEquals(20, queue.peekDeadline()) }, { assertEquals(entryB, queue.poll()) }, { assertEquals(entryA, queue.poll()) }, - { assertNull(queue.poll()) }, + { assertNull(queue.poll()) } ) } diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt index 6fa2971a..5202c252 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/FlowForwarder.kt @@ -226,10 +226,11 @@ public class FlowForwarder( * Reset the delegate. */ private fun reset() { - if (isCoupled) + if (isCoupled) { _innerCtx?.close() - else + } else { _innerCtx?.push(0.0) + } delegate = null hasDelegateStarted = false diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index 393a2635..fba3af5f 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -87,19 +87,21 @@ internal class FlowConsumerContextImpl( get() = _flags and ConnConvergeSource == ConnConvergeSource set(value) { _flags = - if (value) + if (value) { _flags or ConnConvergeSource - else + } else { _flags and ConnConvergeSource.inv() + } } override var shouldConsumerConverge: Boolean get() = _flags and ConnConvergeConsumer == ConnConvergeConsumer set(value) { _flags = - if (value) + if (value) { _flags or ConnConvergeConsumer - else + } else { _flags and ConnConvergeConsumer.inv() + } } /** @@ -109,10 +111,11 @@ internal class FlowConsumerContextImpl( get() = _flags and ConnDisableTimers != ConnDisableTimers set(value) { _flags = - if (!value) + if (!value) { _flags or ConnDisableTimers - else + } else { _flags and ConnDisableTimers.inv() + } } /** @@ -241,10 +244,11 @@ internal class FlowConsumerContextImpl( // IMPORTANT: Re-fetch the flags after the callback might have changed those flags = _flags - if (duration != Long.MAX_VALUE) + if (duration != Long.MAX_VALUE) { now + duration - else + } else { duration + } } else { deadline } diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt index a52a5b0e..d9c6f893 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexer.kt @@ -255,7 +255,6 @@ public class MaxMinFlowMultiplexer( * This method is invoked when one of the inputs converges. */ fun convergeInput(input: Input, now: Long) { - val lastConverge = _lastConverge val lastConvergeInput = _lastConvergeInput val parent = parent @@ -518,7 +517,7 @@ public class MaxMinFlowMultiplexer( private val engine: FlowEngine, private val scheduler: Scheduler, @JvmField val isCoupled: Boolean, - initialCapacity: Double, + initialCapacity: Double ) : FlowConsumer, FlowConsumerLogic, Comparable { /** * A flag to indicate that the consumer is active. @@ -787,10 +786,11 @@ public class MaxMinFlowMultiplexer( return if (_isActivationOutput) { // If this output is the activation output, synchronously run the scheduler and return the new deadline val deadline = scheduler.runScheduler(now) - if (deadline == Long.MAX_VALUE) + if (deadline == Long.MAX_VALUE) { deadline - else + } else { deadline - now + } } else { // Output is not the activation output, so trigger activation output and do not install timer for this // output (by returning `Long.MAX_VALUE`) diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt index 1a71580b..2409e174 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/ForwardingFlowMultiplexerTest.kt @@ -59,7 +59,7 @@ internal class ForwardingFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val switch = ForwardingFlowMultiplexer(engine) diff --git a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt index 34198f17..a6bf8ad8 100644 --- a/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt +++ b/opendc-simulator/opendc-simulator-flow/src/test/kotlin/org/opendc/simulator/flow/mux/MaxMinFlowMultiplexerTest.kt @@ -73,7 +73,7 @@ internal class MaxMinFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val switch = MaxMinFlowMultiplexer(scheduler) @@ -111,7 +111,7 @@ internal class MaxMinFlowMultiplexerTest { TraceFlowSource.Fragment(duration * 1000, 3500.0), TraceFlowSource.Fragment(duration * 1000, 0.0), TraceFlowSource.Fragment(duration * 1000, 183.0) - ), + ) ) val workloadB = TraceFlowSource( diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt index 69ac97ab..c4076310 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimPdu.kt @@ -39,7 +39,7 @@ import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer public class SimPdu( engine: FlowEngine, private val idlePower: Double = 0.0, - private val lossCoefficient: Double = 0.0, + private val lossCoefficient: Double = 0.0 ) : SimPowerInlet() { /** * The [FlowMultiplexer] that distributes the electricity over the PDU outlets. diff --git a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt index 00b2926e..0431d3cf 100644 --- a/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt +++ b/opendc-simulator/opendc-simulator-power/src/main/kotlin/org/opendc/simulator/power/SimUps.kt @@ -40,7 +40,7 @@ import org.opendc.simulator.flow.mux.MaxMinFlowMultiplexer public class SimUps( private val engine: FlowEngine, private val idlePower: Double = 0.0, - private val lossCoefficient: Double = 0.0, + private val lossCoefficient: Double = 0.0 ) : SimPowerOutlet() { /** * The resource aggregator used to combine the input sources. -- cgit v1.2.3