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;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.CloudSimTags;
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.GpuVmAllocationPolicy;
import org.cloudbus.cloudsim.gpu.Vgpu;
......@@ -57,15 +55,11 @@ public class GpuDatacenterEx extends PowerGpuDatacenter {
Entry<GpuVm, Boolean> newVm = new SimpleEntry<GpuVm, Boolean>((GpuVm) ev.getData(), ack);
getNewVms().add(newVm);
}
@Override
public void processEvent(SimEvent ev) {
// if this is the first time processing happens
if (CloudSim.clock() == 0.0
&& CloudSim.select(getId(), new PredicateType(GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT)) == null) {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT);
}
super.processEvent(ev);
public void startEntity() {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_PLACEMENT);
super.startEntity();
}
@Override
......
......@@ -9,9 +9,7 @@ import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
import org.cloudbus.cloudsim.gpu.GpuDatacenter;
import org.cloudbus.cloudsim.gpu.VideoCard;
import org.cloudbus.cloudsim.gpu.allocation.VideoCardAllocationPolicy;
......@@ -92,15 +90,11 @@ public class PowerGpuDatacenter extends GpuDatacenter {
getHostEnergyMap().put(powerGpuHost, hostTotalEnergy);
}
}
@Override
public void processEvent(SimEvent ev) {
// if this is the first time processing happens
if (CloudSim.clock() == 0.0
&& CloudSim.select(getId(), new PredicateType(GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT)) == null) {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT);
}
super.processEvent(ev);
public void startEntity() {
schedule(getId(), getSchedulingInterval(), GpuCloudSimTags.GPU_VM_DATACENTER_POWER_EVENT);
super.startEntity();
}
@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