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