Commit 4f096fa3 authored by Ahmad Siavashi's avatar Ahmad Siavashi

Relocate power and placement events

parent 693bcad3
...@@ -14,8 +14,6 @@ import org.cloudbus.cloudsim.VmAllocationPolicy; ...@@ -14,8 +14,6 @@ import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim; import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.CloudSimTags; import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
import org.cloudbus.cloudsim.gpu.GpuDatacenter;
import org.cloudbus.cloudsim.gpu.GpuVm; import org.cloudbus.cloudsim.gpu.GpuVm;
import org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicy; import org.cloudbus.cloudsim.gpu.GpuVmAllocationPolicy;
import org.cloudbus.cloudsim.gpu.Vgpu; import org.cloudbus.cloudsim.gpu.Vgpu;
...@@ -57,15 +55,11 @@ public class GpuDatacenterEx extends PowerGpuDatacenter { ...@@ -57,15 +55,11 @@ public class GpuDatacenterEx extends PowerGpuDatacenter {
Entry<GpuVm, Boolean> newVm = new SimpleEntry<GpuVm, Boolean>((GpuVm) ev.getData(), ack); Entry<GpuVm, Boolean> newVm = new SimpleEntry<GpuVm, Boolean>((GpuVm) ev.getData(), ack);
getNewVms().add(newVm); getNewVms().add(newVm);
} }
@Override @Override
public void processEvent(SimEvent ev) { public void startEntity() {
// if this is the first time processing happens schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT);
if (CloudSim.clock() == 0.0 super.startEntity();
&& CloudSim.select(getId(), new PredicateType(GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT)) == null) {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT);
}
super.processEvent(ev);
} }
@Override @Override
......
...@@ -9,9 +9,7 @@ import org.cloudbus.cloudsim.DatacenterCharacteristics; ...@@ -9,9 +9,7 @@ import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host; import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Storage; import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.VmAllocationPolicy; import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
import org.cloudbus.cloudsim.gpu.GpuDatacenter; import org.cloudbus.cloudsim.gpu.GpuDatacenter;
import org.cloudbus.cloudsim.gpu.VideoCard; import org.cloudbus.cloudsim.gpu.VideoCard;
import org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy; import org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy;
...@@ -92,15 +90,11 @@ public class PowerGpuDatacenter extends GpuDatacenter { ...@@ -92,15 +90,11 @@ public class PowerGpuDatacenter extends GpuDatacenter {
getHostEnergyMap().put(powerGpuHost, hostTotalEnergy); getHostEnergyMap().put(powerGpuHost, hostTotalEnergy);
} }
} }
@Override @Override
public void processEvent(SimEvent ev) { public void startEntity() {
// if this is the first time processing happens schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT);
if (CloudSim.clock() == 0.0 super.startEntity();
&& CloudSim.select(getId(), new PredicateType(GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT)) == null) {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT);
}
super.processEvent(ev);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment