Commit f44af2e2 authored by Manoel Campos's avatar Manoel Campos

Documentation of package org.cloudbus.cloudsim.network.datacenter improved.

Removed '(non-Javadoc)' comments of methods. These comments were used in overloaded methods, but
in fact, they don’t help in anything. They weren’t in javadoc format and have no effect.
And after all, when there isn't a javadoc in an overloaded method, the javadoc of the method in the 
super class is shown.

Inserted links to papers cited in several classes.
parent a48834e3
......@@ -56,8 +56,7 @@ public class Datacenter extends SimEntity {
/** The vm list. */
private List<? extends Vm> vmList;
/** The scheduling interval.
* @todo It is not exactly clear the goal of this attribute */
/** The scheduling delay to process each datacenter received event. */
private double schedulingInterval;
/**
......@@ -67,11 +66,12 @@ public class Datacenter extends SimEntity {
* @param characteristics the characteristics of the datacenter to be created
* @param storageList a List of storage elements, for data simulation
* @param vmAllocationPolicy the policy to be used to allocate VMs into hosts
* @param schedulingInterval the scheduling delay to process each datacenter received event
* @throws Exception when one of the following scenarios occur:
* <ul>
* <li>creating this entity before initializing CloudSim package
* <li>this entity name is <tt>null</tt> or empty
* <li>this entity has <tt>zero</tt> number of PEs (Processing Elements). <br>
* <li>this entity has <tt>zero</tt> number of PEs (Processing Elements). <br/>
* No PEs mean the Cloudlets can't be processed. A CloudResource must contain
* one or more Machines. A Machine must contain one or more PEs.
* </ul>
......@@ -418,13 +418,15 @@ public class Datacenter extends SimEntity {
}
/**
* Receives every VM request and forward each one to the related processing method.
* 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 information about the event just happened
*
* @pre $none
* @post $none
* @todo This method doesn't appear to be used and, in fact, it does nothing.
*/
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
......
......@@ -300,8 +300,10 @@ 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
......
......@@ -190,21 +190,12 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
this.freePes = freePes;
}
/*
* (non-Javadoc)
* @see cloudsim.VmAllocationPolicy#optimizeAllocation(double, cloudsim.VmList, double)
*/
@Override
public List<Map<String, Object>> optimizeAllocation(List<? extends Vm> vmList) {
// TODO Auto-generated method stub
return null;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#allocateHostForVm(org.cloudbus.cloudsim.Vm,
* org.cloudbus.cloudsim.Host)
*/
@Override
public boolean allocateHostForVm(Vm vm, Host host) {
if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
......
......@@ -242,8 +242,10 @@ public class CloudInformationService extends SimEntity {
// //////////////////////// PROTECTED METHODS ////////////////////////////
/**
* This method needs to override by child classes for processing other events. These events are
* based on tags that are not mentioned in {@link #body()} method.
* 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
......
......@@ -316,7 +316,9 @@ public class CloudSim {
/** The deferred event queue. */
protected static DeferredQueue deferred;
/** The simulation clock. */
/**
* The current simulation clock.
*/
private static double clock;
/** Flag for checking if the simulation is running. */
......@@ -505,6 +507,9 @@ public class CloudSim {
* called in simulations.
*
* @return true, if successful otherwise
* @todo If the method shouldn't be called by the user,
* it should be protected in any way, such as changing
* its visibility to package.
*/
public static boolean runClockTick() {
SimEntity ent;
......
......@@ -18,27 +18,28 @@ import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
/**
* This class allows to simulate aggregate switch for Datacenter network. It interacts with other
* switches in order to exchange packets.
* This class represents an Aggregate Switch in a Datacenter network.
* It interacts with other switches in order to exchange packets.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
*
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
*/
public class AggregateSwitch extends Switch {
/**
* Constructor for Aggregate Switch We have to specify switches that are connected to its
* downlink and uplink ports, and corresponding bandwidths
* Instantiates a Aggregate Switch specifying the switches that are connected to its
* downlink and uplink ports and corresponding bandwidths.
*
* @param name Name of the switch
* @param level At which level switch is with respect to hosts.
* @param dc Pointer to Datacenter
* @param level At which level the switch is with respect to hosts.
* @param dc The Datacenter where the switch is connected to
*/
public AggregateSwitch(String name, int level, NetworkDatacenter dc) {
super(name, level, dc);
......@@ -52,12 +53,6 @@ public class AggregateSwitch extends Switch {
downlinkswitches = new ArrayList<Switch>();
}
/**
* Send Packet to switch connected through a downlink port
*
* @param ev Event/packet to process
*/
@Override
protected void processpacket_down(SimEvent ev) {
// packet coming from up level router.
......@@ -85,11 +80,6 @@ public class AggregateSwitch extends Switch {
}
/**
* Send Packet to switch connected through a uplink port
*
* @param ev Event/packet to process
*/
@Override
protected void processpacket_up(SimEvent ev) {
// packet coming from down level router.
......
......@@ -16,56 +16,96 @@ import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.core.CloudSim;
/**
* AppCloudlet class represents an application which user submit for execution within datacenter. It
* consist of several networkClouds.
* AppCloudlet class represents an application which user submit for execution within a datacenter. It
* consist of several {@link NetworkCloudlet NetworkCloudlets}.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
*
* @todo If it is an application/cloudlet, it would extend the Cloudlet class.
* In the case of Cloudlet class has more attributes and methods than
* required by this class, a common interface would be created.
*
* @todo The attributes have to be defined as private.
*/
public class AppCloudlet {
public static final int APP_MC = 1;
public static final int APP_Workflow = 3;
public AppCloudlet(int type, int appID, double deadline, int numbervm, int userId) {
super();
this.type = type;
this.appID = appID;
this.deadline = deadline;
this.numbervm = numbervm;
this.userId = userId;
clist = new ArrayList<NetworkCloudlet>();
}
public int type;
public int appID;
/**
* The list of {@link NetworkCloudlet} that this AppCloudlet represents.
*/
public ArrayList<NetworkCloudlet> clist;
/**
* This attribute doesn't appear to be used.
* Only the TestBagofTaskApp class is using it
* and such a class appears to be used only for not
* documented test (it is not a unit test).
*/
public double deadline;
/**
* This attribute doesn't appear to be used.
*/
public double accuracy;
/**
* Number of VMs the AppCloudlet can use.
* @todo the attribute would be renamed to numberOfVMs or something
* like that.
*/
public int numbervm;
/**
* Id of the AppCloudlet's owner.
*/
public int userId;
/**
* @todo It would be "execTime". This attribute is very strange.
* The the todo in the TestBagofTaskApp class.
*/
public double exeTime;
/**
* This attribute doesn't appear to be used.
*/
public int requestclass;
public static final int APP_MC = 1;
public static final int APP_Workflow = 3;
public AppCloudlet(int type, int appID, double deadline, int numbervm, int userId) {
super();
this.type = type;
this.appID = appID;
this.deadline = deadline;
this.numbervm = numbervm;
this.userId = userId;
clist = new ArrayList<NetworkCloudlet>();
}
/**
* An example of creating APPcloudlet
*
* @param vmIdList VMs where Cloudlet will be executed
* @todo This method is very strange too. It creates the internal cloudlet list
* with cloudlets of hard-coded defined attributes, such as
* fileSize, outputSize and length, what doesn't make sense.
* If this class is to be an example, it should be
* inside the example package. As an example, it make senses the
* hard-coded values.
*/
public void createCloudletList(List<Integer> vmIdList) {
for (int i = 0; i < numbervm; i++) {
......
......@@ -20,14 +20,15 @@ import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
/**
* This class allows to simulate Edge switch for Datacenter network. It interacts with other
* switches in order to exchange packets.
* This class represents an Edge Switch in a Datacenter network.
* It interacts with other switches in order to exchange packets.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
......@@ -35,13 +36,13 @@ import org.cloudbus.cloudsim.core.predicates.PredicateType;
public class EdgeSwitch extends Switch {
/**
* Constructor for Edge Switch We have to specify switches that are connected to its downlink
* and uplink ports, and corresponding bandwidths. In this switch downlink ports are connected
* to hosts not to a switch.
* Instantiates a EdgeSwitch specifying switches that are connected to its downlink
* and uplink ports, and corresponding bandwidths.
* In this switch, downlink ports aren't connected to other switch but to hosts.
*
* @param name Name of the switch
* @param level At which level switch is with respect to hosts.
* @param dc Pointer to Datacenter
* @param level At which level the switch is with respect to hosts.
* @param dc The Datacenter where the switch is connected to
*/
public EdgeSwitch(String name, int level, NetworkDatacenter dc) {
super(name, level, dc);
......@@ -55,11 +56,6 @@ public class EdgeSwitch extends Switch {
uplinkswitches = new ArrayList<Switch>();
}
/**
* Send Packet to switch connected through a uplink port
*
* @param ev Event/packet to process
*/
@Override
protected void processpacket_up(SimEvent ev) {
// packet coming from down level router/host.
......@@ -108,11 +104,6 @@ public class EdgeSwitch extends Switch {
}
/**
* Send Packet to hosts connected to the switch
*
* @param ev Event/packet to process
*/
@Override
protected void processpacketforward(SimEvent ev) {
// search for the host and packets..send to them
......
......@@ -9,19 +9,55 @@
package org.cloudbus.cloudsim.network.datacenter;
/**
* HostPacket represents the packet that travels through the virtual network with a Host. It
* contains information about cloudlets which are communicating
* HostPacket represents the packet that travels through the virtual network within a Host.
* It contains information about cloudlets which are communicating.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @todo Attributes should be private
*/
public class HostPacket {
/**
* Id of the sender VM.
*/
int sender;
/**
* Id of the receiver VM.
*/
int reciever;
/**
* Id of the sender cloudlet.
*/
int virtualsendid;
/**
* Id of the receiver cloudlet.
*/
int virtualrecvid;
/**
* The length of the data being sent (in bytes).
*/
double data;
/**
* The time the packet was sent.
*/
double sendtime;
/**
* The time the packet was received.
*/
double recievetime;
public HostPacket(
int sender,
......@@ -40,18 +76,4 @@ public class HostPacket {
virtualrecvid = vrvd;
virtualsendid = vsnd;
}
int sender;
int virtualrecvid;
int virtualsendid;
int reciever;
double data;
double sendtime;
double recievetime;
}
......@@ -27,58 +27,72 @@ import org.cloudbus.cloudsim.lists.VmList;
/**
* NetDatacentreBroker represents a broker acting on behalf of Datacenter provider. It hides VM
* management, as vm creation, submission of cloudlets to this VMs and destruction of VMs. NOTE- It
* is an example only. It work on behalf of a provider not for users. One has to implement
* interaction with user broker to this broker.
* management, as vm creation, submission of cloudlets to these VMs and destruction of VMs. <br/>
* <tt>NOTE</tt>: This class is an example only. It works on behalf of a provider not for users.
* One has to implement interaction with user broker to this broker.
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
* @todo The class is not a broker acting on behalf of users, but on behalf
* of a provider. Maybe this distinction would be explicit by
* different class hierarchy, such as UserDatacenterBroker and ProviderDatacenterBroker.
*/
public class NetDatacenterBroker extends SimEntity {
// TODO: remove unnecessary variables
/** The vm list. */
/** The list of submitted VMs. */
private List<? extends Vm> vmList;
/** The vms created list. */
/** The list of created VMs. */
private List<? extends Vm> vmsCreatedList;
/** The cloudlet list. */
/** The list of submitted {@link NetworkCloudlet NetworkCloudlets}. */
private List<? extends NetworkCloudlet> cloudletList;
/** The list of submitted {@link AppCloudlet AppCloudlets}. */
private List<? extends AppCloudlet> appCloudletList;
/** The Appcloudlet submitted list. */
/** The list of submitted {@link AppCloudlet AppCloudlets}.
* @todo attribute appears to be redundant with {@link #appCloudletList}
*/
private final Map<Integer, Integer> appCloudletRecieved;
/** The list of submitted {@link Cloudlet Cloudlets}.
*/
private List<? extends Cloudlet> cloudletSubmittedList;
/** The cloudlet received list. */
/** The list of received {@link Cloudlet Cloudlets}.
* @todo attribute appears to be redundant with {@link #cloudletSubmittedList}
*/
private List<? extends Cloudlet> cloudletReceivedList;
/** The cloudlets submitted. */
/** The number of submitted cloudlets. */
private int cloudletsSubmitted;
/** The vms requested. */
/** The number of VMs requested. */
private int vmsRequested;
/** The vms acks. */
/** The acks sent to VMs. */
private int vmsAcks;
/** The vms destroyed. */
/** The number of VMs destroyed. */
private int vmsDestroyed;
/** The datacenter ids list. */
/** The list of datacenter IDs. */
private List<Integer> datacenterIdsList;
/** The datacenter requested ids list. */
/** The datacenter requested IDs list.
* @todo attribute appears to be redundant with {@link #datacenterIdsList}
*/
private List<Integer> datacenterRequestedIdsList;
/** The vms to datacenters map. */
/** The VMs to datacenters map where each key is a VM id
* and the corresponding value is the datacenter where the VM is placed. */
private Map<Integer, Integer> vmsToDatacentersMap;
/** The datacenter characteristics list. */
/** The datacenter characteristics map where each key
* is the datacenter id and each value is the datacenter itself. */
private Map<Integer, DatacenterCharacteristics> datacenterCharacteristicsList;
public static NetworkDatacenter linkDC;
......@@ -88,10 +102,9 @@ public class NetDatacenterBroker extends SimEntity {
public static int cachedcloudlet = 0;
/**
* Created a new DatacenterBroker object.
* Creates 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
*
* @throws Exception the exception
*
......@@ -122,7 +135,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* This method is used to send to the broker the list with virtual machines that must be
* Sends to the broker the list with virtual machines that must be
* created.
*
* @param list the list
......@@ -135,7 +148,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* This method is used to send to the broker the list of cloudlets.
* Sends to the broker the list of cloudlets.
*
* @param list the list
*
......@@ -193,7 +206,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Process the return of a request for the characteristics of a PowerDatacenter.
* Processes the return of a request for the characteristics of a Datacenter.
*
* @param ev a SimEvent object
*
......@@ -211,7 +224,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Process a request for the characteristics of a PowerDatacenter.
* Processes a request for the characteristics of a Datacenter.
*
* @param ev a SimEvent object
*
......@@ -232,7 +245,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Process the ack received due to a request for VM creation.
* Processes the ack received due to a request for VM creation.
*
* @param ev a SimEvent object
*
......@@ -241,7 +254,7 @@ public class NetDatacenterBroker extends SimEntity {
*/
/**
* Process a cloudlet return event.
* Processes a cloudlet return event.
*
* @param ev a SimEvent object
*
......@@ -269,8 +282,10 @@ public class NetDatacenterBroker 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.
* Processes 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
*
......@@ -288,9 +303,9 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Create the virtual machines in a datacenter and submit/schedule cloudlets to them.
* Creates virtual machines in a datacenter and submit/schedule cloudlets to them.
*
* @param datacenterId Id of the chosen PowerDatacenter
* @param datacenterId Id of the Datacenter to create the VMs
*
* @pre $none
* @post $none
......@@ -360,6 +375,10 @@ public class NetDatacenterBroker extends SimEntity {
setVmsAcks(0);
}
/**
* Creates virtual machines in a datacenter
* @param datacenterId The id of the datacenter where to create the VMs.
*/
private void CreateVMs(int datacenterId) {
// two VMs per host
int numVM = linkDC.getHostList().size() * NetworkConstants.maxhostVM;
......@@ -392,7 +411,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Submit cloudlets to the created VMs.
* Sends request to destroy all VMs running on the datacenter.
*
* @pre $none
* @post $none /** Destroy the virtual machines running in datacenters.
......@@ -410,7 +429,7 @@ public class NetDatacenterBroker extends SimEntity {
}
/**
* Send an internal event communicating the end of the simulation.
* Sends an internal event communicating the end of the simulation.
*
* @pre $none
* @post $none
......@@ -419,19 +438,11 @@ public class NetDatacenterBroker 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...");
......
......@@ -16,21 +16,65 @@ import org.cloudbus.cloudsim.UtilizationModel;
/**
* NetworkCloudlet class extends Cloudlet to support simulation of complex applications. Each such
* network Cloudlet represents a task of the application. Each task consists of several stages.
* a network Cloudlet represents a task of the application. Each task consists of several stages.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @todo Attributes should be private
* @todo The different cloudlet classes should have a class hierarchy, by means
* of a super class and/or interface.
*/
public class NetworkCloudlet extends Cloudlet implements Comparable<Object> {
/** Time when cloudlet will be submitted. */
public double submittime;
/** Time when cloudlet finishes execution. */
public double finishtime;
/** Execution time for cloudlet. */
public double exetime;
/** Number of cloudlet's stages . */
public double numStage;
/** Current stage of cloudlet execution. */
public int currStagenum;
/** Star time of the current stage.
*/
public double timetostartStage;
/** Time spent in the current stage.
*/
public double timespentInStage;
/**
* @todo It doesn't appear to be used.
*/
public Map<Double, HostPacket> timeCommunicate;
/** All stages which cloudlet execution. */
public ArrayList<TaskStage> stages;
/**
* Cloudlet's memory.
* @todo Required, allocated, used memory?
* It doesn't appear to be used.
*/
long memory;
/**
* Cloudlet's start time.
*/
public double starttime;
public NetworkCloudlet(
int cloudletId,
long cloudletLength,
......@@ -56,28 +100,6 @@ public class NetworkCloudlet extends Cloudlet implements Comparable<Object> {
stages = new ArrayList<TaskStage>();
}
public double submittime; // time when cloudlet will be submitted
public double finishtime; // time when cloudlet finish execution
public double exetime; // execution time for cloudlet
public double numStage;// number of stages in cloudlet
public int currStagenum; // current stage of cloudlet execution
public double timetostartStage;
public double timespentInStage; // how much time spent in particular stage
public Map<Double, HostPacket> timeCommunicate;
public ArrayList<TaskStage> stages; // all stages which cloudlet execution
// consists of.
public double starttime;
@Override
public int compareTo(Object arg0) {
return 0;
......
......@@ -33,24 +33,30 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
* @author Saurabh Kumar Garg
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
* @todo Attributes should be private
*/
public class NetworkCloudletSpaceSharedScheduler extends CloudletScheduler {
/** The current CPUs. */
protected int currentCpus;
/** The used PEs. */
protected int usedPes;
// for network
/**
* The map of packets to send, where each key is a destination VM
* and each value is the list of packets to sent to that VM.
*/
public Map<Integer, List<HostPacket>> pkttosend;
/**
* The map of packets received, where each key is a sender VM
* and each value is the list of packets sent by that VM.
*/
public Map<Integer, List<HostPacket>> pktrecv;
/**
* Creates a new CloudletSchedulerSpaceShared object. This method must be invoked before
* starting the actual simulation.
* Creates a new CloudletSchedulerSpaceShared object.
* This method must be invoked before starting the actual simulation.
*
* @pre $none
* @post $none
......@@ -211,7 +217,10 @@ public class NetworkCloudletSpaceSharedScheduler extends CloudletScheduler {
return nextEvent;
}
/**@todo It has to be corrected the method name case. Method too long
/**
* Changes a cloudlet to the next stage.
*
* @todo It has to be corrected the method name case. Method too long
* to understand what is its responsibility.*/
private void changetonextstage(NetworkCloudlet cl, TaskStage st) {
cl.timespentInStage = 0;
......
......@@ -8,6 +8,13 @@
package org.cloudbus.cloudsim.network.datacenter;
/**
* Network constants
* @todo This class uses several hard-coded values that appears to be used
* only for examples. If yes, it should be moved to the examples package.
* The exceptions are the {@link TaskStage} types and number of
* switches by level.
*/
public class NetworkConstants {
public static int maxhostVM = 2;
......@@ -18,15 +25,20 @@ public class NetworkConstants {
public static int currentCloudletId = 0;
public static int currentAppId = 0;
// stage type
/**
* Types of {@link TaskStage}
* @todo should be an enum
*/
public static final int EXECUTION = 0;
public static final int WAIT_SEND = 1;
public static final int WAIT_RECV = 2;
public static final int FINISH = -2;
// number of switches at each level
/** Number of switches at root level. */
public static final int ROOT_LEVEL = 0;
/** Number of switches at aggregation level. */
public static final int Agg_LEVEL = 1;
/** Number of switches at edge level. */
public static final int EDGE_LEVEL = 2;
public static final int PES_NUMBER = 4;
......@@ -41,9 +53,9 @@ public class NetworkConstants {
public static long BandWidthEdgeHost = 100 * 1024 * 1024;//
public static long BandWidthAggRoot = 20 * 1024 * 1024 * 2;// 40gb
public static double SwitchingDelayRoot = .00285;
public static double SwitchingDelayAgg = .00245;// .00245
public static double SwitchingDelayEdge = .00157;// ms
public static double SwitchingDelayRoot = .00285; // ms
public static double SwitchingDelayAgg = .00245; // ms
public static double SwitchingDelayEdge = .00157; // ms
public static double EdgeSwitchPort = 4;// number of host
......
......@@ -27,34 +27,62 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEvent;
/**
* NetworkDatacenter class is a Datacenter whose hostList are virtualized and networked. It contains
* all the information about internal network. For example, which VM is connected to Switch etc. It
* NetworkDatacenter class is a {@link Datacenter} whose hostList are virtualized and networked. It contains
* all the information about internal network. For example, which VM is connected to what switch etc. It
* deals with processing of VM queries (i.e., handling of VMs) instead of processing
* Cloudlet-related queries. So, even though an AllocPolicy will be instantiated (in the init()
* method of the superclass, it will not be used, as processing of cloudlets are handled by the
* CloudletScheduler and processing of VirtualMachines are handled by the VmAllocationPolicy.
*
* Please refer to following publication for more details:
* @todo If an AllocPolicy is not being used, why it is being created. Perhaps
* a better class hierarchy should be created, introducing some abstract class
* or interface.
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
*/
public class NetworkDatacenter extends Datacenter {
/**
* A map between VMs and Switches, where each key
* is a VM id and the corresponding value is the id of the switch where the VM is connected to.
*/
public Map<Integer, Integer> VmToSwitchid = new HashMap<Integer, Integer>();
/**
* A map between hosts and Switches, where each key
* is a host id and the corresponding value is the id of the switch where the host is connected to.
*/
public Map<Integer, Integer> HostToSwitchid;
/**
* A map of datacenter switches where each key is a switch id
* and the corresponding value is the switch itself.
*/
public Map<Integer, Switch> Switchlist;
/**
* A map between VMs and Hosts, where each key
* is a VM id and the corresponding value is the id of the host where the VM is placed.
*/
public Map<Integer, Integer> VmtoHostlist;
/**
* Allocates a new NetworkDatacenter object.
* Instantiates a new NetworkDatacenter object.
*
* @param name the name to be associated with this entity (as required by Sim_entity class from
* simjava package)
* @param characteristics an object of DatacenterCharacteristics
* @param storageList a LinkedList of storage elements, for data simulation
* @param name the name to be associated with this entity (as required by {@link org.cloudbus.cloudsim.core.SimEntity})
* @param characteristics the datacenter characteristics
* @param vmAllocationPolicy the vmAllocationPolicy
* @param storageList a List of storage elements, for data simulation
* @param schedulingInterval the scheduling delay to process each datacenter received event
*
* @throws Exception This happens when one of the following scenarios occur:
* @throws Exception when one of the following scenarios occur:
* <ul>
* <li>creating this entity before initializing CloudSim package
* <li>this entity name is <tt>null</tt> or empty
......@@ -80,18 +108,12 @@ public class NetworkDatacenter extends Datacenter {
Switchlist = new HashMap<Integer, Switch>();
}
public Map<Integer, Integer> VmToSwitchid = new HashMap<Integer, Integer>();
public Map<Integer, Integer> HostToSwitchid;
public Map<Integer, Switch> Switchlist;
public Map<Integer, Integer> VmtoHostlist;
/**
* Get list of all EdgeSwitches in the Datacenter network One can design similar functions for
* other type of switches.
* Gets a map of all EdgeSwitches in the Datacenter network.
* One can design similar functions for other type of switches.
*
* @return a EdgeSwitches map, where each key is the switch id
* and each value it the switch itself.
*/
public Map<Integer, Switch> getEdgeSwitch() {
Map<Integer, Switch> edgeswitch = new HashMap<Integer, Switch>();
......@@ -105,10 +127,11 @@ public class NetworkDatacenter extends Datacenter {
}
/**
* Create the VM within the NetworkDatacenter. It can be directly accessed by Datacenter Broker
* which manage allocation of Cloudlets.
*
* Creates the given VM within the NetworkDatacenter.
* It can be directly accessed by Datacenter Broker which manages allocation of Cloudlets.
*
* @param vm
* @return true if the VW was created successfully, false otherwise
*/
public boolean processVmCreateNetwork(Vm vm) {
......@@ -127,15 +150,6 @@ public class NetworkDatacenter extends Datacenter {
return result;
}
/**
* Processes a Cloudlet submission.
*
* @param ev a SimEvent object
* @param ack an acknowledgement
*
* @pre ev != null
* @post $none
*/
@Override
protected void processCloudletSubmit(SimEvent ev, boolean ack) {
updateCloudletProcessing();
......
......@@ -24,37 +24,56 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* NetworkHost class extends Host to support simulation of networked datacenters. It executes
* actions related to management of packets (send and receive)other than that of virtual machines
* NetworkHost class extends {@link Host} to support simulation of networked datacenters. It executes
* actions related to management of packets (sent and received) other than that 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.
* well as an allocation policy for PE's to virtual machines.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
*/
public class NetworkHost extends Host {
public List<NetworkPacket> packetTosendLocal;
public List<NetworkPacket> packetTosendGlobal;
/**
* List of received packets.
*/
public List<NetworkPacket> packetrecieved;
/**
* @todo the attribute is not being used
* and is redundant with the ram capacity defined in {@link Host#ramProvisioner}
*/
public double memory;
public Switch sw; // Edge switch in general
/**
* Edge switch in which the Host is connected.
*/
public Switch sw;
public double bandwidth;// latency
/**
* @todo What exactly is this bandwidth?
* Because it is redundant with the bw capacity defined in {@link Host#bwProvisioner}
*/
public double bandwidth;
/** time when last job will finish on CPU1 **/
/** Time when last job will finish on CPU1.
* @todo it is not being used.
**/
public List<Double> CPUfinTimeCPU = new ArrayList<Double>();
/**
* @todo it is not being used.
**/
public double fintime = 0;
public NetworkHost(
......@@ -72,17 +91,6 @@ public class NetworkHost extends Host {
}
/**
* Requests updating of processing of cloudlets in the 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 th is host
*
* @pre currentTime >= 0.0
* @post $none
*/
@Override
public double updateVmsProcessing(double currentTime) {
double smallerTime = Double.MAX_VALUE;
......@@ -103,16 +111,13 @@ public class NetworkHost extends Host {
}
/**
* Receives packet and forward it to the corresponding VM for processing host.
*
*
* Receives packets and forward them to the corresponding VM.
*/
private void recvpackets() {
for (NetworkPacket hs : packetrecieved) {
hs.pkt.recievetime = CloudSim.clock();
// insertthe packet in recievedlist of VM
// insert the packet in recievedlist of VM
Vm vm = VmList.getById(getVmList(), hs.pkt.reciever);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.get(hs.pkt.sender);
......@@ -131,70 +136,70 @@ public class NetworkHost extends Host {
}
/**
* Send packet check whether a packet belongs to a local VM or to a VM hosted on other machine.
*
*
* Sends packets checks whether a packet belongs to a local VM or to a
* VM hosted on other machine.
*/
private void sendpackets() {
for (Vm vm : super.getVmList()) {
for (Entry<Integer, List<HostPacket>> es : ((NetworkCloudletSpaceSharedScheduler) vm
.getCloudletScheduler()).pkttosend.entrySet()) {
List<HostPacket> pktlist = es.getValue();
for (HostPacket pkt : pktlist) {
NetworkPacket hpkt = new NetworkPacket(getId(), pkt, vm.getId(), pkt.sender);
Vm vm2 = VmList.getById(this.getVmList(), hpkt.recievervmid);
if (vm2 != null) {
packetTosendLocal.add(hpkt);
} else {
packetTosendGlobal.add(hpkt);
}
}
pktlist.clear();
}
for (Entry<Integer, List<HostPacket>> es : ((NetworkCloudletSpaceSharedScheduler) vm
.getCloudletScheduler()).pkttosend.entrySet()) {
List<HostPacket> pktlist = es.getValue();
for (HostPacket pkt : pktlist) {
NetworkPacket hpkt = new NetworkPacket(getId(), pkt, vm.getId(), pkt.sender);
Vm vm2 = VmList.getById(this.getVmList(), hpkt.recievervmid);
if (vm2 != null) {
packetTosendLocal.add(hpkt);
} else {
packetTosendGlobal.add(hpkt);
}
}
pktlist.clear();
}
}
boolean flag = false;
for (NetworkPacket hs : packetTosendLocal) {
flag = true;
hs.stime = hs.rtime;
hs.pkt.recievetime = CloudSim.clock();
// insertthe packet in recievedlist
Vm vm = VmList.getById(getVmList(), hs.pkt.reciever);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.get(hs.pkt.sender);
if (pktlist == null) {
pktlist = new ArrayList<HostPacket>();
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv.put(
hs.pkt.sender,
pktlist);
}
pktlist.add(hs.pkt);
flag = true;
hs.stime = hs.rtime;
hs.pkt.recievetime = CloudSim.clock();
// insertthe packet in recievedlist
Vm vm = VmList.getById(getVmList(), hs.pkt.reciever);
List<HostPacket> pktlist = ((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv
.get(hs.pkt.sender);
if (pktlist == null) {
pktlist = new ArrayList<HostPacket>();
((NetworkCloudletSpaceSharedScheduler) vm.getCloudletScheduler()).pktrecv.put(
hs.pkt.sender,
pktlist);
}
pktlist.add(hs.pkt);
}
if (flag) {
for (Vm vm : super.getVmList()) {
vm.updateVmProcessing(CloudSim.clock(), getVmScheduler().getAllocatedMipsForVm(vm));
}
for (Vm vm : super.getVmList()) {
vm.updateVmProcessing(CloudSim.clock(), getVmScheduler().getAllocatedMipsForVm(vm));
}
}
// Sending packet to other VMs therefore packet is forwarded to a Edge switch
packetTosendLocal.clear();
double avband = bandwidth / packetTosendGlobal.size();
for (NetworkPacket hs : packetTosendGlobal) {
double delay = (1000 * hs.pkt.data) / avband;
NetworkConstants.totaldatatransfer += hs.pkt.data;
double delay = (1000 * hs.pkt.data) / avband;
NetworkConstants.totaldatatransfer += hs.pkt.data;
CloudSim.send(getDatacenter().getId(), sw.getId(), delay, CloudSimTags.Network_Event_UP, hs);
// send to switch with delay
CloudSim.send(getDatacenter().getId(), sw.getId(), delay, CloudSimTags.Network_Event_UP, hs);
// send to switch with delay
}
packetTosendGlobal.clear();
}
/**
* Gets the maximum utilization among the PEs of a given VM.
* @param vm The VM to get its PEs maximum utilization
* @return The maximum utilization among the PEs of the VM.
*/
public double getMaxUtilizationAmongVmsPes(Vm vm) {
return PeList.getMaxUtilizationAmongVmsPes(getPeList(), vm);
}
......
......@@ -10,43 +10,69 @@ package org.cloudbus.cloudsim.network.datacenter;
/**
* NewtorkPacket represents the packet which travel from one server to another. Each packet contains
* ids of the sender VM and receiver VM, time at which it is send and received, type and virtual ids
* of tasks, which are communicating.
* IDs of the sender and receiver VM which are communicating, time at which it is sent and received,
* type and virtual IDs of tasks.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @todo Attributes should be private
*/
public class NetworkPacket {
/**
* Information about the virtual send and receiver entities of the packet.
*/
HostPacket pkt;
public NetworkPacket(int id, HostPacket pkt2, int vmid, int cloudletid) {
pkt = pkt2;
sendervmid = vmid;
this.cloudletid = cloudletid;
senderhostid = id;
stime = pkt.sendtime;
recievervmid = pkt2.reciever;
}
/**
* Id of the sender host.
*/
int senderhostid;
HostPacket pkt;
/**
* Id of the receiver host.
*/
int recieverhostid;
int senderhostid;
/**
* Id of the sender VM.
* @todo Isn't this data at {@link #pkt}?
*/
int sendervmid;
int recieverhostid;
/**
* Id of the receiver VM.
* @todo Isn't this data at {@link #pkt}?
*/
int recievervmid;
int sendervmid;
/**
* Id of the sender cloudlet.
* @todo This field is not needed, since its value is being
* get from a {@link HostPacket} instance at {@link NetworkHost#sendpackets()}.
* So, such a data can be got form the {@link #pkt} attribute.
*/
int cloudletid;
int recievervmid;
/** Time when the packet was sent. */
double stime;
int cloudletid;
/** Time when the packet was received. */
double rtime;
double stime;// time when sent
public NetworkPacket(int id, HostPacket pkt2, int vmid, int cloudletid) {
pkt = pkt2;
sendervmid = vmid;
this.cloudletid = cloudletid;
senderhostid = id;
stime = pkt.sendtime;
recievervmid = pkt2.reciever;
double rtime;// time when received
}
}
......@@ -14,19 +14,50 @@ import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.Vm;
/**
* NetworkVm class extends Vm to support simulation of networked datacenters. It executes actions
* related to management of packets (send and receive).
* NetworkVm class extends {@link Vm} to support simulation of networked datacenters.
* It executes actions related to management of packets (sent and received).
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
* @todo Attributes should be private
*/
public class NetworkVm extends Vm implements Comparable<Object> {
/**
* List of {@link NetworkCloudlet} of the VM.
*/
public ArrayList<NetworkCloudlet> cloudletlist;
/**
* @todo It doesn't appear to be used.
*/
int type;
/**
* List of packets received by the VM.
*/
public ArrayList<HostPacket> recvPktlist;
/**
* @todo It doesn't appear to be used.
*/
public double memory;
/**
* @todo It doesn't appear to be used.
*/
public boolean flagfree;
/**
* The time when the VM finished to process its cloudlets.
*/
public double finishtime;
public NetworkVm(
int id,
......@@ -43,18 +74,6 @@ public class NetworkVm extends Vm implements Comparable<Object> {
cloudletlist = new ArrayList<NetworkCloudlet>();
}
public ArrayList<NetworkCloudlet> cloudletlist;
int type;
public ArrayList<HostPacket> recvPktlist;
public double memory;
public boolean flagfree;// if true it is free
public double finishtime;
public boolean isFree() {
return flagfree;
}
......
......@@ -20,7 +20,7 @@ import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim;
/**
* NetworkVmAllocationPolicy is an VmAllocationPolicy that chooses, as the host for a VM, the host
* NetworkVmAllocationPolicy is an {@link VmAllocationPolicy} that chooses, as the host for a VM, the host
* with less PEs in use.
*
* @author Rodrigo N. Calheiros
......@@ -30,19 +30,21 @@ import org.cloudbus.cloudsim.core.CloudSim;
*/
public class NetworkVmAllocationPolicy extends VmAllocationPolicy {
/** The vm table. */
/** The vm map where each key is a VM id and
* each value is the host where the VM is placed. */
private Map<String, Host> vmTable;
/** The used pes. */
/** The used PEs map, where each key is a VM id
* and each value is the number of required PEs the VM is using. */
private Map<String, Integer> usedPes;
/** The free pes. */
private List<Integer> freePes;
/**
* Creates the new VmAllocationPolicySimple object.
* Creates a new VmAllocationPolicySimple object.
*
* @param list the list
* @param list list Machines available in a {@link Datacenter}
*
* @pre $none
* @post $none
......@@ -114,6 +116,12 @@ public class NetworkVmAllocationPolicy extends VmAllocationPolicy {
return result;
}
/**
* Gets the max utilization among the PEs of a given VM placed at a given host.
* @param host The host where the VM is placed
* @param vm The VM to get the max PEs utilization
* @return The max utilization among the PEs of the VM
*/
protected double getMaxUtilizationAfterAllocation(NetworkHost host, Vm vm) {
List<Double> allocatedMipsForVm = null;
NetworkHost allocatedHost = (NetworkHost) vm.getHost();
......@@ -157,11 +165,11 @@ public class NetworkVmAllocationPolicy extends VmAllocationPolicy {
}
/**
* Gets the host that is executing the given VM belonging to the given user.
* Gets the host that is executing the given VM.
*
* @param vm the vm
* @param vm the vm to get its host
*
* @return the Host with the given vmID and userID; $null if not found
* @return the Host of the given vm; $null if not found
*
* @pre $none
* @post $none
......@@ -177,7 +185,7 @@ public class NetworkVmAllocationPolicy extends VmAllocationPolicy {
* @param vmId the vm id
* @param userId the user id
*
* @return the Host with the given vmID and userID; $null if not found
* @return the Host of the given vm and user; $null if not found
*
* @pre $none
* @post $none
......@@ -241,21 +249,13 @@ public class NetworkVmAllocationPolicy extends VmAllocationPolicy {
this.freePes = freePes;
}
/*
* (non-Javadoc)
* @see cloudsim.VmAllocationPolicy#optimizeAllocation(double, cloudsim.VmList, double)
*/
@Override
public List<Map<String, Object>> optimizeAllocation(List<? extends Vm> vmList) {
// TODO Auto-generated method stub
/*@todo Auto-generated method stub.
The method is doing nothing.*/
return null;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#allocateHostForVm(org.cloudbus.cloudsim.Vm,
* org.cloudbus.cloudsim.Host)
*/
@Override
public boolean allocateHostForVm(Vm vm, Host host) {
if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
......
......@@ -18,14 +18,15 @@ import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
/**
* This class allows to simulate Root switch which connects Datacenter to external network. It
* interacts with other switches in order to exchange packets.
* This class allows to simulate Root switch which connects Datacenters to external network.
* It interacts with other switches in order to exchange packets.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 3.0
......@@ -33,12 +34,12 @@ import org.cloudbus.cloudsim.core.predicates.PredicateType;
public class RootSwitch extends Switch {
/**
* Constructor for Root Switch We have to specify switches that are connected to its downlink
* ports, and corresponding bandwidths
* Instantiates a Root Switch specifying what other switches are connected to its downlink
* ports, and corresponding bandwidths.
*
* @param name Name of the switch
* @param level At which level switch is with respect to hosts.
* @param dc Pointer to Datacenter
* @param name Name of the root switch
* @param level At which level the switch is with respect to hosts.
* @param dc The Datacenter where the switch is connected to
*/
public RootSwitch(String name, int level, NetworkDatacenter dc) {
super(name, level, dc);
......@@ -50,11 +51,6 @@ public class RootSwitch extends Switch {
numport = NetworkConstants.RootSwitchPort;
}
/**
* Send Packet to switch connected through a downlink port
*
* @param ev Event/packet to process
*/
@Override
protected void processpacket_up(SimEvent ev) {
......
......@@ -26,51 +26,130 @@ import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType;
import org.cloudbus.cloudsim.lists.VmList;
/**
* Represents a Network Switch.
* @todo attributes should be private
*/
public class Switch extends SimEntity {
// switch level
/** The switch id */
public int id;
public int level;// three levels
/**
* The level (layer) of the switch in the network topology.
*/
public int level;
/**
* The id of the datacenter where the switch is connected to.
* @todo It doesn't appear to be used
*/
public int datacenterid;
/**
* Map of packets sent to switches on the uplink,
* where each key is a switch id and the corresponding
* value is the packets sent to that switch.
*/
public Map<Integer, List<NetworkPacket>> uplinkswitchpktlist;
/**
* Map of packets sent to switches on the downlink,
* where each key is a switch id and the corresponding
* value is the packets sent to that switch.
*/
public Map<Integer, List<NetworkPacket>> downlinkswitchpktlist;
/**
* Map of hosts connected to the switch, where each key is the host ID
* and the corresponding value is the host itself.
*/
public Map<Integer, NetworkHost> hostlist;
/**
* List of uplink switches.
*/
public List<Switch> uplinkswitches;
/**
* List of downlink switches.
*/
public List<Switch> downlinkswitches;
/**
* Map of packets sent to hosts connected in the switch,
* where each key is a host id and the corresponding
* value is the packets sent to that host.
*/
public Map<Integer, List<NetworkPacket>> packetTohost;
int type;// edge switch or aggregation switch
/**
* The switch type: edge switch or aggregation switch.
* @todo should be an enum
*/
int type;
/**
* Bandwitdh of uplink.
*/
public double uplinkbandwidth;
/**
* Bandwitdh of downlink.
*/
public double downlinkbandwidth;
/**
* The latency of the network where the switch is connected to.
* @todo Its value is being defined by a constant, but not every subclass
* is setting the attribute accordingly.
* The constants should be used as default values, but the class
* should have a setter for this attribute.
*/
public double latency;
public double numport;
/**
* The datacenter where the switch is connected to.
* @todo It doesn't appear to be used
*/
public NetworkDatacenter dc;
// something is running on these hosts
/** Something is running on these hosts.
* @todo The attribute is only used at the TestExample class. */
public SortedMap<Double, List<NetworkHost>> fintimelistHost = new TreeMap<Double, List<NetworkHost>>();
// something is running on these hosts
/** Something is running on these hosts.
* @todo The attribute doesn't appear to be used */
public SortedMap<Double, List<NetworkVm>> fintimelistVM = new TreeMap<Double, List<NetworkVm>>();
/**
* List of received packets.
*/
public ArrayList<NetworkPacket> pktlist = new ArrayList<NetworkPacket>();
/**
* @todo The attribute doesn't appear to be used */
public List<Vm> BagofTaskVm = new ArrayList<Vm>();
/**
* The time the switch spends to process a received packet.
* This time is considered constant no matter how many packets
* the switch have to process.
*
* @todo The value of this attribute is being defined by
* constants such as {@link NetworkConstants#SwitchingDelayRoot},
* but not all sub classes are setting a value to it.
* The constants should be used as default values, but the class
* should have a setter for this attribute.
*/
public double switching_delay;
/**
* A map of VMs connected to this switch.
* @todo The list doesn't appear to be updated (VMs added to it) anywhere.
*/
public Map<Integer, NetworkVm> Vmlist = new HashMap<Integer, NetworkVm>();
public Switch(String name, int level, NetworkDatacenter dc) {
......@@ -116,6 +195,10 @@ public class Switch extends SimEntity {
}
}
/**
* Process a packet sent to a host.
* @param ev The packet sent.
*/
protected void processhostpacket(SimEvent ev) {
// Send packet to host
NetworkPacket hspkt = (NetworkPacket) ev.getData();
......@@ -123,9 +206,14 @@ public class Switch extends SimEntity {
hs.packetrecieved.add(hspkt);
}
/**
* Sends a packet to switches connected through a downlink port.
*
* @param ev Event/packet to process
*/
protected void processpacket_down(SimEvent ev) {
// packet coming from up level router.
// has to send downward
// packet coming from up level router
// has to send downward.
// check which switch to forward to
// add packet in the switch list
// add packet in the host list
......@@ -161,9 +249,14 @@ public class Switch extends SimEntity {
}
/**
* Sends a packet to switches connected through a uplink port.
*
* @param ev Event/packet to process
*/
protected void processpacket_up(SimEvent ev) {
// packet coming from down level router.
// has to send up
// has to be sent up.
// check which switch to forward to
// add packet in the switch list
//
......@@ -258,12 +351,20 @@ public class Switch extends SimEntity {
}
}
}
/**
* Register a host that is connected to the switch.
* @param ev
*/
private void registerHost(SimEvent ev) {
NetworkHost hs = (NetworkHost) ev.getData();
hostlist.put(hs.getId(), (NetworkHost) ev.getData());
hostlist.put(hs.getId(), hs);
}
/**
* Process a received packet.
* @param ev The packet received.
*/
protected void processpacket(SimEvent ev) {
// send packet to itself with switching delay (discarding other)
CloudSim.cancelAll(getId(), new PredicateType(CloudSimTags.Network_Event_UP));
......@@ -274,13 +375,26 @@ public class Switch extends SimEntity {
}
/**
* 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.
*
* @todo the method should be protected to allow sub classes to override it,
* once it does nothing here.
*/
private void processOtherEvent(SimEvent ev) {
}
/**
* Sends a packet to hosts connected to the switch
*
* @param ev Event/packet to process
*/
protected void processpacketforward(SimEvent ev) {
// search for the host and packets..send to them
if (downlinkswitchpktlist != null) {
for (Entry<Integer, List<NetworkPacket>> es : downlinkswitchpktlist.entrySet()) {
int tosend = es.getKey();
......@@ -337,10 +451,11 @@ public class Switch extends SimEntity {
}
//
// R: We changed visibility of the below methods from private to protected.
//
/**
* Gets the host of a given VM.
* @param vmid The id of the VM
* @return the host of the VM
*/
protected NetworkHost getHostwithVM(int vmid) {
for (Entry<Integer, NetworkHost> es : hostlist.entrySet()) {
Vm vm = VmList.getById(es.getValue().getVmList(), vmid);
......@@ -351,6 +466,12 @@ public class Switch extends SimEntity {
return null;
}
/**
* Gets a list with a given number of free VMs.
*
* @param numVMReq The number of free VMs to get.
* @return the list of free VMs.
*/
protected List<NetworkVm> getfreeVmlist(int numVMReq) {
List<NetworkVm> freehostls = new ArrayList<NetworkVm>();
for (Entry<Integer, NetworkVm> et : Vmlist.entrySet()) {
......@@ -365,6 +486,12 @@ public class Switch extends SimEntity {
return freehostls;
}
/**
* Gets a list with a given number of free hosts.
*
* @param numhost The number of free hosts to get.
* @return the list of free hosts.
*/
protected List<NetworkHost> getfreehostlist(int numhost) {
List<NetworkHost> freehostls = new ArrayList<NetworkHost>();
for (Entry<Integer, NetworkHost> et : hostlist.entrySet()) {
......
......@@ -9,20 +9,48 @@
package org.cloudbus.cloudsim.network.datacenter;
/**
* Taskstage represents various stages a networkCloudlet can have during execution. Four stage types
* which are possible-> EXECUTION=0; WAIT_SEND=1; WAIT_RECV=2; FINISH=-2; Check NeworkConstants.java
* file for that.
* TaskStage represents various stages a {@link NetworkCloudlet} can have during execution.
* Four stage types which are possible: {@link NetworkConstants#EXECUTION},
* {@link NetworkConstants#WAIT_SEND}, {@link NetworkConstants#WAIT_RECV},
* {@link NetworkConstants#FINISH}.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
* @todo Attributes should be defined as private.
*/
public class TaskStage {
int vpeer;
/**
* The task type, either {@link NetworkConstants#EXECUTION},
* {@link NetworkConstants#WAIT_SEND} or {@link NetworkConstants#WAIT_RECV}.
* @todo It would be used enum instead of int constants.
*/
int type;
/**
* The data length generated for the task (in bytes).
*/
double data;
/** Execution time for this stage. */
double time;
/** Stage (task) id. */
double stageid;
/** Memory used by the task. */
long memory;
/** From whom data needed to be received or sent. */
int peer;
public TaskStage(int type, double data, double time, double stageid, long memory, int peer, int vpeer) {
super();
......@@ -34,19 +62,4 @@ public class TaskStage {
this.peer = peer;
this.vpeer = vpeer;
}
int vpeer;
int type;// execution, recv, send,
double data;// data generated or send or recv
double time;// execution time for this stage
double stageid;
long memory;
int peer;// from whom data needed to be recieved or send
}
......@@ -16,13 +16,14 @@ import org.cloudbus.cloudsim.core.CloudSim;
/**
* WorkflowApp is an example of AppCloudlet having three communicating tasks. Task A and B sends the
* data (packet) while Task C receives them
* data (packet) while Task C receives them.
*
* Please refer to following publication for more details:
*
* Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* <br/>Please refer to following publication for more details:<br/>
* <ul>
* <li><a href="http://dx.doi.org/10.1109/UCC.2011.24">Saurabh Kumar Garg and Rajkumar Buyya, NetworkCloudSim: Modelling Parallel Applications in Cloud
* Simulations, Proceedings of the 4th IEEE/ACM International Conference on Utility and Cloud
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.
* Computing (UCC 2011, IEEE CS Press, USA), Melbourne, Australia, December 5-7, 2011.</a>
* </ul>
*
* @author Saurabh Kumar Garg
* @since CloudSim Toolkit 1.0
......@@ -35,6 +36,17 @@ public class WorkflowApp extends AppCloudlet {
this.numbervm = 3;
}
/**
* If the method completely overrides the parent method,
* a interface or abstract class should be used.
* The method constant values for cloudlet attributes
* that have to be defined by the user.
* Thus, that class appears to be another example class,
* such as the {@link AppCloudlet}. If this is the intention,
* it would be inside the examples package.
* At the constructor, there are other hard-coded values.
* @param vmIdList
*/
@Override
public void createCloudletList(List<Integer> vmIdList) {
long fileSize = NetworkConstants.FILE_SIZE;
......
......@@ -25,13 +25,15 @@ import org.cloudbus.cloudsim.core.predicates.PredicateType;
/**
* PowerDatacenter is a class that enables simulation of power-aware data centers.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......@@ -245,11 +247,6 @@ public class PowerDatacenter extends Datacenter {
return minTime;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.Datacenter#processVmMigrate(org.cloudbus.cloudsim.core.SimEvent,
* boolean)
*/
@Override
protected void processVmMigrate(SimEvent ev, boolean ack) {
updateCloudetProcessingWithoutSchedulingFutureEvents();
......@@ -260,10 +257,6 @@ public class PowerDatacenter extends Datacenter {
}
}
/*
* (non-Javadoc)
* @see cloudsim.Datacenter#processCloudletSubmit(cloudsim.core.SimEvent, boolean)
*/
@Override
protected void processCloudletSubmit(SimEvent ev, boolean ack) {
super.processCloudletSubmit(ev, ack);
......
......@@ -16,13 +16,15 @@ import org.cloudbus.cloudsim.core.SimEvent;
/**
* A broker for the power package.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......@@ -39,11 +41,6 @@ public class PowerDatacenterBroker extends DatacenterBroker {
super(name);
}
/*
* (non-Javadoc)
* @see
* org.cloudbus.cloudsim.DatacenterBroker#processVmCreate(org.cloudbus.cloudsim.core.SimEvent)
*/
@Override
protected void processVmCreate(SimEvent ev) {
int[] data = (int[]) ev.getData();
......
......@@ -24,13 +24,15 @@ import org.cloudbus.cloudsim.core.predicates.PredicateType;
* PowerDatacenterNonPowerAware is a class that represents a non-power aware data center in the
* context of power-aware simulations.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......
......@@ -20,13 +20,15 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/**
* PowerHost class enables simulation of power-aware hosts.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......
......@@ -21,13 +21,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
* The class of a host that stores its CPU utilization history. The history is used by VM allocation
* and selection policies.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......
......@@ -20,13 +20,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
* The class of a VM that stores its CPU utilization history. The history is used by VM allocation
* and selection policies.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......
......@@ -21,13 +21,15 @@ import org.cloudbus.cloudsim.core.CloudSim;
/**
* The class of an abstract power-aware VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -46,20 +48,11 @@ public abstract class PowerVmAllocationPolicyAbstract extends VmAllocationPolicy
super(list);
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#allocateHostForVm(org.cloudbus.cloudsim.Vm)
*/
@Override
public boolean allocateHostForVm(Vm vm) {
return allocateHostForVm(vm, findHostForVm(vm));
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#allocateHostForVm(org.cloudbus.cloudsim.Vm,
* org.cloudbus.cloudsim.Host)
*/
@Override
public boolean allocateHostForVm(Vm vm, Host host) {
if (host == null) {
......@@ -94,10 +87,6 @@ public abstract class PowerVmAllocationPolicyAbstract extends VmAllocationPolicy
return null;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#deallocateHostForVm(org.cloudbus.cloudsim.Vm)
*/
@Override
public void deallocateHostForVm(Vm vm) {
Host host = getVmTable().remove(vm.getUid());
......@@ -106,19 +95,11 @@ public abstract class PowerVmAllocationPolicyAbstract extends VmAllocationPolicy
}
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#getHost(org.cloudbus.cloudsim.Vm)
*/
@Override
public Host getHost(Vm vm) {
return getVmTable().get(vm.getUid());
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#getHost(int, int)
*/
@Override
public Host getHost(int vmId, int userId) {
return getVmTable().get(Vm.getUid(userId, vmId));
......
......@@ -28,13 +28,15 @@ import org.cloudbus.cloudsim.util.ExecutionTimeMeasurer;
* The class of an abstract power-aware VM allocation policy that dynamically optimizes the VM
* allocation using migration.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -18,13 +18,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
/**
* The Inter Quartile Range (IQR) VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -17,13 +17,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
/**
* The Local Regression (LR) VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -16,13 +16,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
/**
* The Local Regression Robust (LRR) VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -18,13 +18,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
/**
* The Median Absolute Deviation (MAD) VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -32,7 +34,31 @@ import org.cloudbus.cloudsim.util.MathUtil;
public class PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation extends
PowerVmAllocationPolicyMigrationAbstract {
/** The safety parameter. */
/** The safety parameter in percentage (at scale from 0 to 1).
* It is a tuning parameter used by the allocation policy to define
* when a host is overloaded. The overload detection is based
* on a dynamic defined host utilization threshold. This threshold
* is computed based on the host's usage history Median absolute deviation
* (MAD, that is similar to the Standard Deviation).
* This safety parameter is used to increase or decrease the MAD value
* when computing the utilization threshold.
* As the safety parameter increases, the threshold decreases,
* what may lead to less SLA violations. So, as higher is that parameter,
* safer the algorithm will be when defining a host as overloaded.
* For instance, considering a safety parameter of 1.5 (150%),
* a host's resource usage mean is 0.5 (50%)
* and a MAD of 0.2 (thus, the usage may vary from 0.3 to 0.7).
* To compute the usage threshold, the MAD is increased by 50%, being equals to 0.3.
* Finally, the threshold will be 1 - 0.3 = 0.7.
* Thus, only when the host utilization threshold exceeds 70%,
* the host is considered overloaded.
* Here, more safe or less safe doesn't means a more accurate or less accurate
* overload detection. Safer means the algorithm will use a lower host
* utilization threshold that may lead to lower SLA violations but higher
* resource wastage. Thus this parameter has to be tuned in order to
* trade-off between SLA violation and resource wastage.
*/
private double safetyParameter = 0;
/** The fallback vm allocation policy. */
......@@ -85,7 +111,7 @@ public class PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation extends
PowerHostUtilizationHistory _host = (PowerHostUtilizationHistory) host;
double upperThreshold = 0;
try {
upperThreshold = 1 - getSafetyParameter() * getHostUtilizationMad(_host);
upperThreshold = 1 - getSafetyParameter() * getHostUtilizationMad(_host);
} catch (IllegalArgumentException e) {
return getFallbackVmAllocationPolicy().isHostOverUtilized(host);
}
......@@ -116,6 +142,7 @@ public class PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation extends
* Sets the safety parameter.
*
* @param safetyParameter the new safety parameter
* @todo It should raise an InvalidArgumentException instead of calling System.exit(0)
*/
protected void setSafetyParameter(double safetyParameter) {
if (safetyParameter < 0) {
......
......@@ -16,13 +16,15 @@ import org.cloudbus.cloudsim.Vm;
/**
* The Static Threshold (THR) VM allocation policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -18,13 +18,15 @@ import org.cloudbus.cloudsim.Vm;
* This a simple class representing a simple VM allocation policy that does not perform any
* optimization of the VM allocation.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -40,10 +42,6 @@ public class PowerVmAllocationPolicySimple extends PowerVmAllocationPolicyAbstra
super(list);
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.VmAllocationPolicy#optimizeAllocation(java.util.List)
*/
@Override
public List<Map<String, Object>> optimizeAllocation(List<? extends Vm> vmList) {
// This policy does not optimize the VM allocation
......
......@@ -16,13 +16,15 @@ import org.cloudbus.cloudsim.Vm;
/**
* The class of an abstract VM selection policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......
......@@ -18,13 +18,15 @@ import org.cloudbus.cloudsim.util.MathUtil;
/**
* The Maximum Correlation (MC) VM selection policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -44,12 +46,6 @@ public class PowerVmSelectionPolicyMaximumCorrelation extends PowerVmSelectionPo
setFallbackPolicy(fallbackPolicy);
}
/*
* (non-Javadoc)
*
* @see org.cloudbus.cloudsim.experiments.power.PowerVmSelectionPolicy#
* getVmsToMigrate(org.cloudbus .cloudsim.power.PowerHost)
*/
@Override
public Vm getVmToMigrate(final PowerHost host) {
List<PowerVm> migratableVms = getMigratableVms(host);
......
......@@ -15,25 +15,20 @@ import org.cloudbus.cloudsim.Vm;
/**
* The Minimum Migration Time (MMT) VM selection policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerVmSelectionPolicyMinimumMigrationTime extends PowerVmSelectionPolicy {
/*
* (non-Javadoc)
* @see
* org.cloudbus.cloudsim.experiments.power.PowerVmSelectionPolicy#getVmsToMigrate(org.cloudbus
* .cloudsim.power.PowerHost)
*/
@Override
public Vm getVmToMigrate(PowerHost host) {
List<PowerVm> migratableVms = getMigratableVms(host);
......
......@@ -16,25 +16,20 @@ import org.cloudbus.cloudsim.core.CloudSim;
/**
* The Minimum Utilization (MU) VM selection policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerVmSelectionPolicyMinimumUtilization extends PowerVmSelectionPolicy {
/*
* (non-Javadoc)
* @see
* org.cloudbus.cloudsim.experiments.power.PowerVmSelectionPolicy#getVmsToMigrate(org.cloudbus
* .cloudsim.power.PowerHost)
*/
@Override
public Vm getVmToMigrate(PowerHost host) {
List<PowerVm> migratableVms = getMigratableVms(host);
......
......@@ -16,25 +16,20 @@ import org.cloudbus.cloudsim.Vm;
/**
* The Random Selection (RS) VM selection policy.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public class PowerVmSelectionPolicyRandomSelection extends PowerVmSelectionPolicy {
/*
* (non-Javadoc)
* @see
* org.cloudbus.cloudsim.experiments.power.PowerVmSelectionPolicy#getVmsToMigrate(org.cloudbus
* .cloudsim.power.PowerHost)
*/
@Override
public Vm getVmToMigrate(PowerHost host) {
List<PowerVm> migratableVms = getMigratableVms(host);
......
......@@ -19,13 +19,15 @@ import org.cloudbus.cloudsim.lists.VmList;
/**
* PowerVmList is a collection of operations on lists of power-enabled VMs.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
*
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The PowerModel interface needs to be implemented in order to provide a model of power consumption
* depending on utilization for system components.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
*
......
......@@ -11,13 +11,15 @@ package org.cloudbus.cloudsim.power.models;
/**
* The Class PowerModelCubic.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
*
......@@ -47,10 +49,6 @@ public class PowerModelCubic implements PowerModel {
setConstant((maxPower - getStaticPower()) / Math.pow(100, 3));
}
/*
* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
......
......@@ -11,13 +11,15 @@ package org.cloudbus.cloudsim.power.models;
/**
* The Class PowerModelLinear.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
*
......@@ -47,10 +49,6 @@ public class PowerModelLinear implements PowerModel {
setConstant((maxPower - getStaticPower()) / 100);
}
/*
* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
......
......@@ -9,26 +9,23 @@
package org.cloudbus.cloudsim.power.models;
/**
* The abstract class of power models created based on data from SPECpower benchmark:
* http://www.spec.org/power_ssj2008/
* The abstract class of power models created based on data from
* <a href="http://www.spec.org/power_ssj2008/">SPECpower benchmark</a>.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public abstract class PowerModelSpecPower implements PowerModel {
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an HP ProLiant ML110 G3 (1 x [Pentium D930 3000 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerHpProLiantMl110G3PentiumD930 extends PowerModelS
/** The power. */
private final double[] power = { 105, 112, 118, 125, 131, 137, 147, 153, 157, 164, 169 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an HP ProLiant ML110 G4 (1 x [Xeon 3040 1860 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110127-00342.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerHpProLiantMl110G4Xeon3040 extends PowerModelSpec
/** The power. */
private final double[] power = { 86, 89.4, 92.6, 96, 99.5, 102, 106, 108, 112, 114, 117 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an HP ProLiant ML110 G5 (1 x [Xeon 3075 2660 MHz, 2 cores], 4GB).
* http://www.spec.org/power_ssj2008/results/res2011q1/power_ssj2008-20110124-00339.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerHpProLiantMl110G5Xeon3075 extends PowerModelSpec
/** The power. */
private final double[] power = { 93.7, 97, 101, 105, 110, 116, 121, 125, 129, 133, 135 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an IBM server x3250 (1 x [Xeon X3470 2933 MHz, 4 cores], 8GB).
* http://www.spec.org/power_ssj2008/results/res2009q4/power_ssj2008-20091104-00213.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerIbmX3250XeonX3470 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 41.6, 46.7, 52.3, 57.9, 65.4, 73, 80.7, 89.5, 99.6, 105, 113 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an IBM server x3250 (1 x [Xeon X3480 3067 MHz, 4 cores], 8GB).
* http://www.spec.org/power_ssj2008/results/res2010q4/power_ssj2008-20101001-00297.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerIbmX3250XeonX3480 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 42.3, 46.7, 49.7, 55.4, 61.8, 69.3, 76.1, 87, 96.1, 106, 113 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an IBM server x3550 (2 x [Xeon X5670 2933 MHz, 6 cores], 12GB).
* http://www.spec.org/power_ssj2008/results/res2010q2/power_ssj2008-20100315-00239.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerIbmX3550XeonX5670 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 66, 107, 120, 131, 143, 156, 173, 191, 211, 229, 247 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -12,13 +12,15 @@ package org.cloudbus.cloudsim.power.models;
* The power model of an IBM server x3550 (2 x [Xeon X5675 3067 MHz, 6 cores], 16GB).
* http://www.spec.org/power_ssj2008/results/res2011q2/power_ssj2008-20110406-00368.html
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
......@@ -28,10 +30,6 @@ public class PowerModelSpecPowerIbmX3550XeonX5675 extends PowerModelSpecPower {
/** The power. */
private final double[] power = { 58.4, 98, 109, 118, 128, 140, 153, 170, 189, 205, 222 };
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.power.models.PowerModelSpecPower#getPowerData(int)
*/
@Override
protected double getPowerData(int index) {
return power[index];
......
......@@ -11,13 +11,15 @@ package org.cloudbus.cloudsim.power.models;
/**
* The Class PowerModelSqrt.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......@@ -45,10 +47,6 @@ public class PowerModelSqrt implements PowerModel {
setConstant((maxPower - getStaticPower()) / Math.sqrt(100));
}
/*
* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
......
......@@ -11,13 +11,15 @@ package org.cloudbus.cloudsim.power.models;
/**
* The Class PowerModelSquare.
*
* If you are using any algorithms, policies or workload included in the power package, please cite
* the following paper:
* <br/>If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:<br/>
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* <ul>
* <li><a href="http://dx.doi.org/10.1002/cpe.1867">Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience (CCPE), Volume 24,
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012
* Issue 13, Pages: 1397-1420, John Wiley & Sons, Ltd, New York, USA, 2012</a>
* </ul>
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
......@@ -45,10 +47,6 @@ public class PowerModelSquare implements PowerModel {
setConstant((maxPower - getStaticPower()) / Math.pow(100, 2));
}
/*
* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double)
*/
@Override
public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) {
......
......@@ -157,7 +157,7 @@ public class MathUtil {
}
/**
* Gets the mad from a array of numbers.
* Gets the Median absolute deviation (MAD) from a array of numbers.
*
* @param data the array of numbers
* @return the mad
......
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