diff options
Diffstat (limited to 'opendc-compute/opendc-compute-simulator/src/main/java/org')
| -rw-r--r-- | opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java index 6fa6af60..aa2c13b9 100644 --- a/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java +++ b/opendc-compute/opendc-compute-simulator/src/main/java/org/opendc/compute/simulator/service/ComputeService.java @@ -56,6 +56,7 @@ import org.opendc.compute.simulator.scheduler.SchedulingResultType; import org.opendc.compute.simulator.telemetry.ComputeMetricReader; import org.opendc.compute.simulator.telemetry.SchedulerStats; import org.opendc.simulator.compute.power.SimPowerSource; +import org.opendc.simulator.compute.power.batteries.SimBattery; import org.opendc.simulator.compute.workload.Workload; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -109,6 +110,11 @@ public final class ComputeService implements AutoCloseable { private final Set<SimPowerSource> powerSources = new HashSet<>(); /** + * The available powerSources + */ + private final Set<SimBattery> batteries = new HashSet<>(); + + /** * The tasks that should be launched by the service. */ private final Deque<SchedulingRequest> taskQueue = new ArrayDeque<>(); @@ -307,6 +313,15 @@ public final class ComputeService implements AutoCloseable { powerSources.add(simPowerSource); } + public void addBattery(SimBattery simBattery) { + // Check if host is already known + if (batteries.contains(simBattery)) { + return; + } + + batteries.add(simBattery); + } + /** * Remove a {@link SimHost} from the scheduling pool of the compute service. */ @@ -341,6 +356,10 @@ public final class ComputeService implements AutoCloseable { return Collections.unmodifiableSet(this.powerSources); } + public Set<SimBattery> getBatteries() { + return Collections.unmodifiableSet(this.batteries); + } + public void setMetricReader(ComputeMetricReader metricReader) { this.metricReader = metricReader; } @@ -445,6 +464,7 @@ public final class ComputeService implements AutoCloseable { final HostView hv = result.getHost(); final SchedulingRequest req = result.getReq(); final ServiceTask task = req.getTask(); + final ServiceFlavor flavor = task.getFlavor(); if (task.getNumFailures() >= maxNumFailures) { |
