Commit a0226d94 authored by Anton Beloglazov's avatar Anton Beloglazov

- Removed some obsolete code

parent 45cfcbff
......@@ -1005,23 +1005,6 @@ public class Cloudlet {
return getCloudletLength() * getPesNumber();
}
/**
* Gets the total execution time of this Cloudlet from the latest
* CloudResource.
*
* @return the total execution time of this Cloudlet in a CloudResource
*
* @pre $none
* @post $result >= 0.0
*/
public double getActualCPUTimeOld() {
//TODO: check which method to leave
if (index == -1) {
return 0.0;
}
return resList.get(index).actualCPUTime;
}
/**
* Gets the cost running this Cloudlet in the latest CloudResource.
*
......@@ -1038,33 +1021,6 @@ public class Cloudlet {
return resList.get(index).costPerSec;
}
/**
* Gets the total cost of processing or executing this Cloudlet
* <tt>Processing Cost = actual CPU Time * cost per sec</tt>.
*
* @return the total cost of processing Cloudlet
*
* @see CloudSim.Cloudlet#getActualCPUTime()
* @see CloudSim.Cloudlet#getCostPerSecond()
* @pre $none
* @post $result >= 0.0
*/
public double getProcessingCostOld() {
//TODO: check which method to leave
if (index == -1) {
return 0.0;
}
Resource res = null;
double cost = 0.0;
for (int i = 0; i <= index; i++) {
res = resList.get(i);
cost += (res.actualCPUTime * res.costPerSec);
}
return cost;
}
/**
* Gets the time of this Cloudlet resides in the latest CloudResource
* (from arrival time until departure time).
......@@ -1550,22 +1506,6 @@ public class Cloudlet {
this.utilizationModelBw = utilizationModelBw;
}
/**
* Gets the utilization of cpu.
*
* @param time the time
*
* @return the utilization of cpu
*/
// public List<Double> getUtilizationOfCpu(final double time) {
// double utilization = getUtilizationModelCpu().getUtilization(time);
// List<Double> utilizationMap = new ArrayList<Double>();
// for (int i = 0; i < getPesNumber(); i++) {
// utilizationMap.add(utilization);
// }
// return utilizationMap;
// }
/**
* Gets the total utilization of cpu.
*
......
......@@ -106,7 +106,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
for (ResCloudlet rcl : getCloudletExecList()) {
if (rcl.getRemainingCloudletLength() == 0.0) {// finished anyway, rounding issue...
toRemove.add(rcl);
//getCloudletExecList().remove(obj);
cloudletFinish(rcl);
finished++;
}
......@@ -127,7 +126,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
getCloudletExecList().add(rcl);
usedPes += rcl.getPesNumber();
toRemove.add(rcl);
//getCloudletWaitingList().remove(j);
break;
}
}
......@@ -380,20 +378,12 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
rcl.setMachineAndPeId(0, i);
}
// double size = rgl.getRemainingCloudletLength();
// size*=rgl.getNumPE();
// rgl.getCloudlet().setCloudletLength(size);
getCloudletExecList().add(rcl);
usedPes += cloudlet.getPesNumber();
} else {// no enough free PEs: go to the waiting queue
ResCloudlet rcl = new ResCloudlet(cloudlet);
rcl.setCloudletStatus(Cloudlet.QUEUED);
// double size = rgl.getRemainingCloudletLength();
// size*=rgl.getNumPE();
// rgl.getCloudlet().setCloudletLength(size);
getCloudletWaitingList().add(rcl);
return 0.0;
}
......@@ -542,6 +532,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Gets the cloudlet waiting list.
*
* @param <T> the generic type
* @return the cloudlet waiting list
*/
@SuppressWarnings("unchecked")
......@@ -552,6 +543,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Cloudlet waiting list.
*
* @param <T> the generic type
* @param cloudletWaitingList the cloudlet waiting list
*/
protected <T extends ResCloudlet> void cloudletWaitingList(List<T> cloudletWaitingList) {
......@@ -561,6 +553,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings("unchecked")
......@@ -571,6 +564,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected <T extends ResCloudlet> void setCloudletExecList(List<T> cloudletExecList) {
......@@ -580,6 +574,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings("unchecked")
......@@ -590,6 +585,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected <T extends ResCloudlet> void setCloudletPausedList(List<T> cloudletPausedList) {
......@@ -599,6 +595,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings("unchecked")
......@@ -609,12 +606,16 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected <T extends ResCloudlet> void setCloudletFinishedList(List<T> cloudletFinishedList) {
this.cloudletFinishedList = cloudletFinishedList;
}
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getCurrentRequestedMips()
*/
@Override
public List<Double> getCurrentRequestedMips() {
List<Double> mipsShare = new ArrayList<Double>();
......@@ -626,6 +627,9 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return mipsShare;
}
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getTotalCurrentAvailableMipsForCloudlet(org.cloudbus.cloudsim.ResCloudlet, java.util.List)
*/
@Override
public double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare) {
double capacity = 0.0;
......@@ -641,28 +645,22 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return capacity;
}
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getTotalCurrentAllocatedMipsForCloudlet(org.cloudbus.cloudsim.ResCloudlet, double)
*/
@Override
public double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time) {
// TODO Auto-generated method stub
return 0.0;
}
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getTotalCurrentRequestedMipsForCloudlet(org.cloudbus.cloudsim.ResCloudlet, double)
*/
@Override
public double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time) {
// TODO Auto-generated method stub
return 0.0;
}
// @Override
// public List<Double> getCurrentAllocatedMips() {
// // TODO Auto-generated method stub
// return null;
// }
//
// @Override
// public double getTotalCurrentAllocatedMips() {
// // TODO Auto-generated method stub
// return 0;
// }
}
......@@ -70,7 +70,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
for (ResCloudlet rcl : getCloudletExecList()) {
rcl.updateCloudletFinishedSoFar((long) (getCapacity(mipsShare) * timeSpam * rcl.getPesNumber()));
// Log.printLine(CloudSim.clock()+": CloudletSchedulerTimeShared: updating cloudlet #"+rgl.getCloudletId()+": remaining:"+rgl.getRemainingCloudletLength());
}
if (getCloudletExecList().size() == 0) {
......@@ -86,7 +85,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
double remainingLength = rcl.getRemainingCloudletLength();
if (remainingLength == 0.00) {// finished: remove from the list
toRemove.add(rcl);
//getCloudletExecList().remove(rcl);
cloudletFinish(rcl);
continue;
}
......@@ -322,9 +320,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
rcl.setMachineAndPeId(0, i);
}
// double size = rgl.getRemainingCloudletLength();
// size*=rgl.getNumPE();
// rgl.getCloudlet().setCloudletLength(size);
getCloudletExecList().add(rcl);
// use the current capacity to estimate the extra amount of
......@@ -447,6 +442,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings("unchecked")
......@@ -457,6 +453,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected <T extends ResCloudlet> void setCloudletExecList(List<T> cloudletExecList) {
......@@ -466,6 +463,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings("unchecked")
......@@ -476,6 +474,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected <T extends ResCloudlet> void setCloudletPausedList(List<T> cloudletPausedList) {
......@@ -485,6 +484,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings("unchecked")
......@@ -495,6 +495,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected <T extends ResCloudlet> void setCloudletFinishedList(List<T> cloudletFinishedList) {
......@@ -543,16 +544,4 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return 0.0;
}
// @Override
// public List<Double> getCurrentAllocatedMips() {
// // TODO Auto-generated method stub
// return null;
// }
//
// @Override
// public double getTotalCurrentAllocatedMips() {
// // TODO Auto-generated method stub
// return 0;
// }
}
......@@ -103,68 +103,6 @@ public class Datacenter extends SimEntity {
getCharacteristics().setId(super.getId());
}
/**
* Handles external events that are coming to this PowerDatacenter entity.
* This method also registers the identity of this entity to
* <tt>CloudInformationService</tt> class.
* <p>
* The services or tags available for this resource are:
* <ul>
* <li> {@link cloudsim.DatacenterTags#VM_CREATE} </li>
* <li> {@link cloudsim.DatacenterTags#VM_CREATE_ACK} </li>
* <li> {@link cloudsim.DatacenterTags#VM_DESTROY} </li>
* <li> {@link cloudsim.DatacenterTags#VM_DESTROY_ACK} </li>
* <li> {@link cloudsim.DatacenterTags#VM_MIGRATE} </li>
* <li> {@link cloudsim.DatacenterTags#VM_MIGRATE_ACK} </li>
* </ul>
* <br>
*
* @pre $none
* @post $none
*/
public void body() {
// this resource should register to regional GIS.
// However, if not specified, then register to system GIS (the
// default CloudInformationService) entity.
int cisId = CloudSim.getEntityId(regionalCisName);
if (cisId == -1) {
cisId = CloudSim.getCloudInfoServiceEntityId();
}
// need to wait for few seconds before registering to a regional GIS.
// This is because to allow all routers to fill in their routing tables
else {
super.pause(2);
Log.printLine(super.getName() + ".body(): wait for " +
" 2 seconds before registering to " +
regionalCisName);
}
// send the registration to GIS
sendNow(cisId, CloudSimTags.REGISTER_RESOURCE, getId());
// Below method is for a child class to override
registerOtherEntity();
// Process events until END_OF_SIMULATION is received from the
// CloudSimShutdown Entity
// SimEvent ev = new SimEvent();
SimEvent ev;
while (CloudSim.running()){
//super.sim_get_next(ev);
ev = getNextEvent();
// if the simulation finishes then exit the loop
if (ev.getTag() == CloudSimTags.END_OF_SIMULATION){
break;
}
// process the received event
processEvent(ev);
}
// remove I/O entities created during construction of this entity
//super.terminateIOEntities();
}
/**
* Overrides this method when making a new and different type of resource.
* This method is called by {@link #body()} to register other type to
......
......@@ -420,6 +420,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Gets the vm list.
*
* @param <T> the generic type
* @return the vm list
*/
@SuppressWarnings("unchecked")
......@@ -430,6 +431,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Sets the vm list.
*
* @param <T> the generic type
* @param vmList the new vm list
*/
protected <T extends Vm> void setVmList(List<T> vmList) {
......@@ -440,6 +442,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Gets the cloudlet list.
*
* @param <T> the generic type
* @return the cloudlet list
*/
@SuppressWarnings("unchecked")
......@@ -451,6 +454,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Sets the cloudlet list.
*
* @param <T> the generic type
* @param cloudletList the new cloudlet list
*/
protected <T extends Cloudlet> void setCloudletList(List<T> cloudletList) {
......@@ -460,6 +464,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Gets the cloudlet submitted list.
*
* @param <T> the generic type
* @return the cloudlet submitted list
*/
@SuppressWarnings("unchecked")
......@@ -471,6 +476,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Sets the cloudlet submitted list.
*
* @param <T> the generic type
* @param cloudletSubmittedList the new cloudlet submitted list
*/
protected <T extends Cloudlet> void setCloudletSubmittedList(List<T> cloudletSubmittedList) {
......@@ -480,6 +486,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Gets the cloudlet received list.
*
* @param <T> the generic type
* @return the cloudlet received list
*/
@SuppressWarnings("unchecked")
......@@ -490,6 +497,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Sets the cloudlet received list.
*
* @param <T> the generic type
* @param cloudletReceivedList the new cloudlet received list
*/
protected <T extends Cloudlet> void setCloudletReceivedList(List<T> cloudletReceivedList) {
......@@ -499,6 +507,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Gets the vm list.
*
* @param <T> the generic type
* @return the vm list
*/
@SuppressWarnings("unchecked")
......@@ -509,6 +518,7 @@ public class DatacenterBroker extends SimEntity {
/**
* Sets the vm list.
*
* @param <T> the generic type
* @param vmsCreatedList the vms created list
*/
protected <T extends Vm> void setVmsCreatedList(List<T> vmsCreatedList) {
......
......@@ -142,8 +142,7 @@ public class DatacenterCharacteristics {
/**
* Gets a Machine with at least one empty Pe.
*
* @return a Machine object or <tt>null</tt> if not found
*
* @return a Machine object or if not found
* @pre $none
* @post $none
*/
......@@ -155,9 +154,7 @@ public class DatacenterCharacteristics {
* Gets a Machine with at least a given number of free Pe.
*
* @param peNumber the pe number
*
* @return a Machine object or <tt>null</tt> if not found
*
* @return a Machine object or if not found
* @pre $none
* @post $none
*/
......@@ -169,8 +166,7 @@ public class DatacenterCharacteristics {
* Gets Millions Instructions Per Second (MIPS) Rating of a Processing
* Element (Pe). It is assumed all PEs' rating is same in a given machine.
*
* @return the MIPS Rating or <tt>-1</tt> if no PEs are exists.
*
* @return the MIPS Rating or if no PEs are exists.
* @pre $none
* @post $result >= -1
*/
......@@ -191,9 +187,7 @@ public class DatacenterCharacteristics {
*
* @param id the machine ID
* @param peId the Pe ID
*
* @return the MIPS Rating or <tt>-1</tt> if no PEs are exists.
*
* @return the MIPS Rating or if no PEs are exists.
* @pre id >= 0
* @pre peID >= 0
* @post $result >= -1
......@@ -322,10 +316,8 @@ public class DatacenterCharacteristics {
* @param status Pe status, either <tt>Pe.FREE</tt> or <tt>Pe.BUSY</tt>
* @param hostId Machine ID
* @param peId Pe id
*
* @return <tt>true</tt> if the Pe status has changed, <tt>false</tt>
* @return
* otherwise (Machine id or Pe id might not be exist)
*
* @pre machineID >= 0
* @pre peID >= 0
* @post $none
......@@ -346,27 +338,6 @@ public class DatacenterCharacteristics {
return getCostPerSecond() / getMipsOfOnePe();
}
/**
* Gets the byte size of this class.
*
* @return the byte size
*
* @pre $none
* @post $result > 0
*/
// TODO: check necessity
// public int getByteSize() {
// // this class overall has: 2 ints, 2 Strings, 1 HostList2 and
// // 2 doubles.
// // NOTE: static attributes do not count
// int totalInt = 2 * 4;
// int totalDouble = 2 * 8;
// int totalSize = getArchitecture().length() + getOs().length() +
// getHostList().getByteSize() + totalInt + totalDouble ;
//
// return totalSize;
// }
/**
* Gets the total number of machines.
*
......@@ -394,8 +365,8 @@ public class DatacenterCharacteristics {
/**
* Checks whether all machines of this resource are working properly or not.
*
* @return <tt>true</tt> if all machines are working,
* <tt>false</tt> otherwise
* @return if all machines are working,
* otherwise
*/
public boolean isWorking() {
boolean result = false;
......@@ -535,12 +506,9 @@ public class DatacenterCharacteristics {
/**
* Gets the host list.
*
* @param <T> the generic type
* @return the host list
*/
// protected HostList2<? extends Host> getHostList() {
// return hostList;
// }
@SuppressWarnings("unchecked")
public <T extends Host> List<T> getHostList() {
return (List<T>) hostList;
......@@ -549,6 +517,7 @@ public class DatacenterCharacteristics {
/**
* Sets the host list.
*
* @param <T> the generic type
* @param hostList the new host list
*/
protected <T extends Host> void setHostList(List<T> hostList) {
......
......@@ -122,72 +122,6 @@ public class FederatedDatacenter extends SimEntity {
getCharacteristics().setId(super.getId());
}
/**
* Handles external events that are coming to this PowerDatacenter entity.
* This method also registers the identity of this entity to
* <tt>CloudInformationService</tt> class.
* <p>
* The services or tags available for this resource are:
* <ul>
* <li> {@link cloudsim.CloudSimTags#VM_CREATE} </li>
* <li> {@link cloudsim.CloudSimTags#VM_CREATE_ACK} </li>
* <li> {@link cloudsim.CloudSimTags#VM_DESTROY} </li>
* <li> {@link cloudsim.CloudSimTags#VM_DESTROY_ACK} </li>
* <li> {@link cloudsim.CloudSimTags#VM_MIGRATE} </li>
* <li> {@link cloudsim.CloudSimTags#VM_MIGRATE_ACK} </li>
* </ul>
* <br>
*
* @pre $none
* @post $none
*/
public void body() {
// this resource should register to regional GIS.
// However, if not specified, then register to system GIS (the
// default CloudInformationService) entity.
int cisId = CloudSim.getEntityId(regionalCisName);
if (cisId == -1) {
cisId = CloudSim.getCloudInfoServiceEntityId();
}
// need to wait for few seconds before registering to a regional GIS.
// This is because to allow all routers to fill in their routing tables
else {
super.pause(2);
Log.printLine(super.getName() + ".body(): wait for " +
" 2 seconds before registering to " +
regionalCisName);
}
// send the registration to GIS
sendNow(cisId, CloudSimTags.REGISTER_RESOURCE, getId());
super.pause(8);
federationList = CloudSim.getCloudResourceList();
// Below method is for a child class to override
registerOtherEntity();
// Process events until END_OF_SIMULATION is received from the
// CloudSimShutdown Entity
//SimEvent ev = new SimEvent();
SimEvent ev;
while (CloudSim.running()){
//super.sim_get_next(ev);
ev = getNextEvent();
// if the simulation finishes then exit the loop
if (ev.getTag() == CloudSimTags.END_OF_SIMULATION){
break;
}
// process the received event
processEvent(ev);
}
// remove I/O entities created during construction of this entity
//super.terminateIOEntities();
}
/**
* Overrides this method when making a new and different type of resource.
* This method is called by {@link #body()} to register other type to
......
......@@ -39,8 +39,8 @@ public class HostDynamicWorkload extends Host {
* @param ramProvisioner the ram provisioner
* @param bwProvisioner the bw provisioner
* @param storage the storage
* @param vmScheduler the VM scheduler
* @param peList the pe list
* @param vmScheduler the VM scheduler
*/
public HostDynamicWorkload(
int id,
......@@ -65,25 +65,14 @@ public class HostDynamicWorkload extends Host {
setUtilizationMips(0);
for (Vm vm : getVmList()) {
// if (vm.isInMigration()) {
// continue;
// }
getVmScheduler().deallocatePesForVm(vm);
}
for (Vm vm : getVmList()) {
// if (vm.isInMigration()) {
// continue;
// }
getVmScheduler().allocatePesForVm(vm, vm.getCurrentRequestedMips());
}
for (Vm vm : getVmList()) {
// if (vm.isInMigration()) {
// continue;
// }
double totalRequestedMips = vm.getCurrentRequestedTotalMips();
if (totalRequestedMips == 0) {
......@@ -109,33 +98,14 @@ public class HostDynamicWorkload extends Host {
setUtilizationMips(getUtilizationMips() + totalAllocatedMips);
}
// for (Vm vm : getVmList()) {
// if (vm.isInMigration()) {
// continue;
// }
//
// List<Double> requestedMips = vm.getCurrentRequestedMips();
// double totalRequestedMips = vm.getCurrentRequestedTotalMips();
//
// getVmScheduler().allocatePesForVm(vm, requestedMips);
// double totalAllocatedMips = getVmScheduler().getTotalAllocatedMipsForVm(vm);
//
// if (totalAllocatedMips + 0.1 < totalRequestedMips) {
// Log.printLine("Under allocated MIPS for VM #" + vm.getId() + ": requested " + totalRequestedMips + ", allocated " + totalAllocatedMips);
// }
//
// updateUnderAllocatedMips(vm, totalRequestedMips, totalAllocatedMips);
//
// setUtilizationMips(getUtilizationMips() + totalAllocatedMips);
//
// Log.print(String.format("%.2f: Total allocated MIPS for VM #" + vm.getId() + " (Host #" + vm.getHost().getId() + ") is %.2f, was requested %.2f out of total %.2f (%.2f%%)\n", CloudSim.clock(), totalAllocatedMips, totalRequestedMips, vm.getMips(), totalRequestedMips / vm.getMips() * 100));
// }
//TODO: getTotalAllocatedMipsForVm should be done after all the vMs are allocated
return smallerTime;
}
/**
* Gets the completed vms.
*
* @return the completed vms
*/
public List<Vm> getCompletedVms() {
List<Vm> vmsToRemove = new ArrayList<Vm>();
for (Vm vm : getVmList()) {
......
......@@ -157,20 +157,6 @@ public class Pe {
this.status = status;
}
/**
* Gets the byte size of this class.
*
* @return the byte size
*
* @pre $none
* @post $result > 0
*/
// TODO: check necessaty
// public static int getByteSize() {
// int totalInt = 2 * 4; // NOTE: static int doesn't count
// return totalInt;
// }
/**
* Sets the pe provisioner.
*
......
......@@ -77,7 +77,6 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
}
if (!getVmTable().containsKey(vm.getUid())) { //if this vm was not created
do {//we still trying until we find a host or until we try all of them
int moreFree = Integer.MIN_VALUE;
int idx = -1;
......@@ -130,38 +129,6 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
}
}
/**
* Triggers a migration from a given virtual machine to a selected
* host.
*
* @param vm the vm
*
* @return $true if the migration succeeds; $false otherwise
*
* @pre $none
* @post $none
*/
// TODO: check necessity
// @Override
// public boolean migrateVm(Vm vm, Host destination) {
// //where is this VM running?
// Host source = getHost(vm);
// Vm _vm = source.vmMigrate(vm);
// if (_vm == null) {
// return false;
// }
//
// if (destination == null) {
// return false;
// }
//
// if (destination.getFreePesNumber() >= vm.getPesNumber()) {
// return destination.vmMigrate(vm);
// }
//
// return false;
// }
/**
* Gets the host that is executing the given VM belonging to the
* given user.
......@@ -258,6 +225,9 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
return null;
}
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#allocateHostForVm(org.cloudbus.cloudsim.Vm, org.cloudbus.cloudsim.Host)
*/
@Override
public boolean allocateHostForVm(Vm vm, Host host) {
if (host.vmCreate(vm)) { //if vm has been succesfully created in the host
......
......@@ -80,6 +80,10 @@ public class VmSchedulerTimeShared extends VmScheduler {
* @return true, if successful
*/
protected boolean allocatePesForVm(String vmUid, List<Double> mipsShareRequested) {
/**
* TODO: add a restriction of the amount of MIPS allocated to a VM. A VM must require
* not more than is the capacity of a PE.
*/
getMipsMapRequested().put(vmUid, mipsShareRequested);
setPesInUse(getPesInUse() + mipsShareRequested.size());
......
......@@ -263,7 +263,6 @@ public class CloudInformationService extends SimEntity {
*
* @param ev a Sim_event object
*
* @see gridsim.CloudInformationService#body()
* @pre ev != null
* @post $none
*/
......
......@@ -126,21 +126,10 @@ public class HostList {
@SuppressWarnings("unchecked")
public static <T extends Host> T getHostWithFreePe(List<T> hostList, int pesNumber) {
for (T host : hostList) {
// If the machine is failed, do nothing. Otherwise...
//if (!host.getFailed())
if (PeList.getFreePesNumber((List<Pe>) host.getPeList()) >= pesNumber) {
return host;
}
/**************
// Uncomment this if you want more info on the progress of sims
else
{
Log.printLine("HostList2.getMachineWithFreePE(). MachineID: " +
obj.getMachineID() + ". Machine is failed. Try other machine.");
}*/
}
return null;
}
......@@ -167,24 +156,5 @@ public class HostList {
return host.setPeStatus(peId, status);
}
/**
* Gets the byte size of this class.
*
* @return the byte size
*
* @pre $none
* @post $result >= 0
*/
// TODO: check necessity
// public int getByteSize() {
// int byteSize = 0;
//
// for (Host host : this) {
// byteSize += host.getByteSize();
// }
//
// return byteSize;
// }
}
......@@ -202,24 +202,6 @@ public class PeList {
return cnt;
}
/**
* Gets the byte size of PeList internal data members.
*
* @param peList the pe list
* @param resName the res name
* @param hostId the host id
* @param failed the failed
*
* @return the byte size
*
* @pre $none
* @post $result >= 0
*/
// TODO: check necessaty
// public int getByteSize() {
// return size() * Pe.getByteSize();
// }
/**
* Sets the status of PEs of this machine to FAILED.
* NOTE: <tt>resName</tt> and <tt>machineID</tt> are used for debugging
......
......@@ -358,7 +358,7 @@ public class CloudletSchedulerSingleServiceTest {
if (requestedMips2 > totalCurrentMipsForCloudlet) {
requestedMips2 = totalCurrentMipsForCloudlet;
}
// TODO: CloudletSchedulerSingleService.cloudletSubmit change type of cloudlet length from double to int
double expectedCompletiontime2 = 1 + ((CLOUDLET_LENGTH * PES_NUMBER - requestedMips1 * 1)) / requestedMips2;
double actualCompletionTime2 = vmScheduler.updateVmProcessing(1, mipsShare);
assertEquals(expectedCompletiontime2, actualCompletionTime2, 0);
......
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