Commit 45cfcbff authored by Anton Beloglazov's avatar Anton Beloglazov

- Updated headers (copyrights)

- Updated javadocs (authors and some class descriptions)
parent 53023e7a
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.List; import java.util.List;
/** /**
* This class represents the coordinator of a federation of clouds. * This class represents the coordinator of a federation of clouds.
* It interacts with other clouds coordinators in order to exchange * It interacts with other clouds coordinators in order to exchange
* virtual machines and user applicatoins, if required. * virtual machines and user applicatoins, if required.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public abstract class CloudCoordinator { public abstract class CloudCoordinator {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -21,8 +20,8 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -21,8 +20,8 @@ import org.cloudbus.cloudsim.core.CloudSim;
* encapsulated in the Cloudlet, the ID of the VM running it. * encapsulated in the Cloudlet, the ID of the VM running it.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class Cloudlet { public class Cloudlet {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -18,8 +17,8 @@ import java.util.List; ...@@ -18,8 +17,8 @@ import java.util.List;
* management is also implemented in this class. * management is also implemented in this class.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public abstract class CloudletScheduler { public abstract class CloudletScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -19,6 +18,9 @@ import java.util.Map; ...@@ -19,6 +18,9 @@ import java.util.Map;
* scheduling performed by a virtual machine assuming * scheduling performed by a virtual machine assuming
* that there is just one cloudlet which is working as * that there is just one cloudlet which is working as
* an online service. * an online service.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class CloudletSchedulerSingleService extends CloudletSchedulerTimeShared { public class CloudletSchedulerSingleService extends CloudletSchedulerTimeShared {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -23,8 +22,8 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -23,8 +22,8 @@ import org.cloudbus.cloudsim.core.CloudSim;
* data transfer happens as soon as cloudlets are submitted. * data transfer happens as soon as cloudlets are submitted.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class CloudletSchedulerSpaceShared extends CloudletScheduler { public class CloudletSchedulerSpaceShared extends CloudletScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -20,8 +19,8 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -20,8 +19,8 @@ import org.cloudbus.cloudsim.core.CloudSim;
* Cloudlets execute time-shared in VM. * Cloudlets execute time-shared in VM.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class CloudletSchedulerTimeShared extends CloudletScheduler { public class CloudletSchedulerTimeShared extends CloudletScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2006, The University of Melbourne, Australia and *
* University of Ljubljana, Slovenia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -14,8 +13,9 @@ package org.cloudbus.cloudsim; ...@@ -14,8 +13,9 @@ package org.cloudbus.cloudsim;
* such as file information retrieval, file transfers, and * such as file information retrieval, file transfers, and
* storage info. * storage info.
* *
* @author Uros Cibej and Anthony Sulistio * @author Uros Cibej
* @since CloudSim Toolkit 4.0 * @author Anthony Sulistio
* @since CloudSim Toolkit 1.0
*/ */
public final class DataCloudTags { public final class DataCloudTags {
// to prevent a conflict with the existing CloudSimTags values // to prevent a conflict with the existing CloudSimTags values
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -31,8 +30,8 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -31,8 +30,8 @@ import org.cloudbus.cloudsim.core.SimEvent;
* and processing of VirtualMachines are handled by the VmAllocationPolicy. * and processing of VirtualMachines are handled by the VmAllocationPolicy.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class Datacenter extends SimEntity { public class Datacenter extends SimEntity {
...@@ -629,9 +628,7 @@ public class Datacenter extends SimEntity { ...@@ -629,9 +628,7 @@ public class Datacenter extends SimEntity {
debts.put(vm.getUserId(), amount); debts.put(vm.getUserId(), amount);
if (!Log.isDisabled()) { Log.formatLine("%.2f: Migration of VM #%d to Host #%d is completed", CloudSim.clock(), vm.getId(), host.getId());
Log.print(String.format("%.2f: Migration of VM #%d to Host #%d is completed\n", CloudSim.clock(), vm.getId(), host.getId()));
}
vm.setInMigration(false); vm.setInMigration(false);
} }
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -29,8 +28,8 @@ import org.cloudbus.cloudsim.lists.VmList; ...@@ -29,8 +28,8 @@ import org.cloudbus.cloudsim.lists.VmList;
* and destruction of VMs. * and destruction of VMs.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class DatacenterBroker extends SimEntity { public class DatacenterBroker extends SimEntity {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -21,10 +20,11 @@ import org.cloudbus.cloudsim.lists.PeList; ...@@ -21,10 +20,11 @@ import org.cloudbus.cloudsim.lists.PeList;
* policy (time- or space-shared), cost and time zone at which the resource * policy (time- or space-shared), cost and time zone at which the resource
* is located along resource configuration. * is located along resource configuration.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class DatacenterCharacteristics { public class DatacenterCharacteristics {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -32,8 +31,7 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -32,8 +31,7 @@ import org.cloudbus.cloudsim.core.SimEvent;
* and processing of VirtualMachines are handled by the VmAllocationPolicy. * and processing of VirtualMachines are handled by the VmAllocationPolicy.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class FederatedDatacenter extends SimEntity { public class FederatedDatacenter extends SimEntity {
...@@ -658,9 +656,7 @@ public class FederatedDatacenter extends SimEntity { ...@@ -658,9 +656,7 @@ public class FederatedDatacenter extends SimEntity {
debts.put(vm.getUserId(), amount); debts.put(vm.getUserId(), amount);
if (!Log.isDisabled()) { Log.formatLine("%.2f: Migration of VM #%d to Host #%d is completed", CloudSim.clock(), vm.getId(), host.getId());
Log.print(String.format("%.2f: Migration of VM #%d to Host #%d is completed\n", CloudSim.clock(), vm.getId(), host.getId()));
}
vm.setInMigration(false); vm.setInMigration(false);
} }
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2006, The University of Melbourne, Australia and *
* University of Ljubljana, Slovenia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
/** /**
* A class for representing a physical file in a DataCloud environment * A class for representing a physical file in a DataCloud environment
* *
* @author Uros Cibej and Anthony Sulistio * @author Uros Cibej
* @since CloudSim Toolkit 4.0 * @author Anthony Sulistio
* @since CloudSim Toolkit 1.0
*/ */
public class File { public class File {
private String name; // logical file name private String name; // logical file name
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2006, The University of Melbourne, Australia and *
* University of Ljubljana, Slovenia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -13,15 +12,14 @@ import java.util.Date; ...@@ -13,15 +12,14 @@ import java.util.Date;
import org.cloudbus.cloudsim.core.CloudSim; import org.cloudbus.cloudsim.core.CloudSim;
/** /**
* A class for storing related information regarding to a * A class for storing related information regarding to a
* {@link gridsim.datagrid.File} entity. * {@link gridsim.datagrid.File} entity.
* *
* @author Uros Cibej and Anthony Sulistio * @author Uros Cibej
* @since CloudSim Toolkit 4.0 * @author Anthony Sulistio
* @since CloudSim Toolkit 1.0
*/ */
public class FileAttribute { public class FileAttribute {
private String name; // logical file name private String name; // logical file name
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2006, The University of Melbourne, Australia and *
* University of Ljubljana, Slovenia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -25,9 +24,9 @@ import org.cloudbus.cloudsim.distributions.ContinuousDistribution; ...@@ -25,9 +24,9 @@ import org.cloudbus.cloudsim.distributions.ContinuousDistribution;
* <li> max transfer rate = 133 MB/sec * <li> max transfer rate = 133 MB/sec
* </ul> * </ul>
* *
* @author Uros Cibej and Anthony Sulistio * @author Uros Cibej
* @since CloudSim Toolkit 4.0 * @author Anthony Sulistio
* @see gridsim.datagrid.storage.Storage * @since CloudSim Toolkit 1.0
*/ */
public class HarddriveStorage implements Storage { public class HarddriveStorage implements Storage {
...@@ -123,6 +122,7 @@ public class HarddriveStorage implements Storage { ...@@ -123,6 +122,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the available space in MB * @return the available space in MB
*/ */
@Override
public double getAvailableSpace() { public double getAvailableSpace() {
return capacity - currentSize; return capacity - currentSize;
} }
...@@ -133,6 +133,7 @@ public class HarddriveStorage implements Storage { ...@@ -133,6 +133,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if the storage is full, <tt>false</tt> * @return <tt>true</tt> if the storage is full, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean isFull() { public boolean isFull() {
if (Math.abs(currentSize - capacity) < .0000001) { // currentSize == capacity if (Math.abs(currentSize - capacity) < .0000001) { // currentSize == capacity
return true; return true;
...@@ -145,6 +146,7 @@ public class HarddriveStorage implements Storage { ...@@ -145,6 +146,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the number of stored files * @return the number of stored files
*/ */
@Override
public int getNumStoredFile() { public int getNumStoredFile() {
return fileList.size(); return fileList.size();
} }
...@@ -157,6 +159,7 @@ public class HarddriveStorage implements Storage { ...@@ -157,6 +159,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if reservation succeeded, <tt>false</tt> * @return <tt>true</tt> if reservation succeeded, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean reserveSpace(int fileSize) { public boolean reserveSpace(int fileSize) {
if (fileSize <= 0) { if (fileSize <= 0) {
return false; return false;
...@@ -179,6 +182,7 @@ public class HarddriveStorage implements Storage { ...@@ -179,6 +182,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the time (in seconds) required to add the file * @return the time (in seconds) required to add the file
*/ */
@Override
public double addReservedFile(File file) { public double addReservedFile(File file) {
if (file == null) { if (file == null) {
return 0; return 0;
...@@ -203,6 +207,7 @@ public class HarddriveStorage implements Storage { ...@@ -203,6 +207,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if enough space available, <tt>false</tt> * @return <tt>true</tt> if enough space available, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean hasPotentialAvailableSpace(int fileSize) { public boolean hasPotentialAvailableSpace(int fileSize) {
if (fileSize <= 0) { if (fileSize <= 0) {
return false; return false;
...@@ -240,6 +245,7 @@ public class HarddriveStorage implements Storage { ...@@ -240,6 +245,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the capacity of the storage in MB * @return the capacity of the storage in MB
*/ */
@Override
public double getCapacity() { public double getCapacity() {
return capacity; return capacity;
} }
...@@ -249,6 +255,7 @@ public class HarddriveStorage implements Storage { ...@@ -249,6 +255,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the current size of the stored files in MB * @return the current size of the stored files in MB
*/ */
@Override
public double getCurrentSize() { public double getCurrentSize() {
return currentSize; return currentSize;
} }
...@@ -258,6 +265,7 @@ public class HarddriveStorage implements Storage { ...@@ -258,6 +265,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the name of this storage * @return the name of this storage
*/ */
@Override
public String getName() { public String getName() {
return name; return name;
} }
...@@ -296,6 +304,7 @@ public class HarddriveStorage implements Storage { ...@@ -296,6 +304,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if the setting succeeded, <tt>false</tt> * @return <tt>true</tt> if the setting succeeded, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean setMaxTransferRate(int rate) { public boolean setMaxTransferRate(int rate) {
if (rate <= 0) { if (rate <= 0) {
return false; return false;
...@@ -310,6 +319,7 @@ public class HarddriveStorage implements Storage { ...@@ -310,6 +319,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the maximum transfer rate in MB/sec * @return the maximum transfer rate in MB/sec
*/ */
@Override
public double getMaxTransferRate() { public double getMaxTransferRate() {
return maxTransferRate; return maxTransferRate;
} }
...@@ -364,6 +374,7 @@ public class HarddriveStorage implements Storage { ...@@ -364,6 +374,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the file with the specified filename * @return the file with the specified filename
*/ */
@Override
public File getFile(String fileName) { public File getFile(String fileName) {
// check first whether file name is valid or not // check first whether file name is valid or not
File obj = null; File obj = null;
...@@ -410,6 +421,7 @@ public class HarddriveStorage implements Storage { ...@@ -410,6 +421,7 @@ public class HarddriveStorage implements Storage {
* *
* @return a List of file names * @return a List of file names
*/ */
@Override
public List<String> getFileNameList() { public List<String> getFileNameList() {
return nameList; return nameList;
} }
...@@ -493,6 +505,7 @@ public class HarddriveStorage implements Storage { ...@@ -493,6 +505,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the time taken (in seconds) for adding the specified file * @return the time taken (in seconds) for adding the specified file
*/ */
@Override
public double addFile(File file) { public double addFile(File file) {
double result = 0.0; double result = 0.0;
// check if the file is valid or not // check if the file is valid or not
...@@ -531,6 +544,7 @@ public class HarddriveStorage implements Storage { ...@@ -531,6 +544,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the time taken (in seconds) for adding the specified files * @return the time taken (in seconds) for adding the specified files
*/ */
@Override
public double addFile(List<File> list) { public double addFile(List<File> list) {
double result = 0.0; double result = 0.0;
if (list == null || list.isEmpty()) { if (list == null || list.isEmpty()) {
...@@ -556,6 +570,7 @@ public class HarddriveStorage implements Storage { ...@@ -556,6 +570,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the deleted file * @return the deleted file
*/ */
@Override
public File deleteFile(String fileName) { public File deleteFile(String fileName) {
if (fileName == null || fileName.length() == 0) { if (fileName == null || fileName.length() == 0) {
return null; return null;
...@@ -590,6 +605,7 @@ public class HarddriveStorage implements Storage { ...@@ -590,6 +605,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the time taken (in seconds) for deleting the specified file * @return the time taken (in seconds) for deleting the specified file
*/ */
@Override
public double deleteFile(String fileName, File file) { public double deleteFile(String fileName, File file) {
return deleteFile(file); return deleteFile(file);
} }
...@@ -604,6 +620,7 @@ public class HarddriveStorage implements Storage { ...@@ -604,6 +620,7 @@ public class HarddriveStorage implements Storage {
* *
* @return the time taken (in seconds) for deleting the specified file * @return the time taken (in seconds) for deleting the specified file
*/ */
@Override
public double deleteFile(File file) { public double deleteFile(File file) {
double result = 0.0; double result = 0.0;
// check if the file is valid or not // check if the file is valid or not
...@@ -632,6 +649,7 @@ public class HarddriveStorage implements Storage { ...@@ -632,6 +649,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if the file is in the storage, <tt>false</tt> * @return <tt>true</tt> if the file is in the storage, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean contains(String fileName) { public boolean contains(String fileName) {
boolean result = false; boolean result = false;
if (fileName == null || fileName.length() == 0) { if (fileName == null || fileName.length() == 0) {
...@@ -659,6 +677,7 @@ public class HarddriveStorage implements Storage { ...@@ -659,6 +677,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if the file is in the storage, <tt>false</tt> * @return <tt>true</tt> if the file is in the storage, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean contains(File file) { public boolean contains(File file) {
boolean result = false; boolean result = false;
if (!isFileValid(file, "contains()")) { if (!isFileValid(file, "contains()")) {
...@@ -680,6 +699,7 @@ public class HarddriveStorage implements Storage { ...@@ -680,6 +699,7 @@ public class HarddriveStorage implements Storage {
* @return <tt>true</tt> if the renaming succeeded, <tt>false</tt> * @return <tt>true</tt> if the renaming succeeded, <tt>false</tt>
* otherwise * otherwise
*/ */
@Override
public boolean renameFile(File file, String newName) { public boolean renameFile(File file, String newName) {
// check whether the new filename is conflicting with existing ones // check whether the new filename is conflicting with existing ones
// or not // or not
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -26,8 +25,8 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner; ...@@ -26,8 +25,8 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
* A host is associated to a datacenter. It can host virtual machines. * A host is associated to a datacenter. It can host virtual machines.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class Host { public class Host {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -12,6 +20,9 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner; ...@@ -12,6 +20,9 @@ import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/** /**
* The Class HostDynamicWorkload. * The Class HostDynamicWorkload.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class HostDynamicWorkload extends Host { public class HostDynamicWorkload extends Host {
...@@ -88,9 +99,7 @@ public class HostDynamicWorkload extends Host { ...@@ -88,9 +99,7 @@ public class HostDynamicWorkload extends Host {
updateUnderAllocatedMips(vm, totalRequestedMips, totalAllocatedMips); updateUnderAllocatedMips(vm, totalRequestedMips, totalAllocatedMips);
if (!Log.isDisabled()) { Log.formatLine("%.2f: Total allocated MIPS for VM #" + vm.getId() + " (Host #" + vm.getHost().getId() + ") is %.2f, was requested %.2f out of total %.2f (%.2f%%)", CloudSim.clock(), totalAllocatedMips, totalRequestedMips, vm.getMips(), totalRequestedMips / vm.getMips() * 100);
Log.print(String.format("%.2f: Total allocated MIPS for VM #" + vm.getId() + " (Host #" + vm.getHost().getId() + ") is %.2f, was requested %.2f out of total %.2f (%.2f%%)\n", CloudSim.clock(), totalAllocatedMips, totalRequestedMips, vm.getMips(), totalRequestedMips / vm.getMips() * 100));
}
if (vm.isInMigration()) { if (vm.isInMigration()) {
Log.printLine("VM #" + vm.getId() + " is in migration"); Log.printLine("VM #" + vm.getId() + " is in migration");
......
...@@ -35,11 +35,10 @@ import org.cloudbus.cloudsim.core.CloudSimTags; ...@@ -35,11 +35,10 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
* class of an InfoPacket to the same as the NetPacket, and send it to the same * class of an InfoPacket to the same as the NetPacket, and send it to the same
* destination from the same source. * destination from the same source.
* *
* @since CloudSim Toolkit 3.1 * @author Gokul Poduval
* @author Gokul Poduval & Chen-Khong Tham, National University of Singapore * @author Chen-Khong Tham, National University of Singapore
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class InfoPacket implements Packet { public class InfoPacket implements Packet {
/** The name. */ /** The name. */
...@@ -145,6 +144,7 @@ public class InfoPacket implements Packet { ...@@ -145,6 +144,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getId() { public int getId() {
return packetId; return packetId;
} }
...@@ -246,6 +246,7 @@ public class InfoPacket implements Packet { ...@@ -246,6 +246,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public long getSize() { public long getSize() {
return size; return size;
} }
...@@ -260,6 +261,7 @@ public class InfoPacket implements Packet { ...@@ -260,6 +261,7 @@ public class InfoPacket implements Packet {
* @pre size >= 0 * @pre size >= 0
* @post $none * @post $none
*/ */
@Override
public boolean setSize(long size) { public boolean setSize(long size) {
if (size < 0) { if (size < 0) {
return false; return false;
...@@ -277,6 +279,7 @@ public class InfoPacket implements Packet { ...@@ -277,6 +279,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getDestId() { public int getDestId() {
return destId; return destId;
} }
...@@ -289,6 +292,7 @@ public class InfoPacket implements Packet { ...@@ -289,6 +292,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getSrcId() { public int getSrcId() {
return srcId; return srcId;
} }
...@@ -504,6 +508,7 @@ public class InfoPacket implements Packet { ...@@ -504,6 +508,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getLast() { public int getLast() {
return last; return last;
} }
...@@ -516,6 +521,7 @@ public class InfoPacket implements Packet { ...@@ -516,6 +521,7 @@ public class InfoPacket implements Packet {
* @pre last > 0 * @pre last > 0
* @post $none * @post $none
*/ */
@Override
public void setLast(int last) { public void setLast(int last) {
this.last = last; this.last = last;
} }
...@@ -528,6 +534,7 @@ public class InfoPacket implements Packet { ...@@ -528,6 +534,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getNetServiceType() { public int getNetServiceType() {
return netServiceType ; return netServiceType ;
} }
...@@ -540,6 +547,7 @@ public class InfoPacket implements Packet { ...@@ -540,6 +547,7 @@ public class InfoPacket implements Packet {
* @pre netServiceType >= 0 * @pre netServiceType >= 0
* @post $none * @post $none
*/ */
@Override
public void setNetServiceType(int netServiceType) { public void setNetServiceType(int netServiceType) {
this.netServiceType = netServiceType ; this.netServiceType = netServiceType ;
} }
...@@ -552,6 +560,7 @@ public class InfoPacket implements Packet { ...@@ -552,6 +560,7 @@ public class InfoPacket implements Packet {
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
public int getTag() { public int getTag() {
return tag ; return tag ;
} }
......
/* /*
* 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
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
/** /**
* The Class Log. * The Log class used for performing loggin of the simulation process.
* It provides the ability to substitute the output stream by any
* OutputStream subclass.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class Log { public class Log {
/** The Constant LINE_SEPARATOR. */
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
/** The output. */ /** The output. */
private static OutputStream output; private static OutputStream output;
...@@ -21,8 +34,6 @@ public class Log { ...@@ -21,8 +34,6 @@ public class Log {
* Prints the message. * Prints the message.
* *
* @param message the message * @param message the message
*
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void print(String message) { public static void print(String message) {
if (!isDisabled()) { if (!isDisabled()) {
...@@ -35,70 +46,68 @@ public class Log { ...@@ -35,70 +46,68 @@ public class Log {
} }
/** /**
* Prints the message. * Prints the message passed as a non-String object.
* *
* @param message the message * @param message the message
*
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void print(long message) { public static void print(Object message) {
if (!isDisabled()) {
print(String.valueOf(message)); print(String.valueOf(message));
} }
}
/** /**
* Prints the message. * Prints the line.
* *
* @param message the message * @param message the message
*
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void print(double message) { public static void printLine(String message) {
print(String.valueOf(message)); if (!isDisabled()) {
print(message + LINE_SEPARATOR);
}
} }
/** /**
* Prints the line. * Prints the empty line.
*
* @param message the message
*
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void printLine(String message) { public static void printLine() {
if (!isDisabled()) { if (!isDisabled()) {
print(message + System.getProperty("line.separator")); print(LINE_SEPARATOR);
} }
} }
/** /**
* Prints the line. * Prints the line passed as a non-String object.
* *
* @param message the message * @param message the message
*
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void printLine(long message) { public static void printLine(Object message) {
if (!isDisabled()) {
printLine(String.valueOf(message)); printLine(String.valueOf(message));
} }
}
/** /**
* Prints the line. * Prints a string formated as in String.format().
* *
* @param message the message * @param format the format
* * @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/ */
public static void printLine(double message) { public static void format(String format, Object... args ) {
printLine(String.valueOf(message)); if (!isDisabled()) {
print(String.format(format, args));
}
} }
/** /**
* Prints the empty line. * Prints a line formated as in String.format().
* *
* @throws IOException Signals that an I/O exception has occurred. * @param format the format
* @param args the args
*/ */
public static void printLine() { public static void formatLine(String format, Object... args ) {
if (!isDisabled()) { if (!isDisabled()) {
printLine(""); printLine(String.format(format, args));
} }
} }
...@@ -126,7 +135,7 @@ public class Log { ...@@ -126,7 +135,7 @@ public class Log {
/** /**
* Sets the disable output flag. * Sets the disable output flag.
* *
* @param disabled the new disabled * @param _disabled the new disabled
*/ */
public static void setDisabled(boolean _disabled) { public static void setDisabled(boolean _disabled) {
disabled = _disabled; disabled = _disabled;
...@@ -141,4 +150,18 @@ public class Log { ...@@ -141,4 +150,18 @@ public class Log {
return disabled; return disabled;
} }
/**
* Disables the output.
*/
public static void disable() {
setDisabled(true);
}
/**
* Enables the output.
*/
public static void enable() {
setDisabled(false);
}
} }
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -20,7 +19,6 @@ import org.cloudbus.cloudsim.network.TopologicalGraph; ...@@ -20,7 +19,6 @@ import org.cloudbus.cloudsim.network.TopologicalGraph;
import org.cloudbus.cloudsim.network.TopologicalLink; import org.cloudbus.cloudsim.network.TopologicalLink;
import org.cloudbus.cloudsim.network.TopologicalNode; import org.cloudbus.cloudsim.network.TopologicalNode;
/** /**
* NetworkTopology is a class that implements network layer * NetworkTopology is a class that implements network layer
* in CloudSim. It reads a BRITE file and generates a * in CloudSim. It reads a BRITE file and generates a
...@@ -36,8 +34,8 @@ import org.cloudbus.cloudsim.network.TopologicalNode; ...@@ -36,8 +34,8 @@ import org.cloudbus.cloudsim.network.TopologicalNode;
* one entity at a time. * one entity at a time.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class NetworkTopology { public class NetworkTopology {
...@@ -123,7 +121,7 @@ public class NetworkTopology { ...@@ -123,7 +121,7 @@ public class NetworkTopology {
} }
//generate a new link //generate a new link
graph.addLink(new TopologicalLink((int)map.get(srcId),(int)map.get(destId),(float)lat,(float)bw)); graph.addLink(new TopologicalLink(map.get(srcId),map.get(destId),(float)lat,(float)bw));
generateMatrices(); generateMatrices();
......
...@@ -16,21 +16,21 @@ ...@@ -16,21 +16,21 @@
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
/** /**
* This class contains the structure for a network packet. * This class contains the structure for a network packet.
* *
* @since CloudSim Toolkit 3.1 * @author Gokul Poduval
* @author Gokul Poduval & Chen-Khong Tham, National University of Singapore * @author Chen-Khong Tham, National University of Singapore
* @since CloudSim Toolkit 1.0
*/ */
public interface Packet public interface Packet {
{
/** /**
* Returns a string describing this packet in detail. * Returns a string describing this packet in detail.
* @return description of this packet * @return description of this packet
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
@Override
String toString(); String toString();
/** /**
...@@ -117,5 +117,4 @@ public interface Packet ...@@ -117,5 +117,4 @@ public interface Packet
*/ */
int getTag(); int getTag();
} // end interface }
...@@ -20,9 +20,9 @@ package org.cloudbus.cloudsim; ...@@ -20,9 +20,9 @@ package org.cloudbus.cloudsim;
* This exception is to report bad or invalid parameters given during * This exception is to report bad or invalid parameters given during
* constructor. * constructor.
* *
* @invariant $none * @author Gokul Poduval
* @since CloudSim Toolkit 3.1 * @author Chen-Khong Tham, National University of Singapore
* @author Gokul Poduval & Chen-Khong Tham, National University of Singapore * @since CloudSim Toolkit 1.0
*/ */
public class ParameterException extends Exception { public class ParameterException extends Exception {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -16,9 +15,9 @@ import org.cloudbus.cloudsim.provisioners.PeProvisioner; ...@@ -16,9 +15,9 @@ import org.cloudbus.cloudsim.provisioners.PeProvisioner;
* defined in terms of Millions Instructions Per Second (MIPS) rating.<br> * defined in terms of Millions Instructions Per Second (MIPS) rating.<br>
* <b>ASSUMPTION:<b> All PEs under the same Machine have the same MIPS rating. * <b>ASSUMPTION:<b> All PEs under the same Machine have the same MIPS rating.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class Pe { public class Pe {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -24,14 +23,14 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -24,14 +23,14 @@ import org.cloudbus.cloudsim.core.CloudSim;
* allocated at various times for simulating any * allocated at various times for simulating any
* scheduling using internal events. * scheduling using internal events.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class ResCloudlet { public class ResCloudlet {
/** The cloudlet. */ /** The cloudlet. */
private Cloudlet cloudlet; // a Cloudlet object private final Cloudlet cloudlet; // a Cloudlet object
/** The arrival time. */ /** The arrival time. */
private double arrivalTime; // Cloudlet arrival time for the first time private double arrivalTime; // Cloudlet arrival time for the first time
...@@ -71,13 +70,13 @@ public class ResCloudlet { ...@@ -71,13 +70,13 @@ public class ResCloudlet {
private static final int NOT_FOUND = -1; private static final int NOT_FOUND = -1;
/** The start time. */ /** The start time. */
private long startTime; // reservation start time private final long startTime; // reservation start time
/** The duration. */ /** The duration. */
private int duration; // reservation duration time private final int duration; // reservation duration time
/** The reserv id. */ /** The reserv id. */
private int reservId; // reservation id private final int reservId; // reservation id
/** The pes number. */ /** The pes number. */
private int pesNumber; // num Pe needed to execute this Cloudlet private int pesNumber; // num Pe needed to execute this Cloudlet
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -22,8 +21,7 @@ import java.util.List; ...@@ -22,8 +21,7 @@ import java.util.List;
* in the presence of high network load. * in the presence of high network load.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class SanStorage extends HarddriveStorage { public class SanStorage extends HarddriveStorage {
...@@ -73,6 +71,7 @@ public class SanStorage extends HarddriveStorage { ...@@ -73,6 +71,7 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the time (in seconds) required to add the file * @return the time (in seconds) required to add the file
*/ */
@Override
public double addReservedFile(File file) { public double addReservedFile(File file) {
double time = super.addReservedFile(file); double time = super.addReservedFile(file);
time+=this.networkLatency; time+=this.networkLatency;
...@@ -86,13 +85,16 @@ public class SanStorage extends HarddriveStorage { ...@@ -86,13 +85,16 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the maximum transfer rate in MB/sec * @return the maximum transfer rate in MB/sec
*/ */
@Override
public double getMaxTransferRate() { public double getMaxTransferRate() {
double diskRate=super.getMaxTransferRate(); double diskRate=super.getMaxTransferRate();
//the max transfer rate is the minimum between //the max transfer rate is the minimum between
//the network bandwidth and the disk rate //the network bandwidth and the disk rate
if(diskRate<this.bandwidth) return diskRate; if(diskRate<this.bandwidth) {
return diskRate;
}
return this.bandwidth; return this.bandwidth;
} }
...@@ -103,6 +105,7 @@ public class SanStorage extends HarddriveStorage { ...@@ -103,6 +105,7 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the time taken (in seconds) for adding the specified file * @return the time taken (in seconds) for adding the specified file
*/ */
@Override
public double addFile(File file) { public double addFile(File file) {
double time=super.addFile(file); double time=super.addFile(file);
...@@ -122,6 +125,7 @@ public class SanStorage extends HarddriveStorage { ...@@ -122,6 +125,7 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the time taken (in seconds) for adding the specified files * @return the time taken (in seconds) for adding the specified files
*/ */
@Override
public double addFile(List<File> list) { public double addFile(List<File> list) {
double result = 0.0; double result = 0.0;
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
...@@ -149,6 +153,7 @@ public class SanStorage extends HarddriveStorage { ...@@ -149,6 +153,7 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the time taken (in seconds) for deleting the specified file * @return the time taken (in seconds) for deleting the specified file
*/ */
@Override
public double deleteFile(String fileName, File file) { public double deleteFile(String fileName, File file) {
return this.deleteFile(file); return this.deleteFile(file);
} }
...@@ -163,6 +168,7 @@ public class SanStorage extends HarddriveStorage { ...@@ -163,6 +168,7 @@ public class SanStorage extends HarddriveStorage {
* *
* @return the time taken (in seconds) for deleting the specified file * @return the time taken (in seconds) for deleting the specified file
*/ */
@Override
public double deleteFile(File file) { public double deleteFile(File file) {
double time=super.deleteFile(file); double time=super.deleteFile(file);
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
/** /**
* This interface must be implemented by sensors to * This interface must be implemented by sensors to
* specific data center features. * specific data center features.
*
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public interface Sensor<T extends Number> { public interface Sensor<T extends Number> {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2006, The University of Melbourne, Australia and *
* University of Ljubljana, Slovenia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -19,10 +18,9 @@ import java.util.List; ...@@ -19,10 +18,9 @@ import java.util.List;
* required to execute some common operations on the storage, e.g. storing a * required to execute some common operations on the storage, e.g. storing a
* file, getting a file and deleting a file. * file, getting a file and deleting a file.
* *
* @author Uros Cibej and Anthony Sulistio * @author Uros Cibej
* @since CloudSim Toolkit 4.0 * @author Anthony Sulistio
* @see gridsim.datagrid.storage.HarddriveStorage * @since CloudSim Toolkit 1.0
* @see gridsim.datagrid.storage.TapeStorage
*/ */
public interface Storage { public interface Storage {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
/** /**
* The Interface UtilizationModel. * The UtilizationModel interface needs to be implemented in order to
* provide a fine-grained control over resource usage by a Cloudlet.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public interface UtilizationModel { public interface UtilizationModel {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
/** /**
* The Class UtilizationModelFull. * The UtilizationModelFull class is a simple model, according to which
* a Cloudlet always utilize all the available CPU capacity.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class UtilizationModelFull implements UtilizationModel { public class UtilizationModelFull implements UtilizationModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.power.UtilizationModel#getUtilization(double) * @see cloudsim.power.UtilizationModel#getUtilization(double)
*/ */
@Override
public double getUtilization(double time) { public double getUtilization(double time) {
return 1; return 1;
} }
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -8,7 +16,11 @@ import java.util.HashMap; ...@@ -8,7 +16,11 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* The Class UtilizationModelStochastic. * The UtilizationModelStochastic class implements a model, according to which
* a Cloudlet generates random CPU utilization every time frame.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class UtilizationModelStochastic implements UtilizationModel { public class UtilizationModelStochastic implements UtilizationModel {
...@@ -25,6 +37,7 @@ public class UtilizationModelStochastic implements UtilizationModel { ...@@ -25,6 +37,7 @@ public class UtilizationModelStochastic implements UtilizationModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.power.UtilizationModel#getUtilization(double) * @see cloudsim.power.UtilizationModel#getUtilization(double)
*/ */
@Override
public double getUtilization(double time) { public double getUtilization(double time) {
if (getHistory().containsKey(time)) { if (getHistory().containsKey(time)) {
return getHistory().get(time); return getHistory().get(time);
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -19,8 +18,8 @@ import java.util.List; ...@@ -19,8 +18,8 @@ import java.util.List;
* submit cloudlets to the VM to be executed * submit cloudlets to the VM to be executed
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class Vm { public class Vm {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -19,12 +18,8 @@ import java.util.Map; ...@@ -19,12 +18,8 @@ import java.util.Map;
* commited by the user, it is effectivelly allocated to he/she * commited by the user, it is effectivelly allocated to he/she
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/
/**
* @author abe
*
*/ */
public abstract class VmAllocationPolicy { public abstract class VmAllocationPolicy {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -22,8 +21,8 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -22,8 +21,8 @@ import org.cloudbus.cloudsim.core.CloudSim;
* less PEs in use. * less PEs in use.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class VmAllocationPolicySimple extends VmAllocationPolicy { public class VmAllocationPolicySimple extends VmAllocationPolicy {
...@@ -263,9 +262,7 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy { ...@@ -263,9 +262,7 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
public boolean allocateHostForVm(Vm vm, Host host) { public boolean allocateHostForVm(Vm vm, Host host) {
if (host.vmCreate(vm)) { //if vm has been succesfully created in the host if (host.vmCreate(vm)) { //if vm has been succesfully created in the host
getVmTable().put(vm.getUid(), host); getVmTable().put(vm.getUid(), host);
if (!Log.isDisabled()) { Log.formatLine("%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId(), CloudSim.clock());
Log.print(String.format("%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId() + "\n", CloudSim.clock()));
}
return true; return true;
} }
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
...@@ -21,8 +20,8 @@ import org.cloudbus.cloudsim.lists.PeList; ...@@ -21,8 +20,8 @@ import org.cloudbus.cloudsim.lists.PeList;
* in a host. * in a host.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public abstract class VmScheduler { public abstract class VmScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.HashMap; import java.util.HashMap;
...@@ -24,8 +22,8 @@ import java.util.Map; ...@@ -24,8 +22,8 @@ import java.util.Map;
* This policy ignores requested number of MIPS. * This policy ignores requested number of MIPS.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class VmSchedulerOportunisticSpaceShared extends VmScheduler { public class VmSchedulerOportunisticSpaceShared extends VmScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.HashMap; import java.util.HashMap;
...@@ -23,8 +21,8 @@ import java.util.Vector; ...@@ -23,8 +21,8 @@ import java.util.Vector;
* Free PEs are not allocated to VMs * Free PEs are not allocated to VMs
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class VmSchedulerSpaceShared extends VmScheduler { public class VmSchedulerSpaceShared extends VmScheduler {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -10,7 +18,14 @@ import org.cloudbus.cloudsim.lists.PeList; ...@@ -10,7 +18,14 @@ import org.cloudbus.cloudsim.lists.PeList;
import org.cloudbus.cloudsim.provisioners.PeProvisioner; import org.cloudbus.cloudsim.provisioners.PeProvisioner;
/** /**
* The Class VmSchedulerTimeShared. * VmSchedulerTimeShared is a VMM allocation policy that
* allocates one or more Pe to a VM, and allows sharing
* of PEs by multiple VMs. This class also implements
* 10% performance degration due to VM migration.
*
* @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0
*/ */
public class VmSchedulerTimeShared extends VmScheduler { public class VmSchedulerTimeShared extends VmScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import java.util.HashMap; import java.util.HashMap;
...@@ -15,7 +13,6 @@ import java.util.LinkedList; ...@@ -15,7 +13,6 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* VmSchedulerTimeSharedWithPriority is a VMM allocation policy that * VmSchedulerTimeSharedWithPriority is a VMM allocation policy that
* allows sharing of PEs among virtual machines. CPU Share of each VM can be * allows sharing of PEs among virtual machines. CPU Share of each VM can be
...@@ -25,8 +22,7 @@ import java.util.Map; ...@@ -25,8 +22,7 @@ import java.util.Map;
* 1 and a VM B has a priority 2, B will run twice as faster as A. * 1 and a VM B has a priority 2, B will run twice as faster as A.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class VmSchedulerTimeSharedWithPriority extends VmScheduler { public class VmSchedulerTimeSharedWithPriority extends VmScheduler {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* $Id: CloudInformationService.java,v 1.2 2008/09/15 08:34:29 marcosd Exp $ * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
...@@ -32,13 +31,9 @@ import org.cloudbus.cloudsim.Log; ...@@ -32,13 +31,9 @@ import org.cloudbus.cloudsim.Log;
* Hence, do not need to worry about creating an object of this class. * Hence, do not need to worry about creating an object of this class.
* <p> * <p>
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
* @see CloudSimTags.CloudSimTags
* @see CloudSimShutdown.CloudSimShutdown
* @see gridsim.CloudSim#init(int, Calendar, boolean)
* @see gridsim.CloudResource#startEntity()
*/ */
public class CloudInformationService extends SimEntity { public class CloudInformationService extends SimEntity {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
...@@ -33,8 +32,8 @@ import org.cloudbus.cloudsim.core.predicates.PredicateNone; ...@@ -33,8 +32,8 @@ import org.cloudbus.cloudsim.core.predicates.PredicateNone;
* model are converted to the apropriate methods with the correct parameters. * model are converted to the apropriate methods with the correct parameters.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class CloudSim { public class CloudSim {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* $Id: CloudSimShutdown.java,v 1.1 2008/09/13 03:54:45 marcosd Exp $ * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
...@@ -22,14 +21,13 @@ import java.util.Calendar; ...@@ -22,14 +21,13 @@ import java.util.Calendar;
* This object signals the end of simulation to CloudInformationService (GIS) * This object signals the end of simulation to CloudInformationService (GIS)
* entity. * entity.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*
* @see gridsim.CloudSim#init(int, Calendar, boolean)
*/ */
public class CloudSimShutdown extends SimEntity public class CloudSimShutdown extends SimEntity {
{
/** The num user. */
private int numUser; private int numUser;
/** /**
...@@ -73,6 +71,8 @@ public class CloudSimShutdown extends SimEntity ...@@ -73,6 +71,8 @@ public class CloudSimShutdown extends SimEntity
* In the first case, the number of grid users given in the * In the first case, the number of grid users given in the
* Constructor <tt>must</tt> be correct. Otherwise, CloudSim * Constructor <tt>must</tt> be correct. Otherwise, CloudSim
* package hangs forever or it does not terminate properly. * package hangs forever or it does not terminate properly.
*
* @param ev the ev
* @pre $none * @pre $none
* @post $none * @post $none
*/ */
...@@ -84,16 +84,20 @@ public class CloudSimShutdown extends SimEntity ...@@ -84,16 +84,20 @@ public class CloudSimShutdown extends SimEntity
} }
} }
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.core.SimEntity#startEntity()
*/
@Override @Override
public void startEntity() { public void startEntity() {
// do nothing // do nothing
} }
/* (non-Javadoc)
* @see org.cloudbus.cloudsim.core.SimEntity#shutdownEntity()
*/
@Override @Override
public void shutdownEntity() { public void shutdownEntity() {
// do nothing // do nothing
} }
/////////////////////// PRIVATE METHODS ////////////////////////// }
} // end class
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
...@@ -16,13 +15,12 @@ package org.cloudbus.cloudsim.core; ...@@ -16,13 +15,12 @@ package org.cloudbus.cloudsim.core;
* <b>NOTE:</b> To avoid conflicts with other tags, CloudSim reserves negative * <b>NOTE:</b> To avoid conflicts with other tags, CloudSim reserves negative
* numbers, 0 - 299, and 9600. * numbers, 0 - 299, and 9600.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Manzur Murshed
* @author Rajkumar Buyya
* @author Anthony Sulistio * @author Anthony Sulistio
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public final class CloudSimTags public final class CloudSimTags {
{
// starting constant value for cloud-related tags // starting constant value for cloud-related tags
private static final int BASE = 0; private static final int BASE = 0;
......
/*
* 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
*/
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
import java.util.Iterator; import java.util.Iterator;
...@@ -9,9 +17,11 @@ import java.util.ListIterator; ...@@ -9,9 +17,11 @@ import java.util.ListIterator;
* This class implements the deferred event queue used by {@link Simulation}. * This class implements the deferred event queue used by {@link Simulation}.
* The event queue uses a linked list to store the events. * The event queue uses a linked list to store the events.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see Simulation * @see Simulation
* @see SimEvent * @see SimEvent
* @author Marcos Dias de Assuncao
*/ */
public class DeferredQueue { public class DeferredQueue {
......
/*
* 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
*/
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
import java.util.Collection; import java.util.Collection;
...@@ -9,9 +17,11 @@ import java.util.TreeSet; ...@@ -9,9 +17,11 @@ import java.util.TreeSet;
* This class implements the future event queue used by {@link Simulation}. * This class implements the future event queue used by {@link Simulation}.
* The event queue uses a {@link TreeSet} in order to store the events. * The event queue uses a {@link TreeSet} in order to store the events.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see Simulation * @see Simulation
* @see java.util.TreeSet * @see java.util.TreeSet
* @author Marcos Dias de Assuncao
*/ */
public class FutureQueue { public class FutureQueue {
......
/*
* 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
*/
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.NetworkTopology; import org.cloudbus.cloudsim.NetworkTopology;
import org.cloudbus.cloudsim.core.predicates.Predicate; import org.cloudbus.cloudsim.core.predicates.Predicate;
/** /**
* This class represents a simulation entity. An entity handles events and can * This class represents a simulation entity. An entity handles events and can
* send events to other entities. When this class is extended, there are a few * send events to other entities. When this class is extended, there are a few
...@@ -22,6 +29,7 @@ import org.cloudbus.cloudsim.core.predicates.Predicate; ...@@ -22,6 +29,7 @@ import org.cloudbus.cloudsim.core.predicates.Predicate;
* </ul> * </ul>
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public abstract class SimEntity implements Cloneable { public abstract class SimEntity implements Cloneable {
......
/* Sim_event.java */ /*
* 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
*/
package org.cloudbus.cloudsim.core; package org.cloudbus.cloudsim.core;
/** /**
* This class represents a simulation event which is passed between * This class represents a simulation event which is passed between
* the entities in the simulation. * the entities in the simulation.
* *
* @author Costas Simatos
*
* @see Simulation * @see Simulation
* @see SimEntity * @see SimEntity
* @author Costas Simatos
*/ */
public class SimEvent implements Cloneable, Comparable<SimEvent> { public class SimEvent implements Cloneable, Comparable<SimEvent> {
private final int etype; // internal event type private final int etype; // internal event type
...@@ -89,6 +94,7 @@ public class SimEvent implements Cloneable, Comparable<SimEvent> { ...@@ -89,6 +94,7 @@ public class SimEvent implements Cloneable, Comparable<SimEvent> {
/** /**
* @see Comparable#compareTo(Object) * @see Comparable#compareTo(Object)
*/ */
@Override
public int compareTo(SimEvent event) { public int compareTo(SimEvent event) {
if (event == null) { if (event == null) {
return 1; return 1;
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -8,12 +16,14 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -8,12 +16,14 @@ import org.cloudbus.cloudsim.core.SimEvent;
* predicate. Some standard predicates are provided.<br> * predicate. Some standard predicates are provided.<br>
* The idea of simulation predicates was copied from SimJava 2. * The idea of simulation predicates was copied from SimJava 2.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see PredicateType * @see PredicateType
* @see PredicateFrom * @see PredicateFrom
* @see PredicateAny * @see PredicateAny
* @see PredicateNone * @see PredicateNone
* @see Simulation * @see Simulation
* @author Marcos Dias de Assuncao
*/ */
public abstract class Predicate { public abstract class Predicate {
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -9,11 +17,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -9,11 +17,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
* no new instances need to be created. <br> * no new instances need to be created. <br>
* The idea of simulation predicates was copied from SimJava 2. * The idea of simulation predicates was copied from SimJava 2.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see Predicate * @see Predicate
* @see Simulation * @see Simulation
* @author Marcos Dias de Assuncao
*/ */
public class PredicateAny extends Predicate { public class PredicateAny extends Predicate {
/** /**
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -6,11 +14,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -6,11 +14,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
* A predicate which selects events from specific entities.<br> * A predicate which selects events from specific entities.<br>
* The idea of simulation predicates was copied from SimJava 2. * The idea of simulation predicates was copied from SimJava 2.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see PredicateNotFrom * @see PredicateNotFrom
* @see Predicate * @see Predicate
* @author Marcos Dias de Assuncao
*/ */
public class PredicateFrom extends Predicate { public class PredicateFrom extends Predicate {
/** The ids. */ /** The ids. */
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -9,11 +17,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -9,11 +17,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
* so the user does not need to create any new instances. * so the user does not need to create any new instances.
* The idea of simulation predicates was copied from SimJava 2. * The idea of simulation predicates was copied from SimJava 2.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see Predicate * @see Predicate
* @see Simulation * @see Simulation
* @author Marcos Dias de Assuncao
*/ */
public class PredicateNone extends Predicate { public class PredicateNone extends Predicate {
/** /**
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
/** /**
* A predicate which selects events that have not been sent by specific entities. * A predicate which selects events that have not been sent by specific entities.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see PredicateFrom * @see PredicateFrom
* @see Predicate * @see Predicate
* @author Marcos Dias de Assuncao
*/ */
public class PredicateNotFrom extends Predicate { public class PredicateNotFrom extends Predicate {
/** The ids. */ /** The ids. */
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
/** /**
* A predicate to select events that don't match specific tags. * A predicate to select events that don't match specific tags.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see PredicateType * @see PredicateType
* @see Predicate * @see Predicate
* @author Marcos Dias de Assuncao
*/ */
public class PredicateNotType extends Predicate { public class PredicateNotType extends Predicate {
/** The tags. */ /** The tags. */
......
/*
* 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
*/
package org.cloudbus.cloudsim.core.predicates; package org.cloudbus.cloudsim.core.predicates;
import org.cloudbus.cloudsim.core.SimEvent; import org.cloudbus.cloudsim.core.SimEvent;
...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -5,11 +13,12 @@ import org.cloudbus.cloudsim.core.SimEvent;
/** /**
* A predicate to select events with specific tags. * A predicate to select events with specific tags.
* *
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*
* @see PredicateNotType * @see PredicateNotType
* @see Predicate * @see Predicate
* @author Marcos Dias de Assuncao
*/ */
public class PredicateType extends Predicate { public class PredicateType extends Predicate {
/** The tags. */ /** The tags. */
......
/*
* 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
/** /**
* Interface to be implemented by a random number generator. * Interface to be implemented by a random number generator.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public interface ContinuousDistribution { public interface ContinuousDistribution {
......
/*
* 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
...@@ -6,6 +14,7 @@ import java.util.Random; ...@@ -6,6 +14,7 @@ import java.util.Random;
* An exponential number generator. * An exponential number generator.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class ExponentialDistr implements ContinuousDistribution { public class ExponentialDistr implements ContinuousDistribution {
...@@ -47,6 +56,7 @@ public class ExponentialDistr implements ContinuousDistribution { ...@@ -47,6 +56,7 @@ public class ExponentialDistr implements ContinuousDistribution {
* *
* @return the next random number in the sequence * @return the next random number in the sequence
*/ */
@Override
public double sample() { public double sample() {
return -mean * Math.log(numGen.nextDouble()); return -mean * Math.log(numGen.nextDouble());
} }
......
/*
* Title: CloudSim Toolkit
* Descripimport java.util.Random;
mulation) 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class GammaDistr. * The Class GammaDistr.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class GammaDistr implements ContinuousDistribution { public class GammaDistr implements ContinuousDistribution {
...@@ -56,6 +68,7 @@ public class GammaDistr implements ContinuousDistribution { ...@@ -56,6 +68,7 @@ public class GammaDistr implements ContinuousDistribution {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample() * @see cloudsim.distributions.ContinuousDistribution#sample()
*/ */
@Override
public double sample() { public double sample() {
double sum=0.0; double sum=0.0;
......
/*
* 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class LognormalDistr. * The Class LognormalDistr.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class LognormalDistr implements ContinuousDistribution { public class LognormalDistr implements ContinuousDistribution {
...@@ -56,6 +67,7 @@ public class LognormalDistr implements ContinuousDistribution { ...@@ -56,6 +67,7 @@ public class LognormalDistr implements ContinuousDistribution {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample() * @see cloudsim.distributions.ContinuousDistribution#sample()
*/ */
@Override
public double sample() { public double sample() {
//generate a normal variate from a uniform variate //generate a normal variate from a uniform variate
......
/*
* 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class LomaxDistribution. * The Class LomaxDistribution.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class LomaxDistribution extends ParetoDistr implements ContinuousDistribution { public class LomaxDistribution extends ParetoDistr implements ContinuousDistribution {
......
/*
* Title: CloudSim Toolkit
* Descripimport java.util.Random;
mulation) 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class ParetoDistr. * The Class ParetoDistr.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class ParetoDistr implements ContinuousDistribution { public class ParetoDistr implements ContinuousDistribution {
...@@ -56,6 +68,7 @@ public class ParetoDistr implements ContinuousDistribution { ...@@ -56,6 +68,7 @@ public class ParetoDistr implements ContinuousDistribution {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample() * @see cloudsim.distributions.ContinuousDistribution#sample()
*/ */
@Override
public double sample() { public double sample() {
return location/Math.pow(numGen.nextDouble(),1/shape); return location/Math.pow(numGen.nextDouble(),1/shape);
} }
......
/*
* 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
...@@ -6,6 +14,7 @@ import java.util.Random; ...@@ -6,6 +14,7 @@ import java.util.Random;
* A random number generator based on the Uniform distribution. * A random number generator based on the Uniform distribution.
* *
* @author Marcos Dias de Assuncao * @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class UniformDistr implements ContinuousDistribution { public class UniformDistr implements ContinuousDistribution {
...@@ -52,6 +61,7 @@ public class UniformDistr implements ContinuousDistribution { ...@@ -52,6 +61,7 @@ public class UniformDistr implements ContinuousDistribution {
* *
* @return the next random number in the sequence * @return the next random number in the sequence
*/ */
@Override
public double sample() { public double sample() {
return (numGen.nextDouble() * (mag)) + min; return (numGen.nextDouble() * (mag)) + min;
} }
......
/*
* Title: CloudSim Toolkit
* Descripimport java.util.Random;
mulation) 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class WeibullDistr. * The Class WeibullDistr.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class WeibullDistr implements ContinuousDistribution { public class WeibullDistr implements ContinuousDistribution {
...@@ -56,6 +68,7 @@ public class WeibullDistr implements ContinuousDistribution { ...@@ -56,6 +68,7 @@ public class WeibullDistr implements ContinuousDistribution {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.distributions.ContinuousDistribution#sample() * @see cloudsim.distributions.ContinuousDistribution#sample()
*/ */
@Override
public double sample() { public double sample() {
return beta*Math.pow(-Math.log(numGen.nextDouble()),1/alpha); return beta*Math.pow(-Math.log(numGen.nextDouble()),1/alpha);
} }
......
/*
* Title: CloudSim Toolkit
* Descripimport java.util.Random;
mulation) 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
*/
package org.cloudbus.cloudsim.distributions; package org.cloudbus.cloudsim.distributions;
import java.util.Random; import java.util.Random;
/** /**
* The Class ZipfDistr. * The Class ZipfDistr.
*
* @author Marcos Dias de Assuncao
* @since CloudSim Toolkit 1.0
*/ */
public class ZipfDistr implements ContinuousDistribution { public class ZipfDistr implements ContinuousDistribution {
...@@ -53,6 +65,7 @@ public class ZipfDistr implements ContinuousDistribution { ...@@ -53,6 +65,7 @@ public class ZipfDistr implements ContinuousDistribution {
* *
* @return the next random number in the sequence * @return the next random number in the sequence
*/ */
@Override
public double sample() { public double sample() {
double variate = numGen.nextDouble(); double variate = numGen.nextDouble();
double num=1; double num=1;
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.lists; package org.cloudbus.cloudsim.lists;
...@@ -16,11 +15,10 @@ import java.util.List; ...@@ -16,11 +15,10 @@ import java.util.List;
import org.cloudbus.cloudsim.Cloudlet; import org.cloudbus.cloudsim.Cloudlet;
/** /**
* CloudletList is a link to store Cloudlets. * CloudletList is a collection of operations on lists of Cloudlets.
* *
* @author Rodrigo N. Calheiros * @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class CloudletList { public class CloudletList {
...@@ -70,6 +68,7 @@ public class CloudletList { ...@@ -70,6 +68,7 @@ public class CloudletList {
* @pre b != null * @pre b != null
* @post $none * @post $none
*/ */
@Override
public int compare(T a, T b) throws ClassCastException { public int compare(T a, T b) throws ClassCastException {
Double cla = Double.valueOf(a.getCloudletTotalLength()); Double cla = Double.valueOf(a.getCloudletTotalLength());
Double clb = Double.valueOf(b.getCloudletTotalLength()); Double clb = Double.valueOf(b.getCloudletTotalLength());
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.lists; package org.cloudbus.cloudsim.lists;
...@@ -15,14 +14,10 @@ import org.cloudbus.cloudsim.Host; ...@@ -15,14 +14,10 @@ import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Pe; import org.cloudbus.cloudsim.Pe;
/** /**
* CloudSim HostList simulates a collection of machines. It is up to the * HostList is a collection of operations on lists of hosts.
* CloudSim users to define the connectivity among the machines in a collection. *
* Therefore, this class can be instantiated to model a simple LAN to cluster * @author Anton Beloglazov
* to WAN. * @since CloudSim Toolkit 2.0
*
* @author Manzur Murshed and Rajkumar Buyya
* @since CloudSim Toolkit 1.0
* @invariant $none
*/ */
public class HostList { public class HostList {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.lists; package org.cloudbus.cloudsim.lists;
...@@ -16,12 +15,10 @@ import org.cloudbus.cloudsim.Pe; ...@@ -16,12 +15,10 @@ import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Vm; import org.cloudbus.cloudsim.Vm;
/** /**
* CloudSim PeList maintains a list of PEs (Processing Elements) that make up * PeList is a collection of operations on lists of PEs.
* a machine.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class PeList { public class PeList {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.lists; package org.cloudbus.cloudsim.lists;
...@@ -14,11 +13,10 @@ import java.util.List; ...@@ -14,11 +13,10 @@ import java.util.List;
import org.cloudbus.cloudsim.ResCloudlet; import org.cloudbus.cloudsim.ResCloudlet;
/** /**
* CloudSim ResCloudletList maintains a linked-list of Cloudlet. * ResCloudletList is a collection of operations on lists of ResCloudlets.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class ResCloudletList { public class ResCloudletList {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2009, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.lists; package org.cloudbus.cloudsim.lists;
...@@ -14,11 +13,10 @@ import java.util.List; ...@@ -14,11 +13,10 @@ import java.util.List;
import org.cloudbus.cloudsim.Vm; import org.cloudbus.cloudsim.Vm;
/** /**
* VmList is a list to store virtual machines. * VmList is a collection of operations on lists of VMs.
* *
* @author Rodrigo N. Calheiros * @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 Beta * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class VmList { public class VmList {
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
import java.util.Iterator; import java.util.Iterator;
/** /**
* this class represents an delay-topology * This class represents an delay-topology
* storing every distance between connected nodes * storing every distance between connected nodes
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public class DelayMatrix_Float { public class DelayMatrix_Float {
......
...@@ -6,16 +6,15 @@ ...@@ -6,16 +6,15 @@
* *
*/ */
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
/** /**
* FloydWarshall algorithm to calculate all pairs delay and predecessor matrix. * FloydWarshall algorithm to calculate all pairs delay and predecessor matrix.
* *
* Modified by Weishuai Yang * @author Rahul Simha
* Originally written by Rahul Simha * @author Weishuai Yang
* @version 1.2, 6/20/2005 * @version 1.2, 6/20/2005
* @since CloudSim Toolkit 1.0
*/ */
public class FloydWarshall_Float { public class FloydWarshall_Float {
/** /**
...@@ -108,11 +107,11 @@ public class FloydWarshall_Float { ...@@ -108,11 +107,11 @@ public class FloydWarshall_Float {
Dk[i][j] = Dk_minus_one[i][k] + Dk_minus_one[k][j]; Dk[i][j] = Dk_minus_one[i][k] + Dk_minus_one[k][j];
Pk[i][j] = Pk_minus_one[k][j]; Pk[i][j] = Pk_minus_one[k][j];
} }
} } else {
else
Pk[i][j] = -1; Pk[i][j] = -1;
} }
} }
}
// Now store current Dk into D_k-1 // Now store current Dk into D_k-1
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
import java.io.BufferedReader; import java.io.BufferedReader;
...@@ -6,7 +14,7 @@ import java.io.IOException; ...@@ -6,7 +14,7 @@ import java.io.IOException;
import java.util.StringTokenizer; import java.util.StringTokenizer;
/** /**
* this class is just an file-reader for the special brite-format! * This class is just an file-reader for the special brite-format!
* *
* the brite-file is structured as followed: * the brite-file is structured as followed:
* Node-section: * Node-section:
...@@ -16,7 +24,7 @@ import java.util.StringTokenizer; ...@@ -16,7 +24,7 @@ import java.util.StringTokenizer;
* EdgeID, fromNode, toNode, euclideanLength, linkDelay, linkBandwith, AS_from, AS_to, type * EdgeID, fromNode, toNode, euclideanLength, linkDelay, linkBandwith, AS_from, AS_to, type
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public class GraphReaderBrite implements GraphReaderIF { public class GraphReaderBrite implements GraphReaderIF {
...@@ -36,6 +44,7 @@ public class GraphReaderBrite implements GraphReaderIF { ...@@ -36,6 +44,7 @@ public class GraphReaderBrite implements GraphReaderIF {
* @return created TopologicalGraph * @return created TopologicalGraph
* @throws IOException * @throws IOException
*/ */
@Override
public TopologicalGraph readGraphFile(String filename) throws IOException{ public TopologicalGraph readGraphFile(String filename) throws IOException{
graph = new TopologicalGraph(); graph = new TopologicalGraph();
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
import java.io.IOException; import java.io.IOException;
/** /**
* this interface abstracts an reader for different graph-file-formats * This interface abstracts an reader for different graph-file-formats
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public interface GraphReaderIF { public interface GraphReaderIF {
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
import java.util.Iterator; import java.util.Iterator;
...@@ -5,7 +13,7 @@ import java.util.LinkedList; ...@@ -5,7 +13,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
* this class represents an graph containing nodes and edges, * This class represents an graph containing nodes and edges,
* used for input with an network-layer * used for input with an network-layer
* *
* Graphical-Output Restricions! * Graphical-Output Restricions!
...@@ -13,7 +21,7 @@ import java.util.List; ...@@ -13,7 +21,7 @@ import java.util.List;
* NodeColors: GraphicalProperties.getColorNode * NodeColors: GraphicalProperties.getColorNode
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public class TopologicalGraph { public class TopologicalGraph {
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
/** /**
* this class represents an link (edge) from an graph * This class represents an link (edge) from an graph
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public class TopologicalLink { public class TopologicalLink {
......
/*
* 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
*/
package org.cloudbus.cloudsim.network; package org.cloudbus.cloudsim.network;
/** /**
* just represents an topological network node * Just represents an topological network node
* retrieves its information from an topological-generated file * retrieves its information from an topological-generated file
* (eg. topology-generator) * (eg. topology-generator)
* *
* @author Thomas Hohnstein * @author Thomas Hohnstein
* * @since CloudSim Toolkit 1.0
*/ */
public class TopologicalNode { public class TopologicalNode {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
...@@ -27,16 +26,10 @@ import org.cloudbus.cloudsim.core.SimEvent; ...@@ -27,16 +26,10 @@ import org.cloudbus.cloudsim.core.SimEvent;
import org.cloudbus.cloudsim.core.predicates.PredicateType; import org.cloudbus.cloudsim.core.predicates.PredicateType;
/** /**
* CloudSim Datacentre class is a CloudResource whose hostList * PowerDatacenter is a class that enables simulation of power-aware data centers.
* are virtualized. 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.
* *
* @author Rodrigo N. Calheiros * @author Anton Beloglazov
* @since CloudSim Toolkit 4.3 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class PowerDatacenter extends Datacenter { public class PowerDatacenter extends Datacenter {
...@@ -110,9 +103,7 @@ public class PowerDatacenter extends Datacenter { ...@@ -110,9 +103,7 @@ public class PowerDatacenter extends Datacenter {
for (PowerHost host : this.<PowerHost>getHostList()) { for (PowerHost host : this.<PowerHost>getHostList()) {
if (!Log.isDisabled()) { Log.formatLine("%.2f: Host #%d", CloudSim.clock(), host.getId());
Log.print(String.format("%.2f: Host #%d\n", CloudSim.clock(), host.getId()));
}
double hostPower = 0.0; double hostPower = 0.0;
...@@ -125,31 +116,23 @@ public class PowerDatacenter extends Datacenter { ...@@ -125,31 +116,23 @@ public class PowerDatacenter extends Datacenter {
} }
} }
if (!Log.isDisabled()) { Log.formatLine("%.2f: Host #%d utilization is %.2f%%", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100);
Log.print(String.format("%.2f: Host #%d utilization is %.2f%%\n", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100)); Log.formatLine("%.2f: Host #%d energy is %.2f W*sec", CloudSim.clock(), host.getId(), hostPower);
Log.print(String.format("%.2f: Host #%d energy is %.2f W*sec\n", CloudSim.clock(), host.getId(), hostPower));
}
} }
if (!Log.isDisabled()) { Log.formatLine("\n%.2f: Consumed energy is %.2f W*sec\n", CloudSim.clock(), timeframePower);
Log.print(String.format("\n%.2f: Consumed energy is %.2f W*sec\n\n", CloudSim.clock(), timeframePower));
}
Log.printLine("\n\n--------------------------------------------------------------\n\n"); Log.printLine("\n\n--------------------------------------------------------------\n\n");
for (PowerHost host : this.<PowerHost>getHostList()) { for (PowerHost host : this.<PowerHost>getHostList()) {
if (!Log.isDisabled()) { Log.formatLine("\n%.2f: Host #%d", CloudSim.clock(), host.getId());
Log.print(String.format("\n%.2f: Host #%d\n", CloudSim.clock(), host.getId()));
}
double time = host.updateVmsProcessing(currentTime); // inform VMs to update processing double time = host.updateVmsProcessing(currentTime); // inform VMs to update processing
if (time < minTime) { if (time < minTime) {
minTime = time; minTime = time;
} }
if (!Log.isDisabled()) { Log.formatLine("%.2f: Host #%d utilization is %.2f%%", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100);
Log.print(String.format("%.2f: Host #%d utilization is %.2f%%\n", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100));
}
} }
setPower(getPower() + timeframePower); setPower(getPower() + timeframePower);
...@@ -179,14 +162,12 @@ public class PowerDatacenter extends Datacenter { ...@@ -179,14 +162,12 @@ public class PowerDatacenter extends Datacenter {
Log.printLine("problem"); Log.printLine("problem");
} }
if (!Log.isDisabled()) {
if (oldHost == null) { if (oldHost == null) {
Log.print(String.format("%.2f: Migration of VM #%d to Host #%d is started\n", CloudSim.clock(), vm.getId(), targetHost.getId())); Log.formatLine("%.2f: Migration of VM #%d to Host #%d is started", CloudSim.clock(), vm.getId(), targetHost.getId());
} else { } else {
Log.print(String.format("%.2f: Migration of VM #%d from Host #%d to Host #%d is started\n", CloudSim.clock(), vm.getId(), oldHost.getId(), targetHost.getId())); Log.formatLine("%.2f: Migration of VM #%d from Host #%d to Host #%d is started", CloudSim.clock(), vm.getId(), oldHost.getId(), targetHost.getId());
//oldHost.vmDestroy(vm); //oldHost.vmDestroy(vm);
} }
}
incrementMigrationCount(); incrementMigrationCount();
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
...@@ -22,16 +21,11 @@ import org.cloudbus.cloudsim.core.CloudSimTags; ...@@ -22,16 +21,11 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.predicates.PredicateType; import org.cloudbus.cloudsim.core.predicates.PredicateType;
/** /**
* CloudSim Datacentre class is a CloudResource whose hostList * PowerDatacenterNonPowerAware is a class that represents a non-power aware data center
* are virtualized. It deals with processing of VM queries (i.e., handling * in the context of power-aware simulations.
* 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.
* *
* @author Rodrigo N. Calheiros * @author Anton Beloglazov
* @since CloudSim Toolkit 4.3 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class PowerDatacenterNonPowerAware extends PowerDatacenter { public class PowerDatacenterNonPowerAware extends PowerDatacenter {
...@@ -86,9 +80,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter { ...@@ -86,9 +80,7 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
Log.printLine("\n"); Log.printLine("\n");
for (PowerHost host : this.<PowerHost>getHostList()) { for (PowerHost host : this.<PowerHost>getHostList()) {
if (!Log.isDisabled()) { Log.formatLine("%.2f: Host #%d", CloudSim.clock(), host.getId());
Log.print(String.format("%.2f: Host #%d\n", CloudSim.clock(), host.getId()));
}
double hostPower = 0.0; double hostPower = 0.0;
...@@ -100,22 +92,16 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter { ...@@ -100,22 +92,16 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
e.printStackTrace(); e.printStackTrace();
} }
if (!Log.isDisabled()) { Log.formatLine("%.2f: Host #%d utilization is %.2f%%", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100);
Log.print(String.format("%.2f: Host #%d utilization is %.2f%%\n", CloudSim.clock(), host.getId(), host.getUtilizationOfCpu() * 100)); Log.formatLine("%.2f: Host #%d energy is %.2f W*sec", CloudSim.clock(), host.getId(), hostPower);
Log.print(String.format("%.2f: Host #%d energy is %.2f W*sec\n", CloudSim.clock(), host.getId(), hostPower));
}
} }
if (!Log.isDisabled()) { Log.formatLine("\n%.2f: Consumed energy is %.2f W*sec\n", CloudSim.clock(), timeframePower);
Log.print(String.format("\n%.2f: Consumed energy is %.2f W*sec\n\n", CloudSim.clock(), timeframePower));
}
Log.printLine("\n\n--------------------------------------------------------------\n\n"); Log.printLine("\n\n--------------------------------------------------------------\n\n");
for (PowerHost host : this.<PowerHost>getHostList()) { for (PowerHost host : this.<PowerHost>getHostList()) {
if (!Log.isDisabled()) { Log.formatLine("\n%.2f: Host #%d", CloudSim.clock(), host.getId());
Log.print(String.format("\n%.2f: Host #%d\n", CloudSim.clock(), host.getId()));
}
double time = host.updateVmsProcessing(currentTime); // inform VMs to update processing double time = host.updateVmsProcessing(currentTime); // inform VMs to update processing
if (time < minTime) { if (time < minTime) {
...@@ -146,12 +132,10 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter { ...@@ -146,12 +132,10 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
targetHost.addMigratingInVm(vm); targetHost.addMigratingInVm(vm);
if (!Log.isDisabled()) {
if (oldHost == null) { if (oldHost == null) {
Log.print(String.format("%.2f: Migration of VM #%d to Host #%d is started\n", CloudSim.clock(), vm.getId(), targetHost.getId())); Log.formatLine("%.2f: Migration of VM #%d to Host #%d is started", CloudSim.clock(), vm.getId(), targetHost.getId());
} else { } else {
Log.print(String.format("%.2f: Migration of VM #%d from Host #%d to Host #%d is started\n", CloudSim.clock(), vm.getId(), oldHost.getId(), targetHost.getId())); Log.formatLine("%.2f: Migration of VM #%d from Host #%d to Host #%d is started", CloudSim.clock(), vm.getId(), oldHost.getId(), targetHost.getId());
}
} }
incrementMigrationCount(); incrementMigrationCount();
......
/*
* 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
*/
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
import java.util.List; import java.util.List;
...@@ -10,7 +18,10 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner; ...@@ -10,7 +18,10 @@ import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner; import org.cloudbus.cloudsim.provisioners.RamProvisioner;
/** /**
* The Class PowerHost. * PowerHost class enables simulation of power-aware hosts.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerHost extends HostDynamicWorkload { public class PowerHost extends HostDynamicWorkload {
......
/*
* 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
*/
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
import org.cloudbus.cloudsim.Pe; import org.cloudbus.cloudsim.Pe;
...@@ -5,7 +13,10 @@ import org.cloudbus.cloudsim.power.models.PowerModel; ...@@ -5,7 +13,10 @@ import org.cloudbus.cloudsim.power.models.PowerModel;
import org.cloudbus.cloudsim.provisioners.PeProvisioner; import org.cloudbus.cloudsim.provisioners.PeProvisioner;
/** /**
* The Class PowerPe. * PowerPe class enables simulation of power-aware PEs.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerPe extends Pe { public class PowerPe extends Pe {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.power; package org.cloudbus.cloudsim.power;
...@@ -23,13 +22,11 @@ import org.cloudbus.cloudsim.power.lists.PowerVmList; ...@@ -23,13 +22,11 @@ import org.cloudbus.cloudsim.power.lists.PowerVmList;
/** /**
* PowerVmAllocationPolicySingleThreshold is an VMAllocationPolicy that * PowerVmAllocationPolicySingleThreshold is an VMAllocationPolicy that
* chooses, as the host for a VM, the host with * chooses a host with the least power increase due to utilization increase
* the least power increase due to utilization * caused by the VM allocation.
* increase.
* *
* @author Anton Beloglazov * @author Anton Beloglazov
* @since CloudSim Toolkit 4.3 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class PowerVmAllocationPolicySingleThreshold extends VmAllocationPolicySimple { public class PowerVmAllocationPolicySingleThreshold extends VmAllocationPolicySimple {
...@@ -122,9 +119,7 @@ public class PowerVmAllocationPolicySingleThreshold extends VmAllocationPolicySi ...@@ -122,9 +119,7 @@ public class PowerVmAllocationPolicySingleThreshold extends VmAllocationPolicySi
if (result) { //if vm has been succesfully created in the host if (result) { //if vm has been succesfully created in the host
getVmTable().put(vm.getUid(), allocatedHost); getVmTable().put(vm.getUid(), allocatedHost);
if (!Log.isDisabled()) { Log.formatLine("%.2f: VM #" + vm.getId() + " has been sent to the host #" + allocatedHost.getId(), CloudSim.clock());
Log.print(String.format("%.2f: VM #" + vm.getId() + " has been sent to the host #" + allocatedHost.getId() + "\n", CloudSim.clock()));
}
} }
return result; return result;
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2002, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.power.lists; package org.cloudbus.cloudsim.power.lists;
...@@ -15,12 +14,10 @@ import org.cloudbus.cloudsim.lists.PeList; ...@@ -15,12 +14,10 @@ import org.cloudbus.cloudsim.lists.PeList;
import org.cloudbus.cloudsim.power.PowerPe; import org.cloudbus.cloudsim.power.PowerPe;
/** /**
* CloudSim PowerPeList maintains a list of PEs (Processing Elements) that make up * PowerPeList is a collection of operations on lists of Power-enabled PEs.
* a machine.
* *
* @author Manzur Murshed and Rajkumar Buyya * @author Anton Beloglazov
* @since CloudSim Toolkit 1.0 * @since CloudSim Toolkit 2.0
* @invariant $none
*/ */
public class PowerPeList extends PeList { public class PowerPeList extends PeList {
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.lists; package org.cloudbus.cloudsim.power.lists;
import java.util.Collections; import java.util.Collections;
...@@ -9,7 +17,10 @@ import org.cloudbus.cloudsim.core.CloudSim; ...@@ -9,7 +17,10 @@ import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.lists.VmList; import org.cloudbus.cloudsim.lists.VmList;
/** /**
* The Class PowerVmList. * PowerVmList is a collection of operations on lists of power-enabled VMs.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerVmList extends VmList { public class PowerVmList extends VmList {
...@@ -20,6 +31,7 @@ public class PowerVmList extends VmList { ...@@ -20,6 +31,7 @@ public class PowerVmList extends VmList {
*/ */
public static <T extends Vm> void sortByCpuUtilization(List<T> vmList) { public static <T extends Vm> void sortByCpuUtilization(List<T> vmList) {
Collections.sort(vmList, new Comparator<T>() { Collections.sort(vmList, new Comparator<T>() {
@Override
public int compare(T a, T b) throws ClassCastException { public int compare(T a, T b) throws ClassCastException {
Double aUtilization = a.getTotalUtilizationOfCpuMips(CloudSim.clock()); Double aUtilization = a.getTotalUtilizationOfCpuMips(CloudSim.clock());
Double bUtilization = b.getTotalUtilizationOfCpuMips(CloudSim.clock()); Double bUtilization = b.getTotalUtilizationOfCpuMips(CloudSim.clock());
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.models; package org.cloudbus.cloudsim.power.models;
/** /**
* The Interface PowerModel. * The PowerModel interface needs to be implemented in order to
* provide a model of power consumption depending on utilization
* for system components.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public interface PowerModel { public interface PowerModel {
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.models; package org.cloudbus.cloudsim.power.models;
/** /**
* The Class PowerModelCubic. * The Class PowerModelCubic.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerModelCubic implements PowerModel { public class PowerModelCubic implements PowerModel {
...@@ -29,6 +40,7 @@ public class PowerModelCubic implements PowerModel { ...@@ -29,6 +40,7 @@ public class PowerModelCubic implements PowerModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double) * @see gridsim.virtualization.power.PowerModel#getPower(double)
*/ */
@Override
public double getPower(double utilization) throws IllegalArgumentException { public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) { if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1"); throw new IllegalArgumentException("Utilization value must be between 0 and 1");
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.models; package org.cloudbus.cloudsim.power.models;
/** /**
* The Class PowerModelLinear. * The Class PowerModelLinear.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerModelLinear implements PowerModel { public class PowerModelLinear implements PowerModel {
...@@ -29,6 +40,7 @@ public class PowerModelLinear implements PowerModel { ...@@ -29,6 +40,7 @@ public class PowerModelLinear implements PowerModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double) * @see cloudsim.power.PowerModel#getPower(double)
*/ */
@Override
public double getPower(double utilization) throws IllegalArgumentException { public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) { if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1"); throw new IllegalArgumentException("Utilization value must be between 0 and 1");
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.models; package org.cloudbus.cloudsim.power.models;
/** /**
* The Class PowerModelSqrt. * The Class PowerModelSqrt.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerModelSqrt implements PowerModel { public class PowerModelSqrt implements PowerModel {
...@@ -29,6 +40,7 @@ public class PowerModelSqrt implements PowerModel { ...@@ -29,6 +40,7 @@ public class PowerModelSqrt implements PowerModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see cloudsim.power.PowerModel#getPower(double) * @see cloudsim.power.PowerModel#getPower(double)
*/ */
@Override
public double getPower(double utilization) throws IllegalArgumentException { public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) { if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1"); throw new IllegalArgumentException("Utilization value must be between 0 and 1");
......
/*
* 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
*/
package org.cloudbus.cloudsim.power.models; package org.cloudbus.cloudsim.power.models;
/** /**
* The Class PowerModelSquare. * The Class PowerModelSquare.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PowerModelSquare implements PowerModel { public class PowerModelSquare implements PowerModel {
...@@ -29,6 +40,7 @@ public class PowerModelSquare implements PowerModel { ...@@ -29,6 +40,7 @@ public class PowerModelSquare implements PowerModel {
/* (non-Javadoc) /* (non-Javadoc)
* @see gridsim.virtualization.power.PowerModel#getPower(double) * @see gridsim.virtualization.power.PowerModel#getPower(double)
*/ */
@Override
public double getPower(double utilization) throws IllegalArgumentException { public double getPower(double utilization) throws IllegalArgumentException {
if (utilization < 0 || utilization > 1) { if (utilization < 0 || utilization > 1) {
throw new IllegalArgumentException("Utilization value must be between 0 and 1"); throw new IllegalArgumentException("Utilization value must be between 0 and 1");
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
...@@ -19,8 +18,8 @@ import org.cloudbus.cloudsim.Vm; ...@@ -19,8 +18,8 @@ import org.cloudbus.cloudsim.Vm;
* allocations. * allocations.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 4.3 * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public abstract class BwProvisioner { public abstract class BwProvisioner {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
...@@ -20,8 +19,8 @@ import org.cloudbus.cloudsim.Vm; ...@@ -20,8 +19,8 @@ import org.cloudbus.cloudsim.Vm;
* otherwise, it fails. * otherwise, it fails.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 4.3 * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class BwProvisionerSimple extends BwProvisioner { public class BwProvisionerSimple extends BwProvisioner {
......
/*
* 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
*/
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
import java.util.List; import java.util.List;
...@@ -6,6 +14,9 @@ import org.cloudbus.cloudsim.Vm; ...@@ -6,6 +14,9 @@ import org.cloudbus.cloudsim.Vm;
/** /**
* The Class PeProvisioner. * The Class PeProvisioner.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public abstract class PeProvisioner { public abstract class PeProvisioner {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
...@@ -18,6 +17,9 @@ import org.cloudbus.cloudsim.Vm; ...@@ -18,6 +17,9 @@ import org.cloudbus.cloudsim.Vm;
/** /**
* The Class PeProvisionerSimple. * The Class PeProvisionerSimple.
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/ */
public class PeProvisionerSimple extends PeProvisioner { public class PeProvisionerSimple extends PeProvisioner {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
import org.cloudbus.cloudsim.Vm; import org.cloudbus.cloudsim.Vm;
...@@ -20,8 +18,8 @@ import org.cloudbus.cloudsim.Vm; ...@@ -20,8 +18,8 @@ import org.cloudbus.cloudsim.Vm;
* allocations. * allocations.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 4.3 * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public abstract class RamProvisioner { public abstract class RamProvisioner {
......
/* /*
* Title: CloudSim Toolkit * Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation * Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* of Parallel and Distributed Systems such as Clusters and Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html * Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* *
* Copyright (c) 2008, The University of Melbourne, Australia * Copyright (c) 2009-2010, The University of Melbourne, Australia
*/ */
package org.cloudbus.cloudsim.provisioners; package org.cloudbus.cloudsim.provisioners;
...@@ -19,8 +18,8 @@ import org.cloudbus.cloudsim.Vm; ...@@ -19,8 +18,8 @@ import org.cloudbus.cloudsim.Vm;
* which uses a best-effort policy to allocate memory to a VM. * which uses a best-effort policy to allocate memory to a VM.
* *
* @author Rodrigo N. Calheiros * @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 4.3 * @author Anton Beloglazov
* @invariant $none * @since CloudSim Toolkit 1.0
*/ */
public class RamProvisionerSimple extends RamProvisioner { public class RamProvisionerSimple extends RamProvisioner {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.createMock;
...@@ -17,6 +25,10 @@ import java.util.Map; ...@@ -17,6 +25,10 @@ import java.util.Map;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class CloudletSchedulerSingleServiceTest { public class CloudletSchedulerSingleServiceTest {
private static final long CLOUDLET_LENGTH = 1000; private static final long CLOUDLET_LENGTH = 1000;
......
/*
* Title: CloudSim Toolkiimport static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import java.util.LinkedList;
import org.junit.Before;
import org.junit.Test;
c) 2009-2010, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -8,6 +19,10 @@ import java.util.LinkedList; ...@@ -8,6 +19,10 @@ import java.util.LinkedList;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class CloudletTest { public class CloudletTest {
private static final long CLOUDLET_LENGTH = 1000; private static final long CLOUDLET_LENGTH = 1000;
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -14,6 +22,10 @@ import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple; ...@@ -14,6 +22,10 @@ import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class HostDynamicWorkloadTest { public class HostDynamicWorkloadTest {
private static final int ID = 0; private static final int ID = 0;
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -18,6 +26,10 @@ import org.junit.Before; ...@@ -18,6 +26,10 @@ import org.junit.Before;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class HostTest { public class HostTest {
private static final int ID = 0; private static final int ID = 0;
......
/*
* 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
*/
package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class LogTest {
private static final ByteArrayOutputStream OUTPUT = new ByteArrayOutputStream();
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
@Before
public void setUp() throws Exception {
Log.setOutput(OUTPUT);
}
@Test
public void testPrint() throws IOException {
Log.print("test test");
assertEquals("test test", OUTPUT.toString());
OUTPUT.reset();
Log.print(123);
assertEquals("123", OUTPUT.toString());
OUTPUT.reset();
Log.print(123L);
assertEquals("123", OUTPUT.toString());
OUTPUT.reset();
Log.print(123.0);
assertEquals("123.0", OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testPrintLine() throws IOException {
Log.printLine("test test");
assertEquals("test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.printLine(123);
assertEquals("123" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.printLine(123L);
assertEquals("123" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.printLine(123.0);
assertEquals("123.0" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testFormat() throws IOException {
Log.format("test %s test", "test");
assertEquals("test test test", OUTPUT.toString());
OUTPUT.reset();
Log.format("%d", 123);
assertEquals("123", OUTPUT.toString());
OUTPUT.reset();
Log.format("%d", 123L);
assertEquals("123", OUTPUT.toString());
OUTPUT.reset();
Log.format("%.2f", 123.01);
assertEquals("123.01", OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testFormatLine() throws IOException {
Log.formatLine("test %s test", "test");
assertEquals("test test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("%d", 123);
assertEquals("123" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("%d", 123L);
assertEquals("123" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("%.2f", 123.01);
assertEquals("123.01" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testDisable() throws IOException {
assertFalse(Log.isDisabled());
Log.print("test test");
assertEquals("test test", OUTPUT.toString());
OUTPUT.reset();
Log.printLine("test test");
assertEquals("test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.format("test %s test", "test");
assertEquals("test test test", OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("test %s test", "test");
assertEquals("test test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.disable();
assertTrue(Log.isDisabled());
Log.print("test test");
assertEquals("", OUTPUT.toString());
OUTPUT.reset();
Log.printLine("test test");
assertEquals("", OUTPUT.toString());
OUTPUT.reset();
Log.format("test %s test", "test");
assertEquals("", OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("test %s test", "test");
assertEquals("", OUTPUT.toString());
OUTPUT.reset();
Log.enable();
assertFalse(Log.isDisabled());
Log.print("test test");
assertEquals("test test", OUTPUT.toString());
OUTPUT.reset();
Log.printLine("test test");
assertEquals("test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
Log.format("test %s test", "test");
assertEquals("test test test", OUTPUT.toString());
OUTPUT.reset();
Log.formatLine("test %s test", "test");
assertEquals("test test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
}
}
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -6,6 +14,10 @@ import static org.junit.Assert.assertSame; ...@@ -6,6 +14,10 @@ import static org.junit.Assert.assertSame;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class PeTest { public class PeTest {
private static final double MIPS = 1000; private static final double MIPS = 1000;
......
/** /*
* 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
*/ */
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -11,8 +16,8 @@ import org.junit.Before; ...@@ -11,8 +16,8 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/** /**
* @author abe * @author Anton Beloglazov
* * @since CloudSim Toolkit 2.0
*/ */
public class UtilizationModelStochasticTest { public class UtilizationModelStochasticTest {
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
...@@ -12,6 +20,10 @@ import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple; ...@@ -12,6 +20,10 @@ import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class VmSchedulerTimeSharedTest { public class VmSchedulerTimeSharedTest {
private static final double MIPS = 1000; private static final double MIPS = 1000;
......
/*
* 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
*/
package org.cloudbus.cloudsim; package org.cloudbus.cloudsim;
import static org.easymock.EasyMock.createMock; import static org.easymock.EasyMock.createMock;
...@@ -15,6 +23,10 @@ import java.util.List; ...@@ -15,6 +23,10 @@ import java.util.List;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
/**
* @author Anton Beloglazov
* @since CloudSim Toolkit 2.0
*/
public class VmTest { public class VmTest {
private static final int ID = 1; private static final int ID = 1;
......
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