summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opendc-compute/opendc-compute-simulator/src/main/kotlin/org/opendc/compute/simulator/telemetry/ComputeMetricReader.kt2
-rw-r--r--opendc-compute/opendc-compute-topology/src/main/kotlin/org/opendc/compute/topology/specs/TopologySpecs.kt2
-rw-r--r--opendc-experiments/opendc-experiments-base/src/test/kotlin/org/opendc/experiments/base/ScenarioIntegrationTest.kt4
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/cpu/SimCpu.java6
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/VirtualMachine.java6
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPowerSource.java6
-rw-r--r--opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/power/SimPsu.java6
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/Multiplexer.java11
8 files changed, 10 insertions, 33 deletions
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 5dab5d7a..d5720649 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 cdc1d96a..39b95347 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 132ed7b5..bffd9624 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 ac3bff74..24627a9c 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 final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer
// 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 final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer
*/
@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 21f59cf6..0557165b 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 class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli
**/
@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 class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli
**/
@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 2c953d06..a219d4e6 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 final class SimPowerSource extends FlowNode implements FlowSupplier {
@Override
public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) {
- if (newPowerDemand == this.powerDemand) {
- return;
- }
this.powerDemand = newPowerDemand;
this.invalidate();
@@ -173,9 +170,6 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier {
@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 436c5c12..709d3e15 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 final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer
@Override
public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) {
- if (newPowerDemand == this.powerDemand) {
- return;
- }
updateCounters();
this.powerDemand = newPowerDemand;
@@ -160,9 +157,6 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer
@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 a87ded8d..25dc564f 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 class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer
this.consumerEdges.add(consumerEdge);
this.demands.add(0.0);
this.supplies.add(0.0);
+
+ this.invalidate();
}
@Override
@@ -137,6 +139,8 @@ public class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer
this.supplierEdge = supplierEdge;
this.capacity = supplierEdge.getCapacity();
this.totalSupply = 0;
+
+ this.invalidate();
}
@Override
@@ -176,15 +180,12 @@ public class Multiplexer extends FlowNode implements FlowSupplier, FlowConsumer
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