Commit a2543cff authored by Manoel Campos's avatar Manoel Campos

Several improvements in documentation of classes from the package org.cloudbus.cloudsim.

The documentation of classes, methods and attributes were improved to make them clearer.
Many times the documentation of attributes and parameters just repeated the name of the attribute itself.
Some methods didn't have a clear explanation of their goals or lacked some important details that were included.
Some ambiguous terms such as "machine", that can mean a "virtual" or a "physical machine", where accordingly changed by the specific term to avoid confusion.
Some methods also had ambiguous meanings. Methods such as getUtilization of the UtilizationModel class return the utilization percentage of some resource. Other methods such as getUtilizationOfRam on HostDynamicWorkload class returns the absolute value of a resource usage (not percentage), what is not accordingly described in the documentation. These inconsistencies were corrected in the documentation.
parent 5e97ce76
/modules/cloudsim/target/
/modules/cloudsim-examples/target/
This diff is collapsed.
......@@ -119,7 +119,10 @@ public class CloudSimExample1 {
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
Cloudlet cloudlet =
new Cloudlet(id, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel,
utilizationModel);
cloudlet.setUserId(brokerId);
cloudlet.setVmId(vmid);
......
......@@ -119,8 +119,8 @@ public class NetworkExample4 {
//Sixth step: configure network
//maps CloudSim entities to BRITE entities
NetworkTopology.addLink(datacenter0.getId(),broker.getId(),10.0,10);
NetworkTopology.addLink(datacenter0.getId(), broker.getId(),10.0,10);
// Seventh step: Starts the simulation
CloudSim.startSimulation();
......
......@@ -10,12 +10,15 @@ package org.cloudbus.cloudsim;
import java.util.ArrayList;
import java.util.List;
import org.cloudbus.cloudsim.network.datacenter.NetworkCloudletSpaceSharedScheduler;
/**
* CloudletScheduler is an abstract class that represents the policy of scheduling performed by a
* virtual machine. So, classes extending this must execute Cloudlets. Also, the interface for
* virtual machine to run its {@link Cloudlet Cloudlets}.
* So, classes extending this must execute Cloudlets. Also, the interface for
* cloudlet management is also implemented in this class.
* Each VM has to have its own instance of a CloudletScheduler.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
......@@ -26,27 +29,27 @@ public abstract class CloudletScheduler {
/** The previous time. */
private double previousTime;
/** The current mips share. */
/** The list of current mips share available for the VM using the scheduler. */
private List<Double> currentMipsShare;
/** The cloudlet waiting list. */
/** The list of cloudlet waiting to be executed on the VM. */
protected List<? extends ResCloudlet> cloudletWaitingList;
/** The cloudlet exec list. */
/** The list of cloudlets being executed on the VM. */
protected List<? extends ResCloudlet> cloudletExecList;
/** The cloudlet paused list. */
/** The list of paused cloudlets. */
protected List<? extends ResCloudlet> cloudletPausedList;
/** The cloudlet finished list. */
/** The list of finished cloudlets. */
protected List<? extends ResCloudlet> cloudletFinishedList;
/** The cloudlet failed list. */
/** The list of failed cloudlets. */
protected List<? extends ResCloudlet> cloudletFailedList;
/**
* Creates a new CloudletScheduler object. This method must be invoked before starting the
* actual simulation.
* Creates a new CloudletScheduler object.
* A CloudletScheduler must be created before starting the actual simulation.
*
* @pre $none
* @post $none
......@@ -64,9 +67,9 @@ public abstract class CloudletScheduler {
* Updates the processing of cloudlets running under management of this scheduler.
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each processor available to the scheduler
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is no
* next events
* @param mipsShare list with MIPS share of each Pe available to the scheduler
* @return the predicted completion time of the earliest finishing cloudlet,
* or 0 if there is no next events
* @pre currentTime >= 0
* @post $none
*/
......@@ -75,7 +78,7 @@ public abstract class CloudletScheduler {
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param gl the submited cloudlet
* @param gl the submited cloudlet (@todo it's a strange param name)
* @param fileTransferTime time required to move the required files from the SAN to the VM
* @return expected finish time of this cloudlet, or 0 if it is in a waiting queue
* @pre gl != null
......@@ -96,7 +99,7 @@ public abstract class CloudletScheduler {
/**
* Cancels execution of a cloudlet.
*
* @param clId ID of the cloudlet being cancealed
* @param clId ID of the cloudlet being canceled
* @return the canceled cloudlet, $null if not found
* @pre $none
* @post $none
......@@ -139,31 +142,34 @@ public abstract class CloudletScheduler {
* @return status of the cloudlet, -1 if cloudlet not found
* @pre $none
* @post $none
*
* @todo cloudlet status should be an enum
*/
public abstract int getCloudletStatus(int clId);
/**
* Informs about completion of some cloudlet in the VM managed by this scheduler.
* Informs if there is any cloudlet that finished to execute in the VM managed by this scheduler.
*
* @return $true if there is at least one finished cloudlet; $false otherwise
* @pre $none
* @post $none
* @todo the method name would be isThereFinishedCloudlets to be clearer
*/
public abstract boolean isFinishedCloudlets();
/**
* Returns the next cloudlet in the finished list, $null if this list is empty.
* Returns the next cloudlet in the finished list.
*
* @return a finished cloudlet
* @return a finished cloudlet or $null if the respective list is empty
* @pre $none
* @post $none
*/
public abstract Cloudlet getNextFinishedCloudlet();
/**
* Returns the number of cloudlets runnning in the virtual machine.
* Returns the number of cloudlets running in the virtual machine.
*
* @return number of cloudlets runnning
* @return number of cloudlets running
* @pre $none
* @post $none
*/
......@@ -179,9 +185,10 @@ public abstract class CloudletScheduler {
public abstract Cloudlet migrateCloudlet();
/**
* Get utilization created by all cloudlets.
* Gets total CPU utilization percentage of all cloudlets, according to CPU UtilizationModel of
* each one.
*
* @param time the time
* @param time the time to get the current CPU utilization
* @return total utilization
*/
public abstract double getTotalUtilizationOfCpu(double time);
......@@ -194,20 +201,29 @@ public abstract class CloudletScheduler {
public abstract List<Double> getCurrentRequestedMips();
/**
* Gets the total current mips for the Cloudlet.
* Gets the total current available mips for the Cloudlet.
*
* @param rcl the rcl
* @param mipsShare the mips share
* @return the total current mips
* @todo In fact, this method is returning different data depending
* of the subclass. It is expected that the way the method use to compute
* the resulting value can be different in every subclass,
* but is not supposed that each subclass returns a complete different
* result for the same method of the superclass.
* In some class such as {@link NetworkCloudletSpaceSharedScheduler},
* the method returns the average MIPS for the available PEs,
* in other classes such as {@link CloudletSchedulerDynamicWorkload} it returns
* the MIPS' sum of all PEs.
*/
public abstract double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare);
/**
* Gets the total current requested mips for cloudlet.
* Gets the total current requested mips for a given cloudlet.
*
* @param rcl the rcl
* @param time the time
* @return the total current requested mips for cloudlet
* @return the total current requested mips for the given cloudlet
*/
public abstract double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time);
......
......@@ -16,56 +16,66 @@ import org.cloudbus.cloudsim.core.CloudSim;
/**
* CloudletSchedulerDynamicWorkload implements a policy of scheduling performed by a virtual machine
* assuming that there is just one cloudlet which is working as an online service.
* to run its {@link Cloudlet Cloudlets},
* assuming there is just one cloudlet which is working as an online service.
* It extends a TimeShared policy, but in fact, considering that there is just
* one cloudlet for the VM using this scheduler, the cloudlet will not
* compete for CPU with other ones.
* Each VM has to have its own instance of a CloudletScheduler.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
* @todo The name of the class doesn't represent its goal. A clearer name would be
* CloudletSchedulerSingleService as its Test Suite
*/
public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShared {
/** The mips. */
/** The individual MIPS capacity of each PE allocated to the VM using the scheduler,
* considering that all PEs have the same capacity.
* @todo Despite of the class considers that all PEs have the same capacity,
* it accepts a list of PEs with different MIPS at the method
* {@link #updateVmProcessing(double, java.util.List) }
*/
private double mips;
/** The number of PEs. */
/** The number of PEs allocated to the VM using the scheduler. */
private int numberOfPes;
/** The total mips. */
/** The total MIPS considering all PEs. */
private double totalMips;
/** The under allocated mips. */
/** The under allocated MIPS. */
private Map<String, Double> underAllocatedMips;
/** The cache previous time. */
/** The cache of the previous time when the {@link #getCurrentRequestedMips()} was called. */
private double cachePreviousTime;
/** The cache current requested mips. */
/** The cache of the last current requested MIPS.
* @see #getCurrentRequestedMips()
*/
private List<Double> cacheCurrentRequestedMips;
/**
* Instantiates a new vM scheduler time shared.
* Instantiates a new VM scheduler
*
* @param mips the mips
* @param numberOfPes the pes number
* @param mips The individual MIPS capacity of each PE allocated to the VM using the scheduler,
* considering that all PEs have the same capacity.
* @param numberOfPes The number of PEs allocated to the VM using the scheduler.
*/
public CloudletSchedulerDynamicWorkload(double mips, int numberOfPes) {
super();
setMips(mips);
setNumberOfPes(numberOfPes);
/*@todo There shouldn't be a setter to total mips, considering
that it is computed from number of PEs and mips.
If the number of pes of mips is set any time after here,
the total mips will be wrong. Just the getTotalMips is enough,
and it have to compute there the total, instead of storing into an attribute.*/
setTotalMips(getNumberOfPes() * getMips());
setUnderAllocatedMips(new HashMap<String, Double>());
setCachePreviousTime(-1);
}
/**
* Updates the processing of cloudlets running under management of this scheduler.
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each Pe available to the scheduler
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is
* no next events
* @pre currentTime >= 0
* @post $none
*/
@Override
public double updateVmProcessing(double currentTime, List<Double> mipsShare) {
setCurrentMipsShare(mipsShare);
......@@ -106,28 +116,11 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
return nextEvent;
}
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param cl the cl
* @return predicted completion time
* @pre _gl != null
* @post $none
*/
@Override
public double cloudletSubmit(Cloudlet cl) {
return cloudletSubmit(cl, 0);
}
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param cl the cl
* @param fileTransferTime the file transfer time
* @return predicted completion time
* @pre _gl != null
* @post $none
*/
@Override
public double cloudletSubmit(Cloudlet cl, double fileTransferTime) {
ResCloudlet rcl = new ResCloudlet(cl);
......@@ -141,13 +134,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
return getEstimatedFinishTime(rcl, getPreviousTime());
}
/**
* Processes a finished cloudlet.
*
* @param rcl finished cloudlet
* @pre rgl != $null
* @post $none
*/
@Override
public void cloudletFinish(ResCloudlet rcl) {
rcl.setCloudletStatus(Cloudlet.SUCCESS);
......@@ -155,12 +141,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
getCloudletFinishedList().add(rcl);
}
/**
* Get utilization created by all cloudlets.
*
* @param time the time
* @return total utilization
*/
@Override
public double getTotalUtilizationOfCpu(double time) {
double totalUtilization = 0;
......@@ -170,11 +150,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
return totalUtilization;
}
/**
* Gets the current mips.
*
* @return the current mips
*/
@Override
public List<Double> getCurrentRequestedMips() {
if (getCachePreviousTime() == getPreviousTime()) {
......@@ -194,25 +169,11 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
return currentMips;
}
/**
* Gets the current mips.
*
* @param rcl the rcl
* @param time the time
* @return the current mips
*/
@Override
public double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time) {
return rcl.getCloudlet().getUtilizationOfCpu(time) * getTotalMips();
}
/**
* Gets the total current mips for the clouddlet.
*
* @param rcl the rcl
* @param mipsShare the mips share
* @return the total current mips
*/
@Override
public double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare) {
double totalCurrentMips = 0.0;
......@@ -229,13 +190,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
return totalCurrentMips;
}
/**
* Gets the current mips.
*
* @param rcl the rcl
* @param time the time
* @return the current mips
*/
@Override
public double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time) {
double totalCurrentRequestedMips = getTotalCurrentRequestedMipsForCloudlet(rcl, time);
......@@ -251,6 +205,8 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param rcl the rgl
* @param mips the mips
* @todo It is not clear the goal of this method. The related test case
* doesn't make it clear too. The method doesn't appear to be used anywhere.
*/
public void updateUnderAllocatedMipsForCloudlet(ResCloudlet rcl, double mips) {
if (getUnderAllocatedMips().containsKey(rcl.getUid())) {
......@@ -260,9 +216,9 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Get estimated cloudlet completion time.
* Get the estimated completion time of a given cloudlet.
*
* @param rcl the rcl
* @param rcl the cloudlet
* @param time the time
* @return the estimated finish time
*/
......@@ -272,7 +228,8 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Gets the total current mips.
* Gets the total current mips available for the VM using the scheduler.
* The total is computed from the {@link #getCurrentMipsShare()}
*
* @return the total current mips
*/
......@@ -357,7 +314,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Gets the cache previous time.
* Gets the cache of previous time.
*
* @return the cache previous time
*/
......@@ -366,7 +323,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Sets the cache previous time.
* Sets the cache of previous time.
*
* @param cachePreviousTime the new cache previous time
*/
......@@ -375,7 +332,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Gets the cache current requested mips.
* Gets the cache of current requested mips.
*
* @return the cache current requested mips
*/
......@@ -384,7 +341,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
}
/**
* Sets the cache current requested mips.
* Sets the cache of current requested mips.
*
* @param cacheCurrentRequestedMips the new cache current requested mips
*/
......
......@@ -14,8 +14,9 @@ import java.util.List;
import org.cloudbus.cloudsim.core.CloudSim;
/**
* CloudletSchedulerSpaceShared implements a policy of scheduling performed by a virtual machine. It
* consider that there will be only one cloudlet per VM. Other cloudlets will be in a waiting list.
* CloudletSchedulerSpaceShared implements a policy of scheduling performed by a virtual machine
* to run its {@link Cloudlet Cloudlets}.
* It consider there will be only one cloudlet per VM. Other cloudlets will be in a waiting list.
* We consider that file transfer from cloudlets waiting happens before cloudlet execution. I.e.,
* even though cloudlets must wait for CPU, data transfer happens as soon as cloudlets are
* submitted.
......@@ -25,11 +26,12 @@ import org.cloudbus.cloudsim.core.CloudSim;
* @since CloudSim Toolkit 1.0
*/
public class CloudletSchedulerSpaceShared extends CloudletScheduler {
/** The current CPUs. */
/** The number of PEs currently available for the VM using the scheduler,
* according to the mips share provided to it by
* {@link #updateVmProcessing(double, java.util.List)} method. */
protected int currentCpus;
/** The used PEs. */
/** The number of used PEs. */
protected int usedPes;
/**
......@@ -45,16 +47,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
currentCpus = 0;
}
/**
* Updates the processing of cloudlets running under management of this scheduler.
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each processor available to the scheduler
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is
* no next events
* @pre currentTime >= 0
* @post $none
*/
@Override
public double updateVmProcessing(double currentTime, List<Double> mipsShare) {
setCurrentMipsShare(mipsShare);
......@@ -73,7 +65,8 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
// each machine in the exec list has the same amount of cpu
for (ResCloudlet rcl : getCloudletExecList()) {
rcl.updateCloudletFinishedSoFar((long) (capacity * timeSpam * rcl.getNumberOfPes() * Consts.MILLION));
rcl.updateCloudletFinishedSoFar(
(long) (capacity * timeSpam * rcl.getNumberOfPes() * Consts.MILLION));
}
// no more cloudlets in this scheduler
......@@ -131,14 +124,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return nextEvent;
}
/**
* Cancels execution of a cloudlet.
*
* @param cloudletId ID of the cloudlet being cancealed
* @return the canceled cloudlet, $null if not found
* @pre $none
* @post $none
*/
@Override
public Cloudlet cloudletCancel(int cloudletId) {
// First, looks in the finished queue
......@@ -183,14 +168,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
}
/**
* Pauses execution of a cloudlet.
*
* @param cloudletId ID of the cloudlet being paused
* @return $true if cloudlet paused, $false otherwise
* @pre $none
* @post $none
*/
@Override
public boolean cloudletPause(int cloudletId) {
boolean found = false;
......@@ -245,13 +222,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return false;
}
/**
* Processes a finished cloudlet.
*
* @param rcl finished cloudlet
* @pre rgl != $null
* @post $none
*/
@Override
public void cloudletFinish(ResCloudlet rcl) {
rcl.setCloudletStatus(Cloudlet.SUCCESS);
......@@ -260,14 +230,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
usedPes -= rcl.getNumberOfPes();
}
/**
* Resumes execution of a paused cloudlet.
*
* @param cloudletId ID of the cloudlet being resumed
* @return $true if the cloudlet was resumed, $false otherwise
* @pre $none
* @post $none
*/
@Override
public double cloudletResume(int cloudletId) {
boolean found = false;
......@@ -334,15 +296,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
}
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param cloudlet the submited cloudlet
* @param fileTransferTime time required to move the required files from the SAN to the VM
* @return expected finish time of this cloudlet, or 0 if it is in the waiting queue
* @pre gl != null
* @post $none
*/
@Override
public double cloudletSubmit(Cloudlet cloudlet, double fileTransferTime) {
// it can go to the exec list
......@@ -383,23 +336,11 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return cloudlet.getCloudletLength() / capacity;
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#cloudletSubmit(cloudsim.Cloudlet)
*/
@Override
public double cloudletSubmit(Cloudlet cloudlet) {
return cloudletSubmit(cloudlet, 0.0);
}
/**
* Gets the status of a cloudlet.
*
* @param cloudletId ID of the cloudlet
* @return status of the cloudlet, -1 if cloudlet not found
* @pre $none
* @post $none
*/
@Override
public int getCloudletStatus(int cloudletId) {
for (ResCloudlet rcl : getCloudletExecList()) {
......@@ -423,12 +364,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return -1;
}
/**
* Get utilization created by all cloudlets.
*
* @param time the time
* @return total utilization
*/
@Override
public double getTotalUtilizationOfCpu(double time) {
double totalUtilization = 0;
......@@ -438,25 +373,11 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return totalUtilization;
}
/**
* Informs about completion of some cloudlet in the VM managed by this scheduler.
*
* @return $true if there is at least one finished cloudlet; $false otherwise
* @pre $none
* @post $none
*/
@Override
public boolean isFinishedCloudlets() {
return getCloudletFinishedList().size() > 0;
}
/**
* Returns the next cloudlet in the finished list, $null if this list is empty.
*
* @return a finished cloudlet
* @pre $none
* @post $none
*/
@Override
public Cloudlet getNextFinishedCloudlet() {
if (getCloudletFinishedList().size() > 0) {
......@@ -465,24 +386,18 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return null;
}
/**
* Returns the number of cloudlets runnning in the virtual machine.
*
* @return number of cloudlets runnning
* @pre $none
* @post $none
*/
@Override
public int runningCloudlets() {
return getCloudletExecList().size();
}
/**
* Returns one cloudlet to migrate to another vm.
* Returns the first cloudlet to migrate to another vm.
*
* @return one running cloudlet
* @return the first running cloudlet
* @pre $none
* @post $none
* @todo it doesn't check if the list is empty
*/
@Override
public Cloudlet migrateCloudlet() {
......@@ -493,10 +408,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return cl;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getCurrentRequestedMips()
*/
@Override
public List<Double> getCurrentRequestedMips() {
List<Double> mipsShare = new ArrayList<Double>();
......@@ -508,14 +419,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) {
/*@todo The param rcl is not being used.*/
double capacity = 0.0;
int cpus = 0;
for (Double mips : mipsShare) { // count the cpus available to the vmm
......@@ -529,38 +435,30 @@ 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) {
public double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time) {
//@todo the method isn't in fact implemented
// 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 the method isn't in fact implemented
// TODO Auto-generated method stub
return 0.0;
}
@Override
public double getCurrentRequestedUtilizationOfRam() {
//@todo the method isn't in fact implemented
// TODO Auto-generated method stub
return 0;
}
@Override
public double getCurrentRequestedUtilizationOfBw() {
//@todo the method isn't in fact implemented
// TODO Auto-generated method stub
return 0;
}
......
......@@ -13,16 +13,19 @@ import java.util.List;
import org.cloudbus.cloudsim.core.CloudSim;
/**
* CloudletSchedulerTimeShared implements a policy of scheduling performed by a virtual machine.
* Cloudlets execute time-shared in VM.
* CloudletSchedulerTimeShared implements a policy of scheduling performed by a virtual machine
* to run its {@link Cloudlet Cloudlets}.
* Cloudlets execute in time-shared manner in VM.
* Each VM has to have its own instance of a CloudletScheduler.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
*/
public class CloudletSchedulerTimeShared extends CloudletScheduler {
/** The current cp us. */
/** The number of PEs currently available for the VM using the scheduler,
* according to the mips share provided to it by
* {@link #updateVmProcessing(double, java.util.List)} method. */
protected int currentCPUs;
/**
......@@ -37,16 +40,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
currentCPUs = 0;
}
/**
* Updates the processing of cloudlets running under management of this scheduler.
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each processor available to the scheduler
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is
* no next events
* @pre currentTime >= 0
* @post $none
*/
@Override
public double updateVmProcessing(double currentTime, List<Double> mipsShare) {
setCurrentMipsShare(mipsShare);
......@@ -92,10 +85,11 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
}
/**
* Gets the capacity.
* Gets the individual MIPS capacity available for each PE available for the scheduler,
* considering that all PEs have the same capacity.
*
* @param mipsShare the mips share
* @return the capacity
* @param mipsShare list with MIPS share of each PE available to the scheduler
* @return the capacity of each PE
*/
protected double getCapacity(List<Double> mipsShare) {
double capacity = 0.0;
......@@ -121,14 +115,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return capacity;
}
/**
* Cancels execution of a cloudlet.
*
* @param cloudletId ID of the cloudlet being cancealed
* @return the canceled cloudlet, $null if not found
* @pre $none
* @post $none
*/
@Override
public Cloudlet cloudletCancel(int cloudletId) {
boolean found = false;
......@@ -187,14 +173,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return null;
}
/**
* Pauses execution of a cloudlet.
*
* @param cloudletId ID of the cloudlet being paused
* @return $true if cloudlet paused, $false otherwise
* @pre $none
* @post $none
*/
@Override
public boolean cloudletPause(int cloudletId) {
boolean found = false;
......@@ -222,13 +200,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return false;
}
/**
* Processes a finished cloudlet.
*
* @param rcl finished cloudlet
* @pre rgl != $null
* @post $none
*/
@Override
public void cloudletFinish(ResCloudlet rcl) {
rcl.setCloudletStatus(Cloudlet.SUCCESS);
......@@ -236,14 +207,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
getCloudletFinishedList().add(rcl);
}
/**
* Resumes execution of a paused cloudlet.
*
* @param cloudletId ID of the cloudlet being resumed
* @return expected finish time of the cloudlet, 0.0 if queued
* @pre $none
* @post $none
*/
@Override
public double cloudletResume(int cloudletId) {
boolean found = false;
......@@ -276,15 +239,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return 0.0;
}
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param cloudlet the submited cloudlet
* @param fileTransferTime time required to move the required files from the SAN to the VM
* @return expected finish time of this cloudlet
* @pre gl != null
* @post $none
*/
@Override
public double cloudletSubmit(Cloudlet cloudlet, double fileTransferTime) {
ResCloudlet rcl = new ResCloudlet(cloudlet);
......@@ -304,23 +258,11 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return cloudlet.getCloudletLength() / getCapacity(getCurrentMipsShare());
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#cloudletSubmit(cloudsim.Cloudlet)
*/
@Override
public double cloudletSubmit(Cloudlet cloudlet) {
return cloudletSubmit(cloudlet, 0.0);
}
/**
* Gets the status of a cloudlet.
*
* @param cloudletId ID of the cloudlet
* @return status of the cloudlet, -1 if cloudlet not found
* @pre $none
* @post $none
*/
@Override
public int getCloudletStatus(int cloudletId) {
for (ResCloudlet rcl : getCloudletExecList()) {
......@@ -336,12 +278,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return -1;
}
/**
* Get utilization created by all cloudlets.
*
* @param time the time
* @return total utilization
*/
@Override
public double getTotalUtilizationOfCpu(double time) {
double totalUtilization = 0;
......@@ -351,25 +287,11 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return totalUtilization;
}
/**
* Informs about completion of some cloudlet in the VM managed by this scheduler.
*
* @return $true if there is at least one finished cloudlet; $false otherwise
* @pre $none
* @post $none
*/
@Override
public boolean isFinishedCloudlets() {
return getCloudletFinishedList().size() > 0;
}
/**
* Returns the next cloudlet in the finished list, $null if this list is empty.
*
* @return a finished cloudlet
* @pre $none
* @post $none
*/
@Override
public Cloudlet getNextFinishedCloudlet() {
if (getCloudletFinishedList().size() > 0) {
......@@ -378,25 +300,11 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return null;
}
/**
* Returns the number of cloudlets runnning in the virtual machine.
*
* @return number of cloudlets runnning
* @pre $none
* @post $none
*/
@Override
public int runningCloudlets() {
return getCloudletExecList().size();
}
/**
* Returns one cloudlet to migrate to another vm.
*
* @return one running cloudlet
* @pre $none
* @post $none
*/
@Override
public Cloudlet migrateCloudlet() {
ResCloudlet rgl = getCloudletExecList().remove(0);
......@@ -404,44 +312,27 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return rgl.getCloudlet();
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#getCurrentRequestedMips()
*/
@Override
public List<Double> getCurrentRequestedMips() {
List<Double> mipsShare = new ArrayList<Double>();
return mipsShare;
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#getTotalCurrentAvailableMipsForCloudlet(cloudsim.ResCloudlet,
* java.util.List)
*/
@Override
public double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare) {
return getCapacity(getCurrentMipsShare());
/*@todo It isn't being used any the the given parameters.*/
return getCapacity(getCurrentMipsShare());
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#getTotalCurrentAllocatedMipsForCloudlet(cloudsim.ResCloudlet,
* double)
*/
@Override
public double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time) {
//@todo The method is not implemented, in fact
return 0.0;
}
/*
* (non-Javadoc)
* @see cloudsim.CloudletScheduler#getTotalCurrentRequestedMipsForCloudlet(cloudsim.ResCloudlet,
* double)
*/
@Override
public double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time) {
//@todo The method is not implemented, in fact
// TODO Auto-generated method stub
return 0.0;
}
......
......@@ -14,21 +14,21 @@ public final class Consts {
}
/** One million. */
public static int MILLION = 1000000;
public static final int MILLION = 1000000;
// ================== Time constants ==================
/** One minute time in seconds. */
public static int MINUTE = 60;
public static final int MINUTE = 60;
/** One hour time in seconds. */
public static int HOUR = 60 * MINUTE;
public static final int HOUR = 60 * MINUTE;
/** One day time in seconds. */
public static int DAY = 24 * HOUR;
public static final int DAY = 24 * HOUR;
/** One week time in seconds. */
public static int WEEK = 24 * HOUR;
public static final int WEEK = 24 * HOUR;
// ================== OS constants ==================
/** Constant for *nix OS-es. */
/** Constant for *nix Operating Systems. */
public static final String NIX_OS = "Linux/Unix";
/** Constant for Windows OS-es. */
/** Constant for Windows Operating Systems. */
public static final String WINDOWS = "Windows";
}
......@@ -23,7 +23,7 @@ import org.cloudbus.cloudsim.lists.VmList;
/**
* DatacentreBroker represents a broker acting on behalf of a user. It hides VM management, as vm
* creation, sumbission of cloudlets to this VMs and destruction of VMs.
* creation, submission of cloudlets to this VMs and destruction of VMs.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
......@@ -31,50 +31,54 @@ import org.cloudbus.cloudsim.lists.VmList;
*/
public class DatacenterBroker extends SimEntity {
/** The vm list. */
/** The list of VMs submitted to be managed by the broker. */
protected List<? extends Vm> vmList;
/** The vms created list. */
/** The list of VMs created by the broker. */
protected List<? extends Vm> vmsCreatedList;
/** The cloudlet list. */
/** The list of cloudlet submitted to the broker.
* @see #submitCloudletList(java.util.List)
*/
protected List<? extends Cloudlet> cloudletList;
/** The cloudlet submitted list. */
/** The list of submitted cloudlets. */
protected List<? extends Cloudlet> cloudletSubmittedList;
/** The cloudlet received list. */
/** The list of received cloudlet. */
protected List<? extends Cloudlet> cloudletReceivedList;
/** The cloudlets submitted. */
/** The number of submitted cloudlets. */
protected int cloudletsSubmitted;
/** The vms requested. */
/** The number of requests to create VM. */
protected int vmsRequested;
/** The vms acks. */
/** The number of acknowledges (ACKs) sent in response to
* VM creation requests. */
protected int vmsAcks;
/** The vms destroyed. */
/** The number of destroyed VMs. */
protected int vmsDestroyed;
/** The datacenter ids list. */
/** The id's list of available datacenters. */
protected List<Integer> datacenterIdsList;
/** The datacenter requested ids list. */
/** The list of datacenters where was requested to place VMs. */
protected List<Integer> datacenterRequestedIdsList;
/** The vms to datacenters map. */
/** The vms to datacenters map, where each key is a VM id
* and each value is the datacenter id whwere the VM is placed. */
protected Map<Integer, Integer> vmsToDatacentersMap;
/** The datacenter characteristics list. */
/** The datacenter characteristics map where each key
* is a datacenter id and each value is its characteristics.. */
protected Map<Integer, DatacenterCharacteristics> datacenterCharacteristicsList;
/**
* Created a new DatacenterBroker object.
*
* @param name name to be associated with this entity (as required by Sim_entity class from
* simjava package)
* @param name name to be associated with this entity (as required by {@link SimEntity} class)
* @throws Exception the exception
* @pre name != null
* @post $none
......@@ -117,6 +121,13 @@ public class DatacenterBroker extends SimEntity {
* @param list the list
* @pre list !=null
* @post $none
*
* @todo The name of the method is confused with the {@link #submitCloudlets()},
* that in fact submit cloudlets to VMs. The term "submit" is being used
* ambiguously. The method {@link #submitCloudlets()} would be named "sendCloudletsToVMs"
*
* The method {@link #submitVmList(java.util.List)} may have
* be checked too.
*/
public void submitCloudletList(List<? extends Cloudlet> list) {
getCloudletList().addAll(list);
......@@ -173,7 +184,7 @@ public class DatacenterBroker extends SimEntity {
}
/**
* Process the return of a request for the characteristics of a PowerDatacenter.
* Process the return of a request for the characteristics of a Datacenter.
*
* @param ev a SimEvent object
* @pre ev != $null
......@@ -295,6 +306,8 @@ public class DatacenterBroker extends SimEntity {
* @param ev a SimEvent object
* @pre ev != null
* @post $none
* @todo to ensure the method will be overridden, it should be defined
* as abstract in a super class from where new brokers have to be extended.
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
......@@ -306,11 +319,12 @@ public class DatacenterBroker extends SimEntity {
}
/**
* Create the virtual machines in a datacenter.
* Create the submitted virtual machines in a datacenter.
*
* @param datacenterId Id of the chosen PowerDatacenter
* @param datacenterId Id of the chosen Datacenter
* @pre $none
* @post $none
* @see #submitVmList(java.util.List)
*/
protected void createVmsInDatacenter(int datacenterId) {
// send as much vms as possible for this datacenter before trying the next one
......@@ -336,6 +350,7 @@ public class DatacenterBroker extends SimEntity {
*
* @pre $none
* @post $none
* @see #submitCloudletList(java.util.List)
*/
protected void submitCloudlets() {
int vmIndex = 0;
......@@ -374,7 +389,7 @@ public class DatacenterBroker extends SimEntity {
}
/**
* Destroy the virtual machines running in datacenters.
* Destroy all virtual machines running in datacenters.
*
* @pre $none
* @post $none
......@@ -398,19 +413,11 @@ public class DatacenterBroker extends SimEntity {
sendNow(getId(), CloudSimTags.END_OF_SIMULATION);
}
/*
* (non-Javadoc)
* @see cloudsim.core.SimEntity#shutdownEntity()
*/
@Override
public void shutdownEntity() {
Log.printConcatLine(getName(), " is shutting down...");
}
/*
* (non-Javadoc)
* @see cloudsim.core.SimEntity#startEntity()
*/
@Override
public void startEntity() {
Log.printConcatLine(getName(), " is starting...");
......@@ -559,7 +566,8 @@ public class DatacenterBroker extends SimEntity {
}
/**
* Increment vms acks.
* Increment the number of acknowledges (ACKs) sent in response
* to requests of VM creation.
*/
protected void incrementVmsAcks() {
vmsAcks++;
......
......@@ -13,40 +13,47 @@ import java.util.Date;
import org.cloudbus.cloudsim.core.CloudSim;
/**
* A class for storing related information regarding to a {@link gridsim.datagrid.File} entity.
* Stores related information regarding to a {@link gridsim.datagrid.File} entity.
*
* @author Uros Cibej
* @author Anthony Sulistio
* @since CloudSim Toolkit 1.0
*
* @todo Some attributes of this class may be duplicated from the {@link File} class,
* such as name (logical file name), that is clearly related to the file.
* There would be a relation between File and FileAttribute. There is a lot of duplicated
* methods to, such as {@link #setMasterCopy(boolean)} or {@link #isReadOnly()}
*/
public class FileAttribute {
private String name; // logical file name
private String ownerName; // owner name of this file
private int id; // file ID given by a Replica Catalogue
private int type; // file type, e.g. raw, reconstructed, etc
private int size; // file size in byte
private int checksum; // check sum
private double lastUpdateTime; // last updated time (sec) - relative
private long creationTime; // creation time (ms) - abosulte/relative
private double cost; // price of this file
private boolean masterCopy; // false if it is a replica
private boolean readOnly; // false if it can be rewritten
private int resourceId; // resource ID storing this file
/** Logical file name. */
private String name;
/** Owner name of this file. */
private String ownerName;
/** File ID given by a Replica Catalogue. */
private int id;
/** File type, for instance raw, reconstructed, etc. */
private int type;
/** File size in byte. */
private int size;
/** Check sum. */
private int checksum;
/** Last updated time (sec) - relative. */
private double lastUpdateTime;
/** Creation time (ms) - abosulte/relative. */
private long creationTime;
/** Price of the file. */
private double cost;
/** Indicates if the file is a master copy or not.
* If the attribute is false, it means the file is a replica. */
private boolean masterCopy;
/** Indicates if the file is read-only or not. */
private boolean readOnly;
/** Resource ID storing this file. */
private int resourceId;
/**
* Allocates a new FileAttribute class.
* Creates a new FileAttribute object.
*
* @param fileName file name
* @param fileSize size of this file (in bytes)
......@@ -89,9 +96,9 @@ public class FileAttribute {
}
/**
* Copy the values of this object into another FileAttribute class
* Copy the values of the object into a given FileAttribute instance.
*
* @param attr a FileAttribute object (the destination)
* @param attr the destination FileAttribute object to copy the current object to
* @return <tt>true</tt> if the copy operation is successful, <tt>false</tt> otherwise
*/
public boolean copyValue(FileAttribute attr) {
......@@ -116,7 +123,7 @@ public class FileAttribute {
}
/**
* Sets the file creation time (in millisecond)
* Sets the file creation time (in millisecond).
*
* @param creationTime the file creation time (in millisecond)
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -131,7 +138,7 @@ public class FileAttribute {
}
/**
* Gets the file creation time (in millisecond)
* Gets the file creation time (in millisecond).
*
* @return the file creation time (in millisecond)
*/
......@@ -140,7 +147,7 @@ public class FileAttribute {
}
/**
* Sets the resource ID that stores this file
* Sets the resource ID that stores the file.
*
* @param resourceID a resource ID
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -155,7 +162,7 @@ public class FileAttribute {
}
/**
* Gets the resource ID that stores this file
* Gets the resource ID that stores the file.
*
* @return the resource ID
*/
......@@ -164,7 +171,7 @@ public class FileAttribute {
}
/**
* Sets the owner name of this file
* Sets the owner name of the file.
*
* @param name the owner name
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -179,7 +186,7 @@ public class FileAttribute {
}
/**
* Gets the owner name of this file
* Gets the owner name of the file.
*
* @return the owner name or <tt>null</tt> if empty
*/
......@@ -188,7 +195,7 @@ public class FileAttribute {
}
/**
* Gets the size of this object (in byte).<br>
* Gets the size of the object (in byte). <br/>
* NOTE: This object size is NOT the actual file size. Moreover, this size is used for
* transferring this object over a network.
*
......@@ -208,7 +215,7 @@ public class FileAttribute {
}
/**
* Sets the file size (in MBytes)
* Sets the file size (in MBytes).
*
* @param fileSize the file size (in MBytes)
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -223,7 +230,7 @@ public class FileAttribute {
}
/**
* Gets the file size (in MBytes)
* Gets the file size (in MBytes).
*
* @return the file size (in MBytes)
*/
......@@ -232,7 +239,7 @@ public class FileAttribute {
}
/**
* Gets the file size (in bytes)
* Gets the file size (in bytes).
*
* @return the file size (in bytes)
*/
......@@ -242,7 +249,7 @@ public class FileAttribute {
}
/**
* Sets the last update time of this file (in seconds)<br>
* Sets the last update time of the file (in seconds). <br/>
* NOTE: This time is relative to the start time. Preferably use
* {@link gridsim.CloudSim#clock()} method.
*
......@@ -259,7 +266,7 @@ public class FileAttribute {
}
/**
* Gets the last update time (in seconds)
* Gets the last update time (in seconds).
*
* @return the last update time (in seconds)
*/
......@@ -268,7 +275,7 @@ public class FileAttribute {
}
/**
* Sets the file registration ID (published by a Replica Catalogue entity)
* Sets the file registration ID (published by a Replica Catalogue entity).
*
* @param id registration ID
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -283,7 +290,7 @@ public class FileAttribute {
}
/**
* Gets the file registration ID
* Gets the file registration ID.
*
* @return registration ID
*/
......@@ -292,7 +299,7 @@ public class FileAttribute {
}
/**
* Sets the file type (e.g. raw, tag, etc)
* Sets the file type (for instance raw, tag, etc).
*
* @param type a file type
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -307,7 +314,7 @@ public class FileAttribute {
}
/**
* Gets this file type
* Gets the file type.
*
* @return file type
*/
......@@ -316,7 +323,7 @@ public class FileAttribute {
}
/**
* Sets the checksum of this file
* Sets the checksum of the file.
*
* @param checksum the checksum of this file
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -331,7 +338,7 @@ public class FileAttribute {
}
/**
* Gets the file checksum
* Gets the file checksum.
*
* @return file checksum
*/
......@@ -340,7 +347,7 @@ public class FileAttribute {
}
/**
* Sets the cost associated with this file
* Sets the cost associated with the file.
*
* @param cost cost of this file
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -355,7 +362,7 @@ public class FileAttribute {
}
/**
* Gets the cost associated with this file
* Gets the cost associated with the file.
*
* @return the cost of this file
*/
......@@ -364,7 +371,7 @@ public class FileAttribute {
}
/**
* Checks if this file already registered to a Replica Catalogue
* Checks if the file is already registered to a Replica Catalogue.
*
* @return <tt>true</tt> if it is registered, <tt>false</tt> otherwise
*/
......@@ -378,7 +385,7 @@ public class FileAttribute {
}
/**
* Marks this file as a master copy or replica
* Marks the file as a master copy or replica.
*
* @param masterCopy a flag denotes <tt>true</tt> for master copy or <tt>false</tt> for a
* replica
......@@ -388,7 +395,7 @@ public class FileAttribute {
}
/**
* Checks whether this file is a master copy or replica
* Checks whether the file is a master copy or replica.
*
* @return <tt>true</tt> if it is a master copy or <tt>false</tt> otherwise
*/
......@@ -397,7 +404,7 @@ public class FileAttribute {
}
/**
* Marks this file as a read only or not
* Marks this file as a read only or not.
*
* @param readOnly a flag denotes <tt>true</tt> for read only or <tt>false</tt> for re-writeable
*/
......@@ -406,7 +413,7 @@ public class FileAttribute {
}
/**
* Checks whether this file is a read only or not
* Checks whether this file is a read only or not.
*
* @return <tt>true</tt> if it is a read only or <tt>false</tt> otherwise
*/
......@@ -415,7 +422,7 @@ public class FileAttribute {
}
/**
* Sets the file name
* Sets the file name.
*
* @param name the file name
*/
......@@ -424,7 +431,7 @@ public class FileAttribute {
}
/**
* Returns the file name
* Returns the file name.
*
* @return the file name
*/
......
......@@ -15,13 +15,13 @@ import java.util.List;
import org.cloudbus.cloudsim.distributions.ContinuousDistribution;
/**
* An implementation of a storage system. It simulates the behaviour of a typical harddrive storage.
* The default values for this storage are those of a Maxtor DiamonMax 10 ATA harddisk with the
* An implementation of a storage system. It simulates the behavior of a typical hard drive storage.
* The default values for this storage are those of a "Maxtor DiamonMax 10 ATA" hard disk with the
* following parameters:
* <ul>
* <li>latency = 4.17 ms
* <li>avg seek time = 9 ms
* <li>max transfer rate = 133 MB/sec
* <li>latency = 4.17 ms</li>
* <li>avg seek time = 9 m/s</li>
* <li>max transfer rate = 133 MB/sec</li>
* </ul>
*
* @author Uros Cibej
......@@ -30,37 +30,37 @@ import org.cloudbus.cloudsim.distributions.ContinuousDistribution;
*/
public class HarddriveStorage implements Storage {
/** a list storing the names of all the files on the harddrive. */
/** A list storing the names of all files on the hard drive. */
private List<String> nameList;
/** a list storing all the files stored on the harddrive. */
/** A list storing all files stored on the hard drive. */
private List<File> fileList;
/** the name of the harddrive. */
/** The name of the hard drive. */
private final String name;
/** a generator required to randomize the seek time. */
/** A generator required to randomize the seek time. */
private ContinuousDistribution gen;
/** the current size of files on the harddrive. */
/** The current size of files on the hard drive. */
private double currentSize;
/** the total capacity of the harddrive in MB. */
/** The total capacity of the hard drive in MB. */
private final double capacity;
/** the maximum transfer rate in MB/sec. */
/** The maximum transfer rate in MB/sec. */
private double maxTransferRate;
/** the latency of the harddrive in seconds. */
/** The latency of the hard drive in seconds. */
private double latency;
/** the average seek time in seconds. */
/** The average seek time in seconds. */
private double avgSeekTime;
/**
* Creates a new harddrive storage with a given name and capacity.
* Creates a new hard drive storage with a given name and capacity.
*
* @param name the name of the new harddrive storage
* @param name the name of the new hard drive storage
* @param capacity the capacity in MByte
* @throws ParameterException when the name and the capacity are not valid
*/
......@@ -79,7 +79,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Creates a new harddrive storage with a given capacity. In this case the name of the storage
* Creates a new hard drive storage with a given capacity. In this case the name of the storage
* is a default name.
*
* @param capacity the capacity in MByte
......@@ -95,9 +95,9 @@ public class HarddriveStorage implements Storage {
}
/**
* The initialization of the harddrive is done in this method. The most common parameters, such
* The initialization of the hard drive is done in this method. The most common parameters, such
* as latency, average seek time and maximum transfer rate are set. The default values are set
* to simulate the Maxtor DiamonMax 10 ATA harddisk. Furthermore, the necessary lists are
* to simulate the "Maxtor DiamonMax 10 ATA" hard disk. Furthermore, the necessary lists are
* created.
*/
private void init() {
......@@ -135,7 +135,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Gets the number of files stored on this storage.
* Gets the number of files stored on this hard drive.
*
* @return the number of stored files
*/
......@@ -145,7 +145,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Makes a reservation of the space on the storage to store a file.
* Reserves space on the hard drive to store a file.
*
* @param fileSize the size to be reserved in MB
* @return <tt>true</tt> if reservation succeeded, <tt>false</tt> otherwise
......@@ -189,7 +189,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Checks whether there is enough space on the storage for a certain file.
* Checks whether there is enough space on the hard drive for a certain file.
*
* @param fileSize a FileAttribute object to compare to
* @return <tt>true</tt> if enough space available, <tt>false</tt> otherwise
......@@ -258,7 +258,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Sets the latency of this harddrive in seconds.
* Sets the latency of this hard drive in seconds.
*
* @param latency the new latency in seconds
* @return <tt>true</tt> if the setting succeeded, <tt>false</tt> otherwise
......@@ -273,7 +273,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Gets the latency of this harddrive in seconds.
* Gets the latency of this hard drive in seconds.
*
* @return the latency in seconds
*/
......@@ -336,7 +336,7 @@ public class HarddriveStorage implements Storage {
}
/**
* Gets the average seek time of the harddrive in seconds.
* Gets the average seek time of the hard drive in seconds.
*
* @return the average seek time in seconds
*/
......@@ -441,7 +441,7 @@ public class HarddriveStorage implements Storage {
/**
* Check if the file is valid or not. This method checks whether the given file or the file name
* of the file is valid. The method name parameter is used for debugging purposes, to output in
* which method an error has occured.
* which method an error has occurred.
*
* @param file the file to be checked for validity
* @param methodName the name of the method in which we check for validity of the file
......
......@@ -16,7 +16,8 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* Host executes actions related to management of virtual machines (e.g., creation and destruction).
* A Host is a Physical Machine (PM) inside a Datacenter. It is also called as a Server.
* It executes actions related to management of virtual machines (e.g., creation and destruction).
* A host has a defined policy for provisioning memory and bw, as well as an allocation policy for
* Pe's to virtual machines. A host is associated to a datacenter. It can host virtual machines.
*
......@@ -26,10 +27,10 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
*/
public class Host {
/** The id. */
/** The id of the host. */
private int id;
/** The storage. */
/** The storage capacity. */
private long storage;
/** The ram provisioner. */
......@@ -38,19 +39,20 @@ public class Host {
/** The bw provisioner. */
private BwProvisioner bwProvisioner;
/** The allocation policy. */
/** The allocation policy for scheduling VM execution. */
private VmScheduler vmScheduler;
/** The vm list. */
/** The list of VMs assigned to the host. */
private final List<? extends Vm> vmList = new ArrayList<Vm>();
/** The pe list. */
/** The Processing Elements (PEs) of the host, that
* represent the CPU cores of it, and thus, its processing capacity. */
private List<? extends Pe> peList;
/** Tells whether this machine is working properly or has failed. */
/** Tells whether this host is working properly or has failed. */
private boolean failed;
/** The vms migrating in. */
/** The VMs migrating in. */
private final List<Vm> vmsMigratingIn = new ArrayList<Vm>();
/** The datacenter where the host is placed. */
......@@ -59,10 +61,10 @@ public class Host {
/**
* Instantiates a new host.
*
* @param id the id
* @param id the host id
* @param ramProvisioner the ram provisioner
* @param bwProvisioner the bw provisioner
* @param storage the storage
* @param storage the storage capacity
* @param peList the pe list
* @param vmScheduler the vm scheduler
*/
......@@ -84,19 +86,26 @@ public class Host {
}
/**
* Requests updating of processing of cloudlets in the VMs running in this host.
* Requests updating of cloudlets' processing in VMs running in this host.
*
* @param currentTime the current time
* @return expected time of completion of the next cloudlet in all VMs in this host.
* Double.MAX_VALUE if there is no future events expected in this host
* @return expected time of completion of the next cloudlet in all VMs in this host or
* {@link Double#MAX_VALUE} if there is no future events expected in this host
* @pre currentTime >= 0.0
* @post $none
* @todo there is an inconsistency between the return value of this method
* and the individual call of {@link Vm#updateVmProcessing(double, java.util.List),
* and consequently the {@link CloudletScheduler#updateVmProcessing(double, java.util.List)}.
* The current method returns {@link Double#MAX_VALUE} while the other ones
* return 0. It has to be checked if there is a reason for this
* difference.}
*/
public double updateVmsProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
for (Vm vm : getVmList()) {
double time = vm.updateVmProcessing(currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
double time = vm.updateVmProcessing(
currentTime, getVmScheduler().getAllocatedMipsForVm(vm));
if (time > 0.0 && time < smallerTime) {
smallerTime = time;
}
......@@ -106,7 +115,7 @@ public class Host {
}
/**
* Adds the migrating in vm.
* Adds a VM migrating into the current host.
*
* @param vm the vm
*/
......@@ -149,7 +158,7 @@ public class Host {
}
/**
* Removes the migrating in vm.
* Removes a migrating in vm.
*
* @param vm the vm
*/
......@@ -162,7 +171,8 @@ public class Host {
}
/**
* Reallocate migrating in vms.
* Reallocate migrating in vms. Gets the VM in the migrating in queue
* and allocate them on the host.
*/
public void reallocateMigratingInVms() {
for (Vm vm : getVmsMigratingIn()) {
......@@ -180,7 +190,8 @@ public class Host {
}
/**
* Checks if is suitable for vm.
* Checks if the host is suitable for vm. If it has enough resources
* to attend the VM.
*
* @param vm the vm
* @return true, if is suitable for vm
......@@ -193,7 +204,7 @@ public class Host {
}
/**
* Allocates PEs and memory to a new VM in the Host.
* Try to allocate resources to a new VM in the Host.
*
* @param vm Vm being started
* @return $true if the VM could be started in the host; $false otherwise
......@@ -265,7 +276,7 @@ public class Host {
}
/**
* Deallocate all hostList for the VM.
* Deallocate all resources of a VM.
*
* @param vm the VM
*/
......@@ -277,7 +288,7 @@ public class Host {
}
/**
* Deallocate all hostList for the VM.
* Deallocate all resources of all VMs.
*/
protected void vmDeallocateAll() {
getRamProvisioner().deallocateRamForAllVms();
......@@ -286,7 +297,7 @@ public class Host {
}
/**
* Returns a VM object.
* Gets a VM by its id and user.
*
* @param vmId the vm id
* @param userId ID of VM's owner
......@@ -334,7 +345,7 @@ public class Host {
* Allocates PEs for a VM.
*
* @param vm the vm
* @param mipsShare the mips share
* @param mipsShare the list of MIPS share to be allocated to the VM
* @return $true if this policy allows a new VM in the host, $false otherwise
* @pre $none
* @post $none
......@@ -355,7 +366,7 @@ public class Host {
}
/**
* Returns the MIPS share of each Pe that is allocated to a given VM.
* Gets the MIPS share of each Pe that is allocated to a given VM.
*
* @param vm the vm
* @return an array containing the amount of MIPS of each pe that is available to the VM
......@@ -367,7 +378,7 @@ public class Host {
}
/**
* Gets the total allocated MIPS for a VM over all the PEs.
* Gets the total allocated MIPS for a VM along all its PEs.
*
* @param vm the vm
* @return the allocated mips for vm
......@@ -377,7 +388,7 @@ public class Host {
}
/**
* Returns maximum available MIPS among all the PEs.
* Returns the maximum available MIPS among all the PEs of the host.
*
* @return max mips
*/
......@@ -386,7 +397,7 @@ public class Host {
}
/**
* Gets the free mips.
* Gets the total free MIPS available at the host.
*
* @return the free mips
*/
......@@ -395,9 +406,9 @@ public class Host {
}
/**
* Gets the machine bw.
* Gets the host bw.
*
* @return the machine bw
* @return the host bw
* @pre $none
* @post $result > 0
*/
......@@ -406,9 +417,9 @@ public class Host {
}
/**
* Gets the machine memory.
* Gets the host memory.
*
* @return the machine memory
* @return the host memory
* @pre $none
* @post $result > 0
*/
......@@ -417,9 +428,9 @@ public class Host {
}
/**
* Gets the machine storage.
* Gets the host storage.
*
* @return the machine storage
* @return the host storage
* @pre $none
* @post $result >= 0
*/
......@@ -428,18 +439,18 @@ public class Host {
}
/**
* Gets the id.
* Gets the host id.
*
* @return the id
* @return the host id
*/
public int getId() {
return id;
}
/**
* Sets the id.
* Sets the host id.
*
* @param id the new id
* @param id the new host id
*/
protected void setId(int id) {
this.id = id;
......@@ -541,16 +552,16 @@ public class Host {
}
/**
* Checks if is failed.
* Checks if the host PEs have failed.
*
* @return true, if is failed
* @return true, if the host PEs have failed; false otherwise
*/
public boolean isFailed() {
return failed;
}
/**
* Sets the PEs of this machine to a FAILED status. NOTE: <tt>resName</tt> is used for debugging
* Sets the PEs of the host to a FAILED status. NOTE: <tt>resName</tt> is used for debugging
* purposes, which is <b>ON</b> by default. Use {@link #setFailed(boolean)} if you do not want
* this information.
*
......@@ -566,7 +577,7 @@ public class Host {
}
/**
* Sets the PEs of this machine to a FAILED status.
* Sets the PEs of the host to a FAILED status.
*
* @param failed the failed
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -579,7 +590,7 @@ public class Host {
}
/**
* Sets the particular Pe status on this Machine.
* Sets the particular Pe status on the host.
*
* @param peId the pe id
* @param status Pe status, either <tt>Pe.FREE</tt> or <tt>Pe.BUSY</tt>
......@@ -602,7 +613,7 @@ public class Host {
}
/**
* Gets the data center.
* Gets the data center of the host.
*
* @return the data center where the host runs
*/
......@@ -611,7 +622,7 @@ public class Host {
}
/**
* Sets the data center.
* Sets the data center of the host.
*
* @param datacenter the data center from this host
*/
......
......@@ -31,7 +31,7 @@ public class HostDynamicWorkload extends Host {
/** The previous utilization mips. */
private double previousUtilizationMips;
/** The state history. */
/** The host utilization state history. */
private final List<HostStateHistoryEntry> stateHistory = new LinkedList<HostStateHistoryEntry>();
/**
......@@ -56,10 +56,6 @@ public class HostDynamicWorkload extends Host {
setPreviousUtilizationMips(0);
}
/*
* (non-Javadoc)
* @see cloudsim.Host#updateVmsProcessing(double)
*/
@Override
public double updateVmsProcessing(double currentTime) {
double smallerTime = super.updateVmsProcessing(currentTime);
......@@ -140,7 +136,7 @@ public class HostDynamicWorkload extends Host {
}
/**
* Gets the completed vms.
* Gets the list of completed vms.
*
* @return the completed vms
*/
......@@ -158,26 +154,26 @@ public class HostDynamicWorkload extends Host {
}
/**
* Gets the max utilization among by all PEs.
* Gets the max utilization percentage among by all PEs.
*
* @return the utilization
* @return the maximum utilization percentage
*/
public double getMaxUtilization() {
return PeList.getMaxUtilization(getPeList());
}
/**
* Gets the max utilization among by all PEs allocated to the VM.
* Gets the max utilization percentage among by all PEs allocated to a VM.
*
* @param vm the vm
* @return the utilization
* @return the max utilization percentage of the VM
*/
public double getMaxUtilizationAmongVmsPes(Vm vm) {
return PeList.getMaxUtilizationAmongVmsPes(getPeList(), vm);
}
/**
* Gets the utilization of memory.
* Gets the utilization of memory (in absolute values).
*
* @return the utilization of memory
*/
......@@ -186,7 +182,7 @@ public class HostDynamicWorkload extends Host {
}
/**
* Gets the utilization of bw.
* Gets the utilization of bw (in absolute values).
*
* @return the utilization of bw
*/
......@@ -210,7 +206,7 @@ public class HostDynamicWorkload extends Host {
/**
* Gets the previous utilization of CPU in percentage.
*
* @return the previous utilization of cpu
* @return the previous utilization of cpu in percents
*/
public double getPreviousUtilizationOfCpu() {
double utilization = getPreviousUtilizationMips() / getTotalMips();
......@@ -224,15 +220,17 @@ public class HostDynamicWorkload extends Host {
* Get current utilization of CPU in MIPS.
*
* @return current utilization of CPU in MIPS
* @todo This method only calls the {@link #getUtilizationMips()}.
* getUtilizationMips may be deprecated and its code copied here.
*/
public double getUtilizationOfCpuMips() {
return getUtilizationMips();
}
/**
* Gets the utilization mips.
* Gets the utilization of CPU in MIPS.
*
* @return the utilization mips
* @return current utilization of CPU in MIPS
*/
public double getUtilizationMips() {
return utilizationMips;
......@@ -248,25 +246,25 @@ public class HostDynamicWorkload extends Host {
}
/**
* Gets the previous utilization mips.
* Gets the previous utilization of CPU in mips.
*
* @return the previous utilization mips
* @return the previous utilization of CPU in mips
*/
public double getPreviousUtilizationMips() {
return previousUtilizationMips;
}
/**
* Sets the previous utilization mips.
* Sets the previous utilization of CPU in mips.
*
* @param previousUtilizationMips the new previous utilization mips
* @param previousUtilizationMips the new previous utilization of CPU in mips
*/
protected void setPreviousUtilizationMips(double previousUtilizationMips) {
this.previousUtilizationMips = previousUtilizationMips;
}
/**
* Gets the state history.
* Gets the host state history.
*
* @return the state history
*/
......@@ -275,7 +273,7 @@ public class HostDynamicWorkload extends Host {
}
/**
* Adds the state history entry.
* Adds a host state history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
......
......@@ -9,7 +9,7 @@
package org.cloudbus.cloudsim;
/**
* The Class HostStateHistoryEntry.
* Stores historic data about a host.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.1.2
......@@ -25,11 +25,13 @@ public class HostStateHistoryEntry {
/** The requested mips. */
private double requestedMips;
/** The is active. */
/** Indicates if the host was active in the indicated time.
* @see #time
*/
private boolean isActive;
/**
* Instantiates a new vm mips allocation history entry.
* Instantiates a new host state history entry.
*
* @param time the time
* @param allocatedMips the allocated mips
......
......@@ -27,7 +27,7 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
* traverses the network topology similar to a {@link gridsim.net.NetPacket}, but it collects
* information like bandwidths, and Round Trip Time etc. It is the equivalent of ICMP in physical
* networks.
* <p>
* <p/>
* You can set all the parameters to an InfoPacket that can be applied to a NetPacket. So if you
* want to find out the kind of information that a particular type of NetPacket is experiencing, set
* the size and network class of an InfoPacket to the same as the NetPacket, and send it to the same
......@@ -42,10 +42,10 @@ public class InfoPacket implements Packet {
/** The packet name. */
private final String name;
/** The size of this packet. */
/** The size of the packet. */
private long size;
/** The id of this packet. */
/** The id of the packet. */
private final int packetId;
/** The original sender id. */
......@@ -57,7 +57,9 @@ public class InfoPacket implements Packet {
/** The last hop. */
private int last;
/** Whether going or returning. */
/** Whether the packet is going or returning, according to
* constants {@link CloudSimTags#INFOPKT_SUBMIT}
* and {@link CloudSimTags#INFOPKT_RETURN}. */
private int tag;
/** The number of hops. */
......@@ -66,25 +68,29 @@ public class InfoPacket implements Packet {
/** The original ping size. */
private long pingSize;
/** The level of service type. */
/** The level of service type.
@todo Is it the Type of Service (ToS) of IPv4, like in
the {@link Cloudlet#netToS}? If yes, so the names would
be standardized. */
private int netServiceType;
/** The bandwidth bottleneck. */
private double bandwidth;
/** The list of entity IDs. */
/** The list of entity IDs. The entities are elements
where the packet traverses, such as Routers or CloudResources. */
private Vector<Integer> entities;
/** The list of entry times. */
/** A list containing the time the packet arrived at every entity it has traversed */
private Vector<Double> entryTimes;
/** The list of exit times. */
private Vector<Double> exitTimes;
/** The list of entity's baud rate. */
/** The baud rate of each output link of entities where the packet traverses. */
private Vector<Double> baudRates;
/** The formatting the decimal points. */
/** The formatting for decimal points. */
private DecimalFormat num;
/**
......@@ -205,7 +211,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets relevant data from a list.
* Gets the data of a given index in a list.
*
* @param v a list
* @param index the location in a list
......@@ -227,7 +233,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets the size of this packet.
* Gets the size of the packet.
*
* @return size of the packet.
* @pre $none
......@@ -239,7 +245,7 @@ public class InfoPacket implements Packet {
}
/**
* Sets the size of this packet.
* Sets the size of the packet.
*
* @param size size of the packet
* @return <tt>true</tt> if it is successful, <tt>false</tt> otherwise
......@@ -269,7 +275,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets the id of the entity that sent out this packet.
* Gets the id of the entity that sent out the packet.
*
* @return the source ID
* @pre $none
......@@ -281,7 +287,7 @@ public class InfoPacket implements Packet {
}
/**
* Returns the number of hops that this packet has traversed. Since the packet takes a round
* Returns the number of hops that the packet has traversed. Since the packet takes a round
* trip, the same router may have been traversed twice.
*
* @return the number of hops this packet has traversed
......@@ -294,10 +300,11 @@ public class InfoPacket implements Packet {
}
/**
* Gets the total time that this packet has spent in the network. This is basically the RTT.
* Gets the total time that the packet has spent in the network.
* This is basically the Round-Trip-Time (RTT).
* Dividing this by half should be the approximate latency.
* <p>
* RTT is taken as the final entry time - first exit time.
* <p/>
* RTT is taken as the "final entry time" - "first exit time".
*
* @return total round time
* @pre $none
......@@ -332,8 +339,9 @@ public class InfoPacket implements Packet {
}
/**
* This method should be called by network entities that count as hops, for e.g. Routers or
* CloudResources. It should not be called by links etc.
* Add an entity where the InfoPacket traverses.
* This method should be called by network entities that count as hops,
* for instance Routers or CloudResources. It should not be called by links etc.
*
* @param id the id of the hop that this InfoPacket is traversing
* @pre id > 0
......@@ -349,12 +357,14 @@ public class InfoPacket implements Packet {
}
/**
* This method should be called by routers and other entities when this InfoPacket reaches them
* Register the time the packet arrives at an entity such as a Router or CloudResource.
* This method should be called by routers and other entities when the InfoPacket reaches them
* along with the current simulation time.
*
* @param time current simulation time, use {@link gridsim.CloudSim#clock()} to obtain this
* @pre time >= 0
* @post $none
*
*/
public void addEntryTime(double time) {
if (entryTimes == null) {
......@@ -369,7 +379,8 @@ public class InfoPacket implements Packet {
}
/**
* This method should be called by routers and other entities when this InfoPacket is leaving
* Register the time the packet leaves an entity such as a Router or CloudResource.
* This method should be called by routers and other entities when the InfoPacket is leaving
* them. It should also supply the current simulation time.
*
* @param time current simulation time, use {@link gridsim.CloudSim#clock()} to obtain this
......@@ -389,6 +400,8 @@ public class InfoPacket implements Packet {
}
/**
* Register the baud rate of the output link where the current entity that holds the InfoPacket
* will send it next.
* Every entity that the InfoPacket traverses should add the baud rate of the link on which this
* packet will be sent out next.
*
......@@ -428,6 +441,8 @@ public class InfoPacket implements Packet {
* @return an Integer Array of hop ids
* @pre $none
* @post $none
* @todo Why does not return an array of Integer (that is the type of the
* entities attribute)? In fact, this method does not appear to be used anywhere.
*/
public Object[] getDetailHops() {
if (entities == null) {
......@@ -438,11 +453,13 @@ public class InfoPacket implements Packet {
}
/**
* Returns the list of all entry time that this packet has traversed.
* Returns the list of all entry times that the packet has traversed.
*
* @return an Integer Array of entry time
* @pre $none
* @post $none
* @todo Why does not return an array of Double (that is the type of the
* entyTimes attribute)? In fact, this method does not appear to be used anywhere.
*/
public Object[] getDetailEntryTimes() {
if (entryTimes == null) {
......@@ -453,7 +470,7 @@ public class InfoPacket implements Packet {
}
/**
* Returns the list of all exit time that this packet has traversed.
* Returns the list of all exit times from all entities that the packet has traversed.
*
* @return an Integer Array of exit time
* @pre $none
......@@ -468,7 +485,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets an entity ID from the last hop that this packet has traversed.
* Gets the entity ID of the last hop that this packet has traversed.
*
* @return an entity ID
* @pre $none
......@@ -480,7 +497,7 @@ public class InfoPacket implements Packet {
}
/**
* Sets an entity ID from the last hop that this packet has traversed.
* Sets the entity ID of the last hop that this packet has traversed.
*
* @param last an entity ID from the last hop
* @pre last > 0
......@@ -492,7 +509,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets the network service type of this packet.
* Gets the network service type of the packet.
*
* @return the network service type
* @pre $none
......@@ -504,7 +521,7 @@ public class InfoPacket implements Packet {
}
/**
* Sets the network service type of this packet.
* Sets the network service type of the packet.
*
* @param netServiceType the packet's network service type
* @pre netServiceType >= 0
......@@ -516,7 +533,7 @@ public class InfoPacket implements Packet {
}
/**
* Gets this packet tag.
* Gets the packet tag.
*
* @return this packet tag
* @pre $none
......@@ -528,7 +545,7 @@ public class InfoPacket implements Packet {
}
/**
* Sets the tag of this packet.
* Sets the tag of the packet.
*
* @param tag the packet's tag
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
......@@ -553,7 +570,7 @@ public class InfoPacket implements Packet {
}
/**
* Sets the destination ID for this packet.
* Sets the destination ID for the packet.
*
* @param id this packet's destination ID
* @pre id > 0
......
......@@ -12,7 +12,7 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* The Log class used for performing logging of the simulation process. It provides the ability to
* Logger used for performing logging of the simulation process. It provides the ability to
* substitute the output stream by any OutputStream subclass.
*
* @author Anton Beloglazov
......@@ -23,17 +23,18 @@ public class Log {
/** The Constant LINE_SEPARATOR. */
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
/** The output. */
/** The stream where the log will the outputted. */
private static OutputStream output;
/** The disable output flag. */
/** Indicates if the logger is disabled or not. If set to true,
the call for any print method has no effect. */
private static boolean disabled;
/** Buffer to avoid creating new string builder upon every print. */
private static StringBuilder buffer = new StringBuilder();
/**
* Prints the message.
* Prints a message.
*
* @param message the message
*/
......@@ -59,7 +60,7 @@ public class Log {
}
/**
* Prints the line.
* Prints a message and a new line.
*
* @param message the message
*/
......@@ -70,7 +71,7 @@ public class Log {
}
/**
* Prints the empty line.
* Prints an empty line.
*/
public static void printLine() {
if (!isDisabled()) {
......@@ -80,7 +81,7 @@ public class Log {
/**
* Prints the concatenated text representation of the arguements.
* Prints the concatenated text representation of the arguments.
*
* @param messages the messages to print
*/
......@@ -95,7 +96,7 @@ public class Log {
}
/**
* Prints the concatenated text representation of the arguements and a new line.
* Prints the concatenated text representation of the arguments and a new line.
*
* @param messages the messages to print
*/
......@@ -112,7 +113,7 @@ public class Log {
/**
* Prints the line passed as a non-String object.
* Prints the message passed as a non-String object and a new line.
*
* @param message the message
*/
......@@ -137,7 +138,7 @@ public class Log {
}
/**
* Prints a line formated as in String.format().
* Prints a string formated as in String.format(), followed by a new line.
*
* @param format the format
* @param args the args
......@@ -149,7 +150,7 @@ public class Log {
}
/**
* Sets the output.
* Sets the output stream.
*
* @param _output the new output
*/
......@@ -158,7 +159,7 @@ public class Log {
}
/**
* Gets the output.
* Gets the output stream.
*
* @return the output
*/
......
......@@ -20,12 +20,13 @@ import org.cloudbus.cloudsim.network.TopologicalLink;
import org.cloudbus.cloudsim.network.TopologicalNode;
/**
* NetworkTopology is a class that implements network layer in CloudSim. It reads a BRITE file and
* Implements the network layer in CloudSim. It reads a file in the <a href="http://www.cs.bu.edu/brite/user_manual/node29.html">BRITE format</a>,
* the <a href="http://www.cs.bu.edu/brite/">Boston university Representative Topology gEnerator</a>, and
* generates a topological network from it. Information of this network is used to simulate latency
* in network traffic of CloudSim.
* <p>
* The topology file may contain more nodes the the number of entities in the simulation. It allows
* for users to increase the scale of the simulation without changing the topology file.
* <p/>
* The topology file may contain more nodes than the number of entities in the simulation. It allows
* users to increase the scale of the simulation without changing the topology file.
* Nevertheless, each CloudSim entity must be mapped to one (and only one) BRITE node to allow
* proper work of the network simulation. Each BRITE node can be mapped to only one entity at a
* time.
......@@ -33,6 +34,10 @@ import org.cloudbus.cloudsim.network.TopologicalNode;
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
*
* @todo The class only have static methods, that indicates it doesn't have to be instantiated.
* In fact, it doesn't appear it is being instantiated anywhere.
* A private default constructor would be created to avoid instantiation.
*/
public class NetworkTopology {
......@@ -42,15 +47,23 @@ public class NetworkTopology {
protected static DelayMatrix_Float delayMatrix = null;
/**
* A matrix containing the bandwidth between every pair of nodes in the network.
*/
protected static double[][] bwMatrix = null;
protected static TopologicalGraph graph = null;
protected static Map<Integer, Integer> map = null;
/**
* The map between CloudSim entities and BRITE entities.
* Each key is a CloudSim entity ID and each value the corresponding
* BRITE entity ID.
*/
protected static Map<Integer, Integer> map = null;
/**
* Creates the network topology if file exists and if file can be succesfully parsed. File is
* written in the BRITE format and contains topologycal information on simulation entities.
* Creates the network topology if the file exists and can be successfully parsed. File is
* written in the BRITE format and contains topological information on simulation entities.
*
* @param fileName name of the BRITE file
* @pre fileName != null
......@@ -75,7 +88,7 @@ public class NetworkTopology {
}
/**
* Generates the matrices used internally to set latency and bandwidth between elements
* Generates the matrices used internally to set latency and bandwidth between elements.
*/
private static void generateMatrices() {
// creates the delay matrix
......@@ -88,10 +101,12 @@ public class NetworkTopology {
}
/**
* Adds a new link in the network topology
* Adds a new link in the network topology.
* The CloudSim entities that represent the source and destination of the link
* will be mapped to the BRITE entity.
*
* @param srcId ID of the link's source
* @param destId ID of the link's destination
* @param srcId ID of the CloudSim entity that represents the link's source node
* @param destId ID of the CloudSim entity that represents the link's destination node
* @param bw Link's bandwidth
* @param lat link's latency
* @pre srcId > 0
......@@ -129,7 +144,7 @@ public class NetworkTopology {
}
/**
* Creates the matrix containiing the available bandiwdth beteen two nodes
* Creates the matrix containing the available bandwidth between every pair of nodes.
*
* @param graph topological graph describing the topology
* @param directed true if the graph is directed; false otherwise
......@@ -162,7 +177,7 @@ public class NetworkTopology {
}
/**
* Maps a CloudSim entity to a node in the network topology
* Maps a CloudSim entity to a BRITE node in the network topology.
*
* @param cloudSimEntityID ID of the entity being mapped
* @param briteID ID of the BRITE node that corresponds to the CloudSim entity
......@@ -192,7 +207,7 @@ public class NetworkTopology {
}
/**
* Unmaps a previously mapped CloudSim entity to a node in the network topology
* Unmaps a previously mapped CloudSim entity to a BRITE node in the network topology.
*
* @param cloudSimEntityID ID of the entity being unmapped
* @pre cloudSimEntityID >= 0
......@@ -209,10 +224,10 @@ public class NetworkTopology {
}
/**
* Calculates the delay between two nodes
* Calculates the delay between two CloudSim nodes.
*
* @param srcID ID of the source node
* @param destID ID of the destination node
* @param srcID ID of the CloudSim entity that represents the link's source node
* @param destID ID of the CloudSim entity that represents the link's destination node
* @return communication delay between the two nodes
* @pre srcID >= 0
* @pre destID >= 0
......
......@@ -15,7 +15,7 @@
package org.cloudbus.cloudsim;
/**
* This class contains the structure for a network packet.
* Defines the structure for a network packet.
*
* @author Gokul Poduval
* @author Chen-Khong Tham, National University of Singapore
......@@ -85,6 +85,10 @@ public interface Packet {
* @return the network service type
* @pre $none
* @post $none
*
* @todo Is it the Type of Service (ToS) of IPv4, like in
* the {@link Cloudlet#netToS}? If yes, so the names would
* be standardized.
*/
int getNetServiceType();
......
......@@ -22,6 +22,7 @@ package org.cloudbus.cloudsim;
* @author Gokul Poduval
* @author Chen-Khong Tham, National University of Singapore
* @since CloudSim Toolkit 1.0
* @todo It would be used the native class InvalidArgumentException instead of this new one.
*/
public class ParameterException extends Exception {
......
......@@ -11,9 +11,11 @@ package org.cloudbus.cloudsim;
import org.cloudbus.cloudsim.provisioners.PeProvisioner;
/**
* CloudSim Pe (Processing Element) class represents CPU unit, defined in terms of Millions
* Pe (Processing Element) class represents a CPU core, defined in terms of Millions
* Instructions Per Second (MIPS) rating.<br>
* <b>ASSUMPTION:<b> All PEs under the same Machine have the same MIPS rating.
* @todo This assumption is not being assured on different class (where other TODOs where introduced)
* @todo Pe statuses have to be defined using an enum
*
* @author Manzur Murshed
* @author Rajkumar Buyya
......@@ -24,7 +26,7 @@ public class Pe {
/** Denotes Pe is FREE for allocation. */
public static final int FREE = 1;
/** Denotes Pe is allocated and hence busy in processing Cloudlet. */
/** Denotes Pe is allocated and hence busy processing some Cloudlet. */
public static final int BUSY = 2;
/**
......@@ -33,10 +35,9 @@ public class Pe {
*/
public static final int FAILED = 3;
/** The id. */
/** The Pe id. */
private int id;
// FOR SPACE SHARED RESOURCE: Jan 21
/** The status of Pe: FREE, BUSY, FAILED: . */
private int status;
......@@ -44,7 +45,7 @@ public class Pe {
private PeProvisioner peProvisioner;
/**
* Allocates a new Pe object.
* Instantiates a new Pe object.
*
* @param id the Pe ID
* @param peProvisioner the pe provisioner
......
......@@ -74,14 +74,14 @@ public interface Storage {
boolean isFull();
/**
* Gets the number of files stored on this storage.
* Gets the number of files stored on this device.
*
* @return the number of stored files
*/
int getNumStoredFile();
/**
* Makes a reservation of the space on the storage to store a file.
* Makes reservation of space on the storage to store a file.
*
* @param fileSize the size to be reserved in MB
* @return <tt>true</tt> if reservation succeeded, <tt>false</tt> otherwise
......
......@@ -289,7 +289,7 @@ public class CloudSim {
}
/**
* Sends a request to Cloud Information Service (GIS) entity to get the list of all Cloud
* Sends a request to Cloud Information Service (CIS) entity to get the list of all Cloud
* hostList.
*
* @return A List containing CloudResource ID (as an Integer object) or if a CIS entity hasn't
......
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