Commit 225d6749 authored by Anton Beloglazov's avatar Anton Beloglazov

Updated the javadocs, headers, code formatting, and Maven configuration (new…

Updated the javadocs, headers, code formatting, and Maven configuration (new versions of the dependencies)
parent 62de8e30
......@@ -16,7 +16,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<executions>
<execution>
<phase>install</phase>
......
......@@ -14,6 +14,7 @@
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
......
......@@ -15,6 +15,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>docs</id>
......@@ -33,12 +34,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.2</version>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.sonatype.maven.plugin</groupId>
......@@ -48,7 +49,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.5</version>
<version>2.11</version>
</plugin>
</plugins>
</reporting>
......
......@@ -3,7 +3,7 @@
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2010, The University of Melbourne, Australia
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim;
......@@ -11,14 +11,13 @@ package org.cloudbus.cloudsim;
import java.util.List;
/**
* CloudletScheduler is an abstract class that represents the policy of
* scheduling performed by a virtual machine. So, classes
* extending this must execute Cloudlets. Also, the interface for cloudlet
* management is also implemented in this class.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
* CloudletScheduler is an abstract class that represents the policy of scheduling performed by a
* virtual machine. So, classes extending this must execute Cloudlets. Also, the interface for
* cloudlet management is also implemented in this class.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
*/
public abstract class CloudletScheduler {
......@@ -29,9 +28,9 @@ public abstract class CloudletScheduler {
private List<Double> currentMipsShare;
/**
* Creates a new CloudletScheduler object. This method must be invoked
* before starting the actual simulation.
*
* Creates a new CloudletScheduler object. This method must be invoked before starting the
* actual simulation.
*
* @pre $none
* @post $none
*/
......@@ -41,13 +40,11 @@ public abstract class CloudletScheduler {
/**
* Updates the processing of cloudlets running under management of this scheduler.
*
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each processor available to the scheduler
*
* @return time predicted completion time of the earliest finishing cloudlet, or 0
* if there is no next events
*
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is no
* next events
* @pre currentTime >= 0
* @post $none
*/
......@@ -55,12 +52,10 @@ public abstract class CloudletScheduler {
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
*
* @param gl the submited cloudlet
* @param fileTransferTime time required to move the required files from the SAN to the VM
*
* @return expected finish time of this cloudlet, or 0 if it is in a waiting queue
*
* @pre gl != null
* @post $none
*/
......@@ -68,11 +63,9 @@ public abstract class CloudletScheduler {
/**
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
*
* @param gl the submited cloudlet
*
* @return expected finish time of this cloudlet, or 0 if it is in a waiting queue
*
* @pre gl != null
* @post $none
*/
......@@ -80,11 +73,9 @@ public abstract class CloudletScheduler {
/**
* Cancels execution of a cloudlet.
*
*
* @param clId ID of the cloudlet being cancealed
*
* @return the canceled cloudlet, $null if not found
*
* @pre $none
* @post $none
*/
......@@ -92,11 +83,9 @@ public abstract class CloudletScheduler {
/**
* Pauses execution of a cloudlet.
*
*
* @param clId ID of the cloudlet being paused
*
* @return $true if cloudlet paused, $false otherwise
*
* @pre $none
* @post $none
*/
......@@ -104,11 +93,9 @@ public abstract class CloudletScheduler {
/**
* Resumes execution of a paused cloudlet.
*
*
* @param clId ID of the cloudlet being resumed
*
* @return expected finish time of the cloudlet, 0.0 if queued
*
* @pre $none
* @post $none
*/
......@@ -116,9 +103,8 @@ public abstract class CloudletScheduler {
/**
* Processes a finished cloudlet.
*
*
* @param rcl finished cloudlet
*
* @pre rgl != $null
* @post $none
*/
......@@ -126,22 +112,18 @@ public abstract class CloudletScheduler {
/**
* Gets the status of a cloudlet.
*
*
* @param clId ID of the cloudlet
*
* @return status of the cloudlet, -1 if cloudlet not found
*
* @pre $none
* @post $none
*/
public abstract int getCloudletStatus(int clId);
/**
* Informs about completion of some cloudlet in the VM managed
* by this scheduler.
*
* Informs about completion of some cloudlet in the VM managed by this scheduler.
*
* @return $true if there is at least one finished cloudlet; $false otherwise
*
* @pre $none
* @post $none
*/
......@@ -149,9 +131,8 @@ public abstract class CloudletScheduler {
/**
* Returns the next cloudlet in the finished list, $null if this list is empty.
*
*
* @return a finished cloudlet
*
* @pre $none
* @post $none
*/
......@@ -159,9 +140,8 @@ public abstract class CloudletScheduler {
/**
* Returns the number of cloudlets runnning in the virtual machine.
*
*
* @return number of cloudlets runnning
*
* @pre $none
* @post $none
*/
......@@ -169,9 +149,8 @@ public abstract class CloudletScheduler {
/**
* Returns one cloudlet to migrate to another vm.
*
*
* @return one running cloudlet
*
* @pre $none
* @post $none
*/
......@@ -179,67 +158,63 @@ public abstract class CloudletScheduler {
/**
* Get utilization created by all cloudlets.
*
*
* @param time the time
*
* @return total utilization
*/
public abstract double getTotalUtilizationOfCpu(double time);
/**
* Gets the current requested mips.
*
*
* @return the current mips
*/
public abstract List<Double> getCurrentRequestedMips();
/**
* Gets the total current mips for the Cloudlet.
*
*
* @param rcl the rcl
* @param mipsShare the mips share
*
* @return the total current mips
*/
public abstract double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare);
/**
* Gets the total current requested mips for cloudlet.
*
*
* @param rcl the rcl
* @param time the time
*
* @return the total current requested mips for cloudlet
*/
public abstract double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time);
/**
* Gets the total current allocated mips for cloudlet.
*
*
* @param rcl the rcl
* @param time the time
*
* @return the total current allocated mips for cloudlet
*/
public abstract double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time);
/**
* Gets the current requested ram.
*
*
* @return the current requested ram
*/
public abstract double getCurrentRequestedUtilizationOfRam();
/**
* Gets the current requested bw.
*
*
* @return the current requested bw
*/
public abstract double getCurrentRequestedUtilizationOfBw();
/**
* Gets the previous time.
*
*
* @return the previous time
*/
public double getPreviousTime() {
......@@ -248,7 +223,7 @@ public abstract class CloudletScheduler {
/**
* Sets the previous time.
*
*
* @param previousTime the new previous time
*/
protected void setPreviousTime(double previousTime) {
......@@ -257,7 +232,7 @@ public abstract class CloudletScheduler {
/**
* Sets the current mips share.
*
*
* @param currentMipsShare the new current mips share
*/
protected void setCurrentMipsShare(List<Double> currentMipsShare) {
......@@ -266,7 +241,7 @@ public abstract class CloudletScheduler {
/**
* Gets the current mips share.
*
*
* @return the current mips share
*/
public List<Double> getCurrentMipsShare() {
......
......@@ -2,7 +2,7 @@
* Title: CloudSim Toolkit Description: CloudSim (Cloud Simulation) Toolkit for Modeling and
* Simulation of Clouds Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2010, The University of Melbourne, Australia
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim;
......@@ -59,10 +59,8 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param currentTime current simulation time
* @param mipsShare array with MIPS share of each Pe available to the scheduler
*
* @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is
* no next events
*
* @pre currentTime >= 0
* @post $none
*/
......@@ -110,9 +108,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
* Receives an cloudlet to be executed in the VM managed by this scheduler.
*
* @param cl the cl
*
* @return predicted completion time
*
* @pre _gl != null
* @post $none
*/
......@@ -126,9 +122,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param cl the cl
* @param fileTransferTime the file transfer time
*
* @return predicted completion time
*
* @pre _gl != null
* @post $none
*/
......@@ -149,7 +143,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
* Processes a finished cloudlet.
*
* @param rcl finished cloudlet
*
* @pre rgl != $null
* @post $none
*/
......@@ -164,7 +157,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
* Get utilization created by all cloudlets.
*
* @param time the time
*
* @return total utilization
*/
@Override
......@@ -205,7 +197,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param rcl the rcl
* @param time the time
*
* @return the current mips
*/
@Override
......@@ -218,7 +209,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param rcl the rcl
* @param mipsShare the mips share
*
* @return the total current mips
*/
@Override
......@@ -242,7 +232,6 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
*
* @param rcl the rcl
* @param time the time
*
* @return the current mips
*/
@Override
......
......@@ -2,7 +2,7 @@
* Title: CloudSim Toolkit Description: CloudSim (Cloud Simulation) Toolkit for Modeling and
* Simulation of Clouds Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2010, The University of Melbourne, Australia
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim;
......@@ -65,7 +65,6 @@ public class Datacenter extends SimEntity {
* @param characteristics an object of DatacenterCharacteristics
* @param storageList a LinkedList of storage elements, for data simulation
* @param vmAllocationPolicy the vmAllocationPolicy
*
* @throws Exception This happens when one of the following scenarios occur:
* <ul>
* <li>creating this entity before initializing CloudSim package
......@@ -74,7 +73,6 @@ public class Datacenter extends SimEntity {
* 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>
*
* @pre name != null
* @pre resource != null
* @post $none
......@@ -124,14 +122,12 @@ public class Datacenter extends SimEntity {
* Processes events or services that are available for this PowerDatacenter.
*
* @param ev a Sim_event object
*
* @pre ev != null
* @post $none
*/
@Override
public void processEvent(SimEvent ev) {
int srcId = -1;
// Log.printLine(CloudSim.clock()+"[PowerDatacenter]: event received:"+ev.getTag());
switch (ev.getTag()) {
// Resource characteristics inquiry
......@@ -357,7 +353,6 @@ public class Datacenter extends SimEntity {
* Processes a ping request.
*
* @param ev a Sim_event object
*
* @pre ev != null
* @post $none
*/
......@@ -375,7 +370,6 @@ public class Datacenter extends SimEntity {
* PowerDatacenter will then send the status back to the User/Broker.
*
* @param ev a Sim_event object
*
* @pre ev != null
* @post $none
*/
......@@ -430,7 +424,6 @@ public class Datacenter extends SimEntity {
* method.
*
* @param ev the received event
*
* @pre $none
* @post $none
*/
......@@ -446,7 +439,6 @@ public class Datacenter extends SimEntity {
*
* @param ev a Sim_event object
* @param ack the ack
*
* @pre ev != null
* @post $none
*/
......@@ -497,7 +489,6 @@ public class Datacenter extends SimEntity {
*
* @param ev a Sim_event object
* @param ack the ack
*
* @pre ev != null
* @post $none
*/
......@@ -581,7 +572,6 @@ public class Datacenter extends SimEntity {
*
* @param ev a Sim_event object
* @param type event type
*
* @pre ev != null
* @pre type > 0
* @post $none
......@@ -648,7 +638,6 @@ public class Datacenter extends SimEntity {
*
* @param receivedData information about the migration
* @param type event tag
*
* @pre receivedData != null
* @pre type > 0
* @post $none
......@@ -690,11 +679,8 @@ public class Datacenter extends SimEntity {
if (vm == null) {
failed = true;
} else {
double fileTransferTime = predictFileTransferTime(cl.getRequiredFiles()); // time
// to
// transfer
// the
// files
// time to transfer the files
double fileTransferTime = predictFileTransferTime(cl.getRequiredFiles());
vm.getCloudletScheduler().cloudletSubmit(cl, fileTransferTime);
}
} else {// the cloudlet will migrate from one resource to another
......@@ -722,7 +708,6 @@ public class Datacenter extends SimEntity {
*
* @param ev a SimEvent object
* @param ack an acknowledgement
*
* @pre ev != null
* @post $none
*/
......@@ -769,29 +754,17 @@ public class Datacenter extends SimEntity {
int userId = cl.getUserId();
int vmId = cl.getVmId();
double fileTransferTime = predictFileTransferTime(cl.getRequiredFiles()); // time to
// transfer
// the files
// time to transfer the files
double fileTransferTime = predictFileTransferTime(cl.getRequiredFiles());
Host host = getVmAllocationPolicy().getHost(vmId, userId);
Vm vm = host.getVm(vmId, userId);
CloudletScheduler scheduler = vm.getCloudletScheduler();
double estimatedFinishTime = scheduler.cloudletSubmit(cl, fileTransferTime);
// if (estimatedFinishTime > 0.0 && estimatedFinishTime < getSchedulingInterval()) {
// //if this cloudlet is in the exec queue
if (estimatedFinishTime > 0.0 && !Double.isInfinite(estimatedFinishTime)) { // if this
// cloudlet
// is in the
// exec
// queue
// double estimatedFinishTime =
// (cl.getCloudletTotalLength()/(capacity*cl.getPesNumber())); //time to process the
// cloudlet
// Log.printLine(estimatedFinishTime+"="+gl.getCloudletLength()+"/("+capacity+"*"+gl.getNumPE()+")");
// if this cloudlet is in the exec queue
if (estimatedFinishTime > 0.0 && !Double.isInfinite(estimatedFinishTime)) {
estimatedFinishTime += fileTransferTime;
// estimatedFinishTime += CloudSim.clock();
// Log.printLine(CloudSim.clock()+": Next event scheduled to +"+estimatedFinishTime);
send(getId(), estimatedFinishTime, CloudSimTags.VM_DATACENTER_EVENT);
}
......@@ -820,7 +793,6 @@ public class Datacenter extends SimEntity {
* Predict file transfer time.
*
* @param requiredFiles the required files
*
* @return the double
*/
protected double predictFileTransferTime(List<String> requiredFiles) {
......@@ -848,7 +820,6 @@ public class Datacenter extends SimEntity {
* @param userId ID of the cloudlet's owner
* @param ack $true if an ack is requested after operation
* @param vmId the vm id
*
* @pre $none
* @post $none
*/
......@@ -884,7 +855,6 @@ public class Datacenter extends SimEntity {
* @param userId ID of the cloudlet's owner
* @param ack $true if an ack is requested after operation
* @param vmId the vm id
*
* @pre $none
* @post $none
*/
......@@ -911,7 +881,6 @@ public class Datacenter extends SimEntity {
* @param cloudletId resuming cloudlet ID
* @param userId ID of the cloudlet's owner
* @param vmId the vm id
*
* @pre $none
* @post $none
*/
......@@ -931,7 +900,6 @@ public class Datacenter extends SimEntity {
* @post $none
*/
protected void updateCloudletProcessing() {
// Log.printLine(CloudSim.clock()+": PowerDatacenter #: updating cloudlet processing.......................................");
// if some time passed since last processing
// R: for term is to allow loop at simulation start. Otherwise, one initial
// simulation step is skipped and schedulers are not properly initialized
......@@ -941,8 +909,8 @@ public class Datacenter extends SimEntity {
// for each host...
for (int i = 0; i < list.size(); i++) {
Host host = list.get(i);
double time = host.updateVmsProcessing(CloudSim.clock());// inform VMs to update
// processing
// inform VMs to update processing
double time = host.updateVmsProcessing(CloudSim.clock());
// what time do we expect that the next cloudlet will finish?
if (time < smallerTime) {
smallerTime = time;
......@@ -986,7 +954,6 @@ public class Datacenter extends SimEntity {
* file, then it will be registered to the RC when the experiment begins.
*
* @param file a DataCloud file
*
* @return a tag number denoting whether this operation is a success or not
*/
public int addFile(File file) {
......@@ -1022,7 +989,6 @@ public class Datacenter extends SimEntity {
* Checks whether the resource has the given file.
*
* @param file a file to be searched
*
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
*/
protected boolean contains(File file) {
......@@ -1036,7 +1002,6 @@ public class Datacenter extends SimEntity {
* Checks whether the resource has the given file.
*
* @param fileName a file name to be searched
*
* @return <tt>true</tt> if successful, <tt>false</tt> otherwise
*/
protected boolean contains(String fileName) {
......@@ -1064,7 +1029,6 @@ public class Datacenter extends SimEntity {
* the storage.
*
* @param fileName the name of the file to be deleted
*
* @return the error message
*/
private int deleteFileFromStorage(String fileName) {
......@@ -1102,7 +1066,6 @@ public class Datacenter extends SimEntity {
/*
* (non-Javadoc)
*
* @see cloudsim.core.SimEntity#shutdownEntity()
*/
@Override
......@@ -1112,7 +1075,6 @@ public class Datacenter extends SimEntity {
/*
* (non-Javadoc)
*
* @see cloudsim.core.SimEntity#startEntity()
*/
@Override
......
This diff is collapsed.
This diff is collapsed.
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