Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed power source bug #265

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ public class ComputeMetricReader(
loggState()
}
} finally {
loggState()

if (monitor is AutoCloseable) {
monitor.close()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public data class PowerSourceJSONSpec(
public companion object {
public val DFLT: PowerSourceJSONSpec =
PowerSourceJSONSpec(
totalPower = 10000,
totalPower = Long.MAX_VALUE,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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" } },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,13 @@ public void updateCounters(long now) {

@Override
public void handleDemand(FlowEdge consumerEdge, double newPowerDemand) {
if (newPowerDemand == this.powerDemand) {
return;
}

this.powerDemand = newPowerDemand;
this.invalidate();
}

@Override
public void pushSupply(FlowEdge consumerEdge, double newSupply) {
if (newSupply == this.powerSupplied) {
return;
}

this.powerSupplied = newSupply;
consumerEdge.pushSupply(newSupply);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ public void addConsumerEdge(FlowEdge consumerEdge) {
this.consumerEdges.add(consumerEdge);
this.demands.add(0.0);
this.supplies.add(0.0);

this.invalidate();
}

@Override
public void addSupplierEdge(FlowEdge supplierEdge) {
this.supplierEdge = supplierEdge;
this.capacity = supplierEdge.getCapacity();
this.totalSupply = 0;

this.invalidate();
}

@Override
Expand Down Expand Up @@ -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
Expand Down
Loading