Commit 20a7a55e authored by Nikolay's avatar Nikolay

Merge pull request #78 from manoelcampos/master

A comprehensive review and improvement of the entire project documentation
parents e4a0b0a6 817a6782
/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,7 +119,7 @@ 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();
......
......@@ -66,7 +66,14 @@
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
<type>jar</type>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
......
......@@ -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,19 @@ 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 +409,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 +420,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 +436,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) {
//@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,14 +278,11 @@ 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) {
/*
* @todo
*/
double totalUtilization = 0;
for (ResCloudlet gl : getCloudletExecList()) {
totalUtilization += gl.getCloudlet().getUtilizationOfCpu(time);
......@@ -351,25 +290,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 +303,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 +315,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) {
/*@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 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);
......@@ -135,13 +146,6 @@ public class DatacenterBroker extends SimEntity {
CloudletList.getById(getCloudletList(), cloudletId).setVmId(vmId);
}
/**
* Processes events available for this Broker.
*
* @param ev a SimEvent object
* @pre ev != null
* @post $none
*/
@Override
public void processEvent(SimEvent ev) {
switch (ev.getTag()) {
......@@ -173,7 +177,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
......@@ -289,12 +293,16 @@ public class DatacenterBroker extends SimEntity {
}
/**
* Overrides this method when making a new and different type of Broker. This method is called
* by {@link #body()} for incoming unknown tags.
* Process non-default received events that aren't processed by
* the {@link #processEvent(org.cloudbus.cloudsim.core.SimEvent)} method.
* This method should be overridden by subclasses in other to process
* new defined events.
*
* @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 +314,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 +345,7 @@ public class DatacenterBroker extends SimEntity {
*
* @pre $none
* @post $none
* @see #submitCloudletList(java.util.List)
*/
protected void submitCloudlets() {
int vmIndex = 0;
......@@ -374,7 +384,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 +408,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 +561,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
*/
......
......@@ -18,7 +18,7 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* The class of a host supporting dynamic workloads and performance degradation.
* A host supporting dynamic workloads and performance degradation.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......@@ -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>();
/**
......@@ -40,8 +40,8 @@ public class HostDynamicWorkload extends Host {
* @param id the id
* @param ramProvisioner the ram provisioner
* @param bwProvisioner the bw provisioner
* @param storage the storage
* @param peList the pe list
* @param storage the storage capacity
* @param peList the host's PEs list
* @param vmScheduler the VM scheduler
*/
public HostDynamicWorkload(
......@@ -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
......
......@@ -12,28 +12,31 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* The Log class used for performing loggin 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
* @since CloudSim Toolkit 2.0
* @todo To add a method to print formatted text, such as the
* {@link String#format(java.lang.String, java.lang.Object...)} method.
*/
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 +62,7 @@ public class Log {
}
/**
* Prints the line.
* Prints a message and a new line.
*
* @param message the message
*/
......@@ -70,7 +73,7 @@ public class Log {
}
/**
* Prints the empty line.
* Prints an empty line.
*/
public static void printLine() {
if (!isDisabled()) {
......@@ -80,7 +83,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 +98,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 +115,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 +140,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 +152,7 @@ public class Log {
}
/**
* Sets the output.
* Sets the output stream.
*
* @param _output the new output
*/
......@@ -158,7 +161,7 @@ public class Log {
}
/**
* Gets the output.
* Gets the output stream.
*
* @return the output
*/
......
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