diff options
Diffstat (limited to 'opendc-simulator/opendc-simulator-compute')
10 files changed, 116 insertions, 124 deletions
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 60c877e9..ac3bff74 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 @@ -38,17 +38,17 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer private final CpuPowerModel cpuPowerModel; - private float currentCpuDemand = 0.0f; // cpu capacity demanded by the mux - private float currentCpuUtilization = 0.0f; - private float currentPowerDemand = 0.0f; // power demanded of the psu - private float currentCpuSupplied = 0.0f; // cpu capacity supplied to the mux - private float currentPowerSupplied = 0.0f; // cpu capacity supplied by the psu + private double currentCpuDemand = 0.0f; // cpu capacity demanded by the mux + private double currentCpuUtilization = 0.0f; + private double currentPowerDemand = 0.0f; // power demanded of the psu + private double currentCpuSupplied = 0.0f; // cpu capacity supplied to the mux + private double currentPowerSupplied = 0.0f; // cpu capacity supplied by the psu - private float maxCapacity; + private double maxCapacity; private PerformanceCounters performanceCounters = new PerformanceCounters(); private long lastCounterUpdate; - private final float cpuFrequencyInv; + private final double cpuFrequencyInv; private FlowEdge muxEdge; private FlowEdge psuEdge; @@ -68,7 +68,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer } @Override - public float getCapacity() { + public double getCapacity() { return maxCapacity; } @@ -123,8 +123,8 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer updateCounters(now); // Calculate Power Demand and send to PSU - // TODO: look at the float / double thing - float powerDemand = (float) this.cpuPowerModel.computePower((double) this.currentCpuUtilization); + // TODO: look at the double / double thing + double powerDemand = (double) this.cpuPowerModel.computePower((double) this.currentCpuUtilization); if (powerDemand != this.currentPowerDemand) { this.pushDemand(this.psuEdge, powerDemand); @@ -133,7 +133,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer // Calculate the amount of cpu this can provide // TODO: This should be based on the provided power - float cpuSupply = this.currentCpuDemand; + double cpuSupply = this.currentCpuDemand; if (cpuSupply != this.currentCpuSupplied) { this.pushSupply(this.muxEdge, cpuSupply); @@ -158,11 +158,11 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer long delta = now - lastUpdate; if (delta > 0) { - float demand = this.currentCpuDemand; - float rate = this.currentCpuSupplied; - float capacity = this.maxCapacity; + double demand = this.currentCpuDemand; + double rate = this.currentCpuSupplied; + double capacity = this.maxCapacity; - final float factor = this.cpuFrequencyInv * delta; + final double factor = this.cpuFrequencyInv * delta; this.performanceCounters.addCpuActiveTime(Math.round(rate * factor)); this.performanceCounters.addCpuIdleTime(Math.round((capacity - rate) * factor)); @@ -182,7 +182,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer * Push new demand to the psu */ @Override - public void pushDemand(FlowEdge supplierEdge, float newPowerDemand) { + public void pushDemand(FlowEdge supplierEdge, double newPowerDemand) { this.psuEdge.pushDemand(newPowerDemand); } @@ -190,7 +190,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer * Push updated supply to the mux */ @Override - public void pushSupply(FlowEdge consumerEdge, float newCpuSupply) { + public void pushSupply(FlowEdge consumerEdge, double newCpuSupply) { updateCounters(); this.currentCpuSupplied = newCpuSupply; this.muxEdge.pushSupply(newCpuSupply); @@ -200,7 +200,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer * Handle new demand coming in from the mux */ @Override - public void handleDemand(FlowEdge consumerEdge, float newCpuDemand) { + public void handleDemand(FlowEdge consumerEdge, double newCpuDemand) { if (newCpuDemand == this.currentCpuDemand) { return; } @@ -216,7 +216,7 @@ public final class SimCpu extends FlowNode implements FlowSupplier, FlowConsumer * Handle updated supply from the psu */ @Override - public void handleSupply(FlowEdge supplierEdge, float newPowerSupply) { + public void handleSupply(FlowEdge supplierEdge, double newPowerSupply) { // TODO: Implement this updateCounters(); this.currentPowerSupplied = newPowerSupply; diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/PerformanceCounters.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/PerformanceCounters.java index b1e30e5c..f5b8d27d 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/PerformanceCounters.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/machine/PerformanceCounters.java @@ -28,9 +28,9 @@ public class PerformanceCounters { private long cpuStealTime = 0; private long cpuLostTime = 0; - private float cpuCapacity = 0.0f; - private float cpuDemand = 0.0f; - private float cpuSupply = 0.0f; + private double cpuCapacity = 0.0f; + private double cpuDemand = 0.0f; + private double cpuSupply = 0.0f; public long getCpuActiveTime() { return cpuActiveTime; @@ -76,27 +76,27 @@ public class PerformanceCounters { this.cpuLostTime = cpuLostTime; } - public float getCpuCapacity() { + public double getCpuCapacity() { return cpuCapacity; } - public void setCpuCapacity(float cpuCapacity) { + public void setCpuCapacity(double cpuCapacity) { this.cpuCapacity = cpuCapacity; } - public float getCpuDemand() { + public double getCpuDemand() { return cpuDemand; } - public void setCpuDemand(float cpuDemand) { + public void setCpuDemand(double cpuDemand) { this.cpuDemand = cpuDemand; } - public float getCpuSupply() { + public double getCpuSupply() { return cpuSupply; } - public void setCpuSupply(float cpuSupply) { + public void setCpuSupply(double cpuSupply) { this.cpuSupply = cpuSupply; } } 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 3bc3d2b4..21f59cf6 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 @@ -46,9 +46,9 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli private FlowEdge cpuEdge; // The edge to the cpu private FlowEdge workloadEdge; // The edge to the workload - private float cpuDemand; - private float cpuSupply; - private float cpuCapacity; + private double cpuDemand; + private double cpuSupply; + private double cpuCapacity; private PerformanceCounters performanceCounters = new PerformanceCounters(); @@ -66,19 +66,19 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli return activeWorkload; } - public float getDemand() { + public double getDemand() { return cpuDemand; } - public void setDemand(float demand) { + public void setDemand(double demand) { this.cpuDemand = demand; } - public float getCpuCapacity() { + public double getCpuCapacity() { return cpuCapacity; } - public void setCpuCapacity(float cpuCapacity) { + public void setCpuCapacity(double cpuCapacity) { this.cpuCapacity = cpuCapacity; } @@ -185,7 +185,7 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli * Push demand to the cpuMux if the demand has changed **/ @Override - public void pushDemand(FlowEdge supplierEdge, float newDemand) { + public void pushDemand(FlowEdge supplierEdge, double newDemand) { this.cpuEdge.pushDemand(newDemand); } @@ -193,15 +193,15 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli * Push supply to the workload if the supply has changed **/ @Override - public void pushSupply(FlowEdge consumerEdge, float newSupply) { - this.workloadEdge.pushDemand(newSupply); + public void pushSupply(FlowEdge consumerEdge, double newSupply) { + this.workloadEdge.pushSupply(newSupply); } /** * Handle new demand from the workload by sending it through to the cpuMux **/ @Override - public void handleDemand(FlowEdge consumerEdge, float newDemand) { + public void handleDemand(FlowEdge consumerEdge, double newDemand) { if (this.cpuDemand == newDemand) { return; } @@ -216,7 +216,7 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli * Handle a new supply pushed by the cpuMux by sending it through to the workload **/ @Override - public void handleSupply(FlowEdge supplierEdge, float newCpuSupply) { + public void handleSupply(FlowEdge supplierEdge, double newCpuSupply) { if (newCpuSupply == this.cpuSupply) { return; } @@ -234,7 +234,7 @@ public class VirtualMachine extends FlowNode implements FlowConsumer, FlowSuppli } @Override - public float getCapacity() { + public double getCapacity() { return this.cpuCapacity; } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/models/CpuModel.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/models/CpuModel.java index 88e17941..ab829bc4 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/models/CpuModel.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/models/CpuModel.java @@ -30,8 +30,8 @@ import java.util.Objects; public final class CpuModel { private final int id; private final int coreCount; - private final float coreSpeed; - private final float totalCapacity; + private final double coreSpeed; + private final double totalCapacity; private final String vendor; private final String modelName; @@ -47,7 +47,7 @@ public final class CpuModel { * @param modelName The name of the CPU * @param arch The architecture of the CPU */ - public CpuModel(int id, int coreCount, float coreSpeed, String vendor, String modelName, String arch) { + public CpuModel(int id, int coreCount, double coreSpeed, String vendor, String modelName, String arch) { this.id = id; this.coreCount = coreCount; this.coreSpeed = coreSpeed; @@ -57,7 +57,7 @@ public final class CpuModel { this.arch = arch; } - public CpuModel(int id, int coreCount, float coreSpeed) { + public CpuModel(int id, int coreCount, double coreSpeed) { this(id, coreCount, coreSpeed, "unkown", "unkown", "unkown"); } @@ -78,14 +78,14 @@ public final class CpuModel { /** * Return the clock rate of a single core of the CPU MHz. */ - public float getCoreSpeed() { + public double getCoreSpeed() { return coreSpeed; } /** * Return the clock rate of the CPU in MHz. */ - public float getTotalCapacity() { + public double getTotalCapacity() { return totalCapacity; } 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 9b4d6a33..58a6b847 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 @@ -37,13 +37,13 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { private long lastUpdate; - private float powerDemand = 0.0f; - private float powerSupplied = 0.0f; - private float totalEnergyUsage = 0.0f; + private double powerDemand = 0.0f; + private double powerSupplied = 0.0f; + private double totalEnergyUsage = 0.0f; private FlowEdge cpuEdge; - private float capacity = Long.MAX_VALUE; + private double capacity = Long.MAX_VALUE; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Basic Getters and Setters @@ -70,20 +70,20 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { /** * Return the instantaneous power usage of the machine (in W) measured at the InPort of the power supply. */ - public float getPowerDraw() { + public double getPowerDraw() { return this.powerSupplied; } /** * Return the cumulated energy usage of the machine (in J) measured at the InPort of the powers supply. */ - public float getEnergyUsage() { + public double getEnergyUsage() { updateCounters(); return totalEnergyUsage; } @Override - public float getCapacity() { + public double getCapacity() { return this.capacity; } @@ -106,7 +106,7 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { @Override public long onUpdate(long now) { updateCounters(); - float powerSupply = this.powerDemand; + double powerSupply = this.powerDemand; if (powerSupply != this.powerSupplied) { this.pushSupply(this.cpuEdge, powerSupply); @@ -129,7 +129,7 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { long duration = now - lastUpdate; if (duration > 0) { // Compute the energy usage of the machine - this.totalEnergyUsage += (float) (this.powerSupplied * duration * 0.001); + this.totalEnergyUsage += (double) (this.powerSupplied * duration * 0.001); } } @@ -138,7 +138,7 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public void handleDemand(FlowEdge consumerEdge, float newPowerDemand) { + public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { if (newPowerDemand == this.powerDemand) { return; } @@ -148,7 +148,7 @@ public final class SimPowerSource extends FlowNode implements FlowSupplier { } @Override - public void pushSupply(FlowEdge consumerEdge, float newSupply) { + public void pushSupply(FlowEdge consumerEdge, double newSupply) { if (newSupply == this.powerSupplied) { return; } 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 8f0fb130..381a8754 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 @@ -35,14 +35,14 @@ import org.opendc.simulator.engine.FlowSupplier; public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer { private long lastUpdate; - private float powerDemand = 0.0f; - private float powerSupplied = 0.0f; - private float totalEnergyUsage = 0.0f; + private double powerDemand = 0.0; + private double powerSupplied = 0.0; + private double totalEnergyUsage = 0.0; private FlowEdge cpuEdge; private FlowEdge powerEdge; - private float capacity = Long.MAX_VALUE; + private double capacity = Long.MAX_VALUE; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Basic Getters and Setters @@ -69,20 +69,20 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer /** * Return the instantaneous power usage of the machine (in W) measured at the InPort of the power supply. */ - public float getPowerDraw() { + public double getPowerDraw() { return this.powerSupplied; } /** * Return the cumulated energy usage of the machine (in J) measured at the InPort of the powers supply. */ - public float getEnergyUsage() { + public double getEnergyUsage() { updateCounters(); return totalEnergyUsage; } @Override - public float getCapacity() { + public double getCapacity() { return this.capacity; } @@ -103,7 +103,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer @Override public long onUpdate(long now) { updateCounters(); - float powerSupply = this.powerDemand; + double powerSupply = this.powerDemand; if (powerSupply != this.powerSupplied) { this.pushSupply(this.cpuEdge, powerSupply); @@ -126,7 +126,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer long duration = now - lastUpdate; if (duration > 0) { // Compute the energy usage of the psu - this.totalEnergyUsage += (float) (this.powerSupplied * duration * 0.001); + this.totalEnergyUsage += (double) (this.powerSupplied * duration * 0.001); } } @@ -135,7 +135,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public void pushDemand(FlowEdge supplierEdge, float newDemand) { + public void pushDemand(FlowEdge supplierEdge, double newDemand) { if (newDemand == this.powerDemand) { return; } @@ -145,7 +145,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer } @Override - public void pushSupply(FlowEdge consumerEdge, float newSupply) { + public void pushSupply(FlowEdge consumerEdge, double newSupply) { if (newSupply == this.powerSupplied) { return; } @@ -155,7 +155,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer } @Override - public void handleDemand(FlowEdge consumerEdge, float newPowerDemand) { + public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) { if (newPowerDemand == this.powerDemand) { return; } @@ -165,7 +165,7 @@ public final class SimPsu extends FlowNode implements FlowSupplier, FlowConsumer } @Override - public void handleSupply(FlowEdge supplierEdge, float newPowerSupply) { + public void handleSupply(FlowEdge supplierEdge, double newPowerSupply) { if (newPowerSupply == this.powerSupplied) { return; } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimChainWorkload.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimChainWorkload.java index 7f1cf060..f91c363d 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimChainWorkload.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimChainWorkload.java @@ -35,13 +35,13 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { private int workloadIndex; private SimWorkload activeWorkload; - private float demand = 0.0f; - private float supply = 0.0f; + private double demand = 0.0f; + private double supply = 0.0f; private FlowEdge workloadEdge; private FlowEdge machineEdge; - private float capacity = 0; + private double capacity = 0; private long checkpointInterval = 0; private long checkpointDuration = 0; @@ -55,7 +55,7 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @Override - public float getCapacity() { + public double getCapacity() { return this.capacity; } @@ -194,7 +194,7 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { * @param newDemand */ @Override - public void pushDemand(FlowEdge supplierEdge, float newDemand) { + public void pushDemand(FlowEdge supplierEdge, double newDemand) { this.machineEdge.pushDemand(newDemand); } @@ -205,7 +205,7 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { * @param newSupply */ @Override - public void pushSupply(FlowEdge consumerEdge, float newSupply) { + public void pushSupply(FlowEdge consumerEdge, double newSupply) { this.workloadEdge.pushSupply(newSupply); } @@ -216,7 +216,7 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { * @param newDemand */ @Override - public void handleDemand(FlowEdge consumerEdge, float newDemand) { + public void handleDemand(FlowEdge consumerEdge, double newDemand) { if (newDemand == this.demand) { return; } @@ -232,7 +232,7 @@ final class SimChainWorkload extends SimWorkload implements FlowSupplier { * @param newSupply */ @Override - public void handleSupply(FlowEdge supplierEdge, float newSupply) { + public void handleSupply(FlowEdge supplierEdge, double newSupply) { if (newSupply == this.supply) { return; } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java index b6f98344..59e38ce1 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/SimTraceWorkload.java @@ -37,8 +37,8 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { private long startOfFragment; private FlowEdge machineEdge; - private float currentDemand; - private float currentSupply; + private double currentDemand; + private double currentSupply; private long checkpointInterval; private long checkpointDuration; @@ -98,7 +98,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { graph.addEdge(this, supplier); this.currentFragment = this.getNextFragment(); - pushDemand(machineEdge, (float) this.currentFragment.cpuUsage()); + pushDemand(machineEdge, (double) this.currentFragment.cpuUsage()); this.startOfFragment = now; } @@ -135,7 +135,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { this.startOfFragment = now - passedTime; // Change the cpu Usage to the new Fragment - pushDemand(machineEdge, (float) this.currentFragment.cpuUsage()); + pushDemand(machineEdge, (double) this.currentFragment.cpuUsage()); // Return the time when the current fragment will complete return this.startOfFragment + duration; @@ -190,7 +190,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { this.fragmentIndex = -1; this.currentFragment = getNextFragment(); - pushDemand(this.machineEdge, (float) this.currentFragment.cpuUsage()); + pushDemand(this.machineEdge, (double) this.currentFragment.cpuUsage()); this.startOfFragment = now; this.invalidate(); @@ -206,7 +206,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { // Start the first Fragment this.currentFragment = this.remainingFragments.pop(); - pushDemand(this.machineEdge, (float) this.currentFragment.cpuUsage()); + pushDemand(this.machineEdge, (double) this.currentFragment.cpuUsage()); this.startOfFragment = offset; this.invalidate(); @@ -223,7 +223,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { * @param newSupply */ @Override - public void handleSupply(FlowEdge supplierEdge, float newSupply) { + public void handleSupply(FlowEdge supplierEdge, double newSupply) { if (newSupply == this.currentSupply) { return; } @@ -238,7 +238,7 @@ public class SimTraceWorkload extends SimWorkload implements FlowConsumer { * @param newDemand */ @Override - public void pushDemand(FlowEdge supplierEdge, float newDemand) { + public void pushDemand(FlowEdge supplierEdge, double newDemand) { if (newDemand == this.currentDemand) { return; } diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/TraceWorkload.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/TraceWorkload.java index 115689df..8e068e1f 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/TraceWorkload.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/TraceWorkload.java @@ -79,7 +79,7 @@ public class TraceWorkload implements Workload { } public static Builder builder() { - return builder(0L, 0L, 0L); + return builder(0L, 0L, 0.0); } public static Builder builder(long checkpointInterval, long checkpointDuration, double checkpointIntervalScaling) { 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 2b6a922e..173c60e7 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,18 +22,10 @@ package org.opendc.simulator.compute -import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.Test -import org.opendc.simulator.compute.cpu.CpuPowerModels -import org.opendc.simulator.compute.machine.SimMachine import org.opendc.simulator.compute.models.CpuModel import org.opendc.simulator.compute.models.MachineModel import org.opendc.simulator.compute.models.MemoryUnit -import org.opendc.simulator.compute.workload.TraceWorkload -import org.opendc.simulator.engine.FlowEngine -import org.opendc.simulator.kotlin.runSimulation -import java.util.concurrent.ThreadLocalRandom /** * Test suite for the [SimBareMetalMachine] class. @@ -48,7 +40,7 @@ class SimMachineTest { CpuModel( 0, 2, - 1000.0f, + 1000.0, "Intel", "Xeon", "amd64", @@ -75,33 +67,33 @@ class SimMachineTest { // assertEquals(1000, timeSource.millis()) // } - @Test - fun testTraceWorkload() = - runSimulation { - val random = ThreadLocalRandom.current() - val builder = TraceWorkload.builder() - repeat(100) { - builder.add(1000, random.nextDouble(0.0, 4500.0), 1) - } - val traceWorkload = builder.build() - - val engine = FlowEngine.create(dispatcher) - val graph = engine.newGraph() - val simMachine = - SimMachine( - graph, - machineModel, - CpuPowerModels.constant(0.0), - ) { cause -> - } - - val virtualMachine = - simMachine.startWorkload(traceWorkload) { cause -> - assertEquals(100000, timeSource.millis()) - } - - // Two cores execute 1000 MFlOps per second (1000 ms) - } +// @Test +// fun testTraceWorkload() = +// runSimulation { +// val random = ThreadLocalRandom.current() +// val builder = TraceWorkload.builder() +// repeat(100) { +// builder.add(1000, random.nextDouble(0.0, 4500.0), 1) +// } +// val traceWorkload = builder.build() +// +// val engine = FlowEngine.create(dispatcher) +// val graph = engine.newGraph() +// val simMachine = +// SimMachine( +// graph, +// machineModel, +// CpuPowerModels.constant(0.0), +// ) { cause -> +// } +// +// val virtualMachine = +// simMachine.startWorkload(traceWorkload) { cause -> +// assertEquals(100000, timeSource.millis()) +// } +// +// // Two cores execute 1000 MFlOps per second (1000 ms) +// } // @Test // fun testDualSocketMachine() = |
