diff --git a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt index 5dab5d7a0..d57206492 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt +++ b/opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt @@ -98,8 +98,6 @@ public class ComputeMetricReader( loggState() } } finally { - loggState() - if (monitor is AutoCloseable) { monitor.close() } diff --git a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt index cdc1d96ab..39b95347f 100644 --- a/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt +++ b/opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt @@ -151,7 +151,7 @@ public data class PowerSourceJSONSpec( public companion object { public val DFLT: PowerSourceJSONSpec = PowerSourceJSONSpec( - totalPower = 10000, + totalPower = Long.MAX_VALUE, ) } } diff --git a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt index 132ed7b5a..bffd96245 100644 --- a/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt +++ b/opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt @@ -335,8 +335,8 @@ class ScenarioIntegrationTest { { assertEquals(0, monitor.tasksActive, "All VMs should finish after a run") }, { assertEquals(0, monitor.attemptsFailure, "No VM should be unscheduled") }, { assertEquals(0, monitor.tasksPending, "No VM should not be in the queue") }, - { assertEquals(43101787433, monitor.idleTime) { "Incorrect idle time" } }, - { assertEquals(3489412567, monitor.activeTime) { "Incorrect active time" } }, + { assertEquals(43101793092, monitor.idleTime) { "Incorrect idle time" } }, + { assertEquals(3489406908, monitor.activeTime) { "Incorrect active time" } }, { assertEquals(0, monitor.stealTime) { "Incorrect steal time" } }, { assertEquals(0, monitor.lostTime) { "Incorrect lost time" } }, { assertEquals(1.0016123392181786E10, monitor.energyUsage, 1E4) { "Incorrect energy usage" } }, diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java index ac3bff740..24627a9ce 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java @@ -124,7 +124,7 @@ public long onUpdate(long now) { // Calculate Power Demand and send to PSU // TODO: look at the double / double thing - double powerDemand = (double) this.cpuPowerModel.computePower((double) this.currentCpuUtilization); + double powerDemand = this.cpuPowerModel.computePower(this.currentCpuUtilization); if (powerDemand != this.currentPowerDemand) { this.pushDemand(this.psuEdge, powerDemand); @@ -201,10 +201,6 @@ public void pushSupply(FlowEdge consumerEdge, double newCpuSupply) { */ @Override public void handleDemand(FlowEdge consumerEdge, double newCpuDemand) { - if (newCpuDemand == this.currentCpuDemand) { - return; - } - updateCounters(); this.currentCpuDemand = newCpuDemand; this.currentCpuUtilization = this.currentCpuDemand / this.maxCapacity; diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java index 21f59cf6c..0557165bc 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java @@ -202,9 +202,6 @@ public void pushSupply(FlowEdge consumerEdge, double newSupply) { **/ @Override public void handleDemand(FlowEdge consumerEdge, double newDemand) { - if (this.cpuDemand == newDemand) { - return; - } updateCounters(this.clock.millis()); this.cpuDemand = newDemand; @@ -217,9 +214,6 @@ public void handleDemand(FlowEdge consumerEdge, double newDemand) { **/ @Override public void handleSupply(FlowEdge supplierEdge, double newCpuSupply) { - if (newCpuSupply == this.cpuSupply) { - return; - } updateCounters(this.clock.millis()); this.cpuSupply = newCpuSupply; diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java index 2c953d06d..a219d4e63 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java @@ -163,9 +163,6 @@ public void updateCounters(long now) { @Override public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { - if (newPowerDemand == this.powerDemand) { - return; - } this.powerDemand = newPowerDemand; this.invalidate(); @@ -173,9 +170,6 @@ public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { @Override public void pushSupply(FlowEdge consumerEdge, double newSupply) { - if (newSupply == this.powerSupplied) { - return; - } this.powerSupplied = newSupply; consumerEdge.pushSupply(newSupply); diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java index 436c5c120..709d3e152 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java @@ -148,9 +148,6 @@ public void pushSupply(FlowEdge consumerEdge, double newSupply) { @Override public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { - if (newPowerDemand == this.powerDemand) { - return; - } updateCounters(); this.powerDemand = newPowerDemand; @@ -160,9 +157,6 @@ public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { @Override public void handleSupply(FlowEdge supplierEdge, double newPowerSupply) { - if (newPowerSupply == this.powerSupplied) { - return; - } updateCounters(); this.powerSupplied = newPowerSupply; diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java index a87ded8d1..25dc564f8 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java +++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java @@ -130,6 +130,8 @@ public void addConsumerEdge(FlowEdge consumerEdge) { this.consumerEdges.add(consumerEdge); this.demands.add(0.0); this.supplies.add(0.0); + + this.invalidate(); } @Override @@ -137,6 +139,8 @@ public void addSupplierEdge(FlowEdge supplierEdge) { this.supplierEdge = supplierEdge; this.capacity = supplierEdge.getCapacity(); this.totalSupply = 0; + + this.invalidate(); } @Override @@ -176,15 +180,12 @@ public void handleDemand(FlowEdge consumerEdge, double newDemand) { demands.set(idx, newDemand); this.totalDemand += (newDemand - prevDemand); + this.invalidate(); } @Override public void handleSupply(FlowEdge supplierEdge, double newSupply) { - if (newSupply == this.totalSupply) { - return; - } - - this.totalSupply = newSupply; + this.invalidate(); } @Override