Commit b1ce0dba authored by siavashi's avatar siavashi Committed by Ahmad Siavashi

initial commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/cloudsim-examples/src/main/java"/>
<classpathentry kind="src" path="modules/cloudsim/src/main/java"/>
<classpathentry kind="src" path="modules/cloudsim/src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse)
*.pydevproject
# CDT-specific (C/C++ Development Tooling)
.cproject
# CDT- autotools
.autotools
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
# Annotation Processing
.apt_generated/
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet
/bin/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gpucloudsim</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
## GPUCloudSim: an extension of CloudSim for modeling and simulation of GPUs in cloud data centers
In order to satisfy graphical and computational requirements of end-users, today cloud providers offer GPU-enabled services. It is known that due to the complexity of GPU devices, conventional virtualization techniques are not directly applicable. Hence, various virtualization methods such as API remoting, full, para and hardware-assisted virtualization techniques are adopted to share a GPU among multiple VMs. To ease-up conducting experimental studies on GPU-enabled cloud computing environments, we provide an extension to CloudSim simulator. Our extension includes models and provisioning and scheduling policies to enable the modeling and simulation of GPUs in data centers.
-----------------------------------------
If you used the extension, please consider citing the following paper,
> A. Siavashi and M. Momtazpour, “GPUCloudSim: an extension of CloudSim
> for modeling and simulation of GPUs in cloud data centers,” The
> Journal of Supercomputing, Oct. 2018.
-----------------------------------------
As the extension has not been tested for all conditions, you may find errors in runtime. In case of any problem, we would be grateful if you consider reporting the issue. Currently, we are adding new features to the extension.
### Main features
* Support for modeling and simulation of large scale GPU-enabled Cloud platforms
* Support for modeling and simulation of energy-aware GPU-equipped data centers
* Support for modeling and simulation of multi-video card servers
* Support for modeling and simulation of multi-GPU video cards
* Support for user-defined GPU provisioning policies
* Support for modeling and simulation of GPU-enabled VMs
* Support for modeling and simulation of virtualization-incurred performance overhead
* Support for user-defined GPU scheduling policies
* Support for modeling and simulation of GPU applications
* Support for modeling and simulation of interference among co-running GPU applications
* Support for user-defined GPU application scheduling policies
### Download
This package contains CloudSim 4.0 with the latest version of the GPU extension.
### Disclaimer
This code is provided as is, and no guarantee is given that this code will preform in the desired way.
# GPUCloudSim: An extension of CloudSim for Modeling and Simulation of GPUs in Cloud Data Centers #
In order to satisfy graphical and computational requirements of end-users, today cloud providers offer GPU-enabled services. It is known that due to the complexity of GPU devices, conventional virtualization techniques are not directly applicable. Hence, various virtualization methods such as API remoting, full, para and hardware-assisted virtualization techniques are adopted to share a GPU among multiple VMs. To ease-up conducting experimental studies on GPU-enabled cloud computing environments, we provide an extension to CloudSim simulator. Our extension includes models and provisioning and scheduling policies to enable the modeling and simulation of GPUs in data centers.
# Main features #
* support for modeling and simulation of large scale GPU-enabled Cloud platforms
* support for modeling and simulation of energy-aware GPU-equipped data centers
* support for modeling and simulation of multi-video card servers
* support for modeling and simulation of multi-GPU video cards
* support for user-defined GPU provisioning policies
* support for modeling and simulation of GPU-enabled VMs
* support for modeling and simulation of virtualization-incurred performance overhead
* support for user-defined GPU scheduling policies
* support for modeling and simulation of GPU applications
* support for modeling and simulation of interference among co-running GPU applications
* support for user-defined GPU application scheduling policies
# Download #
This package contains CloudSim 4.0 with the latest version of the GPU extension.
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cloudsim-package</artifactId>
<groupId>org.cloudbus.cloudsim</groupId>
<version>4.0</version>
</parent>
<artifactId>distribution</artifactId>
<packaging>pom</packaging>
<name>distribution</name>
<build>
<finalName>cloudsim-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>src/main/assembly/package.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>javadoc</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim-examples</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim-examples</artifactId>
<version>${project.version}</version>
<type>jar</type>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>documentation</artifactId>
<version>${project.version}</version>
<type>jar</type>
</dependency>
</dependencies>
</project>
<assembly>
<id>package</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>jars</outputDirectory>
<includes>
<include>${project.groupId}:cloudsim:jar</include>
<include>${project.groupId}:cloudsim:jar:sources</include>
<include>${project.groupId}:cloudsim-examples:jar</include>
<include>${project.groupId}:cloudsim-examples:jar:sources</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>sources</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF/</exclude>
</excludes>
</unpackOptions>
<includes>
<include>${project.groupId}:cloudsim:jar:sources</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>examples</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF/</exclude>
</excludes>
</unpackOptions>
<includes>
<include>${project.groupId}:cloudsim-examples:jar:sources</include>
</includes>
</dependencySet>
<dependencySet>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF/</exclude>
</excludes>
</unpackOptions>
<outputDirectory>/</outputDirectory>
<includes>
<include>${project.groupId}:documentation</include>
</includes>
</dependencySet>
<dependencySet>
<outputDirectory>docs</outputDirectory>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>META-INF/</exclude>
</excludes>
</unpackOptions>
<includes>
<include>${project.groupId}:cloudsim:jar:javadoc</include>
</includes>
</dependencySet>
</dependencySets>
</assembly>
\ No newline at end of file
File added
File added
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>cloudsim-package</artifactId>
<groupId>org.cloudbus.cloudsim</groupId>
<version>4.0</version>
</parent>
<artifactId>documentation</artifactId>
<name>documentation</name>
</project>
<?xml version="1.0"?>
<!--
July 2010
Build file or Makefile for CloudSim.
Note:
Make sure you have installed 'ant' and put the location of it into
your path so you can access it anywhere.
'ant' can be downloadable from http://ant.apache.org/
Usage:
* Type 'ant' to compile all cloudsim source files, put them into the
classes/ directory and to create a cloudsim-new.jar file in the jars/ directory
* Type 'ant clean' to delete all the compiled classes and the classes/
directory itself. The generated cloudsim-new.jar is not deleted.
Note:
* You need to set up PATH for ant in Windows and/or Unix.
Acknowledgement:
Thank to Uros Cibej for providing this file and instruction on
how to use it.
-->
<project name="CloudSim" basedir="." default="makejar">
<description>
This is the build file for CloudSim
</description>
<!-- location to store Java classes -->
<property name="class.dir" location="./classes" />
<!-- location to store CloudSim source files -->
<property name="src.dir" location="./sources" />
<!-- location to store jar files -->
<property name="jar.dir" location="./jars" />
<!-- classpath declaration -->
<path id="classpath">
<fileset dir="./jars">
<include name="*.jar" />
</fileset>
</path>
<target name="prepare">
<mkdir dir="${class.dir}" />
</target>
<!-- rule to compile CloudSim source files -->
<target name="build" depends="prepare">
<javac srcdir="${src.dir}" destdir="${class.dir}" includeantruntime="false">
<classpath refid="classpath"/>
</javac>
</target>
<!-- Rule for making a jar file.
Note:
* The new jar file is named as "cloudsim-new.jar" to avoid overriding
the existing jar file.
* The new jar file only contains cloudsim classes only.
-->
<target name="makejar" depends="build">
<echo>Compiling a new jar file, named: "cloudsim-new.jar".</echo>
<echo>This jar file contains CloudSim classes only.</echo>
<jar destfile="${jar.dir}/cloudsim-new.jar" basedir="${class.dir}" />
</target>
<target name="clean" description="clean up" >
<delete dir="${class.dir}" />
</target>
</project>
This diff is collapsed.
Running the CloudSim examples
-----------------------------
To run the CloudSim examples you need to do the following steps.
In Windows:
1. cd <PATH TO CLOUDSIM PACKAGE>\jars
2. java -classpath cloudsim-<VERSION>.jar;cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>/jars
2. java -classpath cloudsim-<VERSION>.jar:cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
Where you need to replace:
<PATH TO CLOUDSIM PACKAGE> - by the path to a directory where you have unpacked the CloudSim package
<VERSION> - by the version of the downloaded CloudSim package
<EXAMPLE NUMBER> - by the of number of the example you want to run
CloudSim examples source code
-----------------------------
You can find the source code of the examples in <PATH TO CLOUDSIM PACKAGE>/examples/org/cloudbus/cloudsim/examples/
Compiling and running examples
------------------------------
To compile and run an example (let's say org.cloudbus.cloudsim.examples.CloudSimExample1) you need to do the following steps:
In Windows:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. javac -classpath jars\cloudsim-<VERSION>.jar;examples examples\org\cloudbus\cloudsim\examples\CloudSimExample1.java
3. java -classpath jars\cloudsim-<VERSION>.jar;examples org.cloudbus.cloudsim.examples.CloudSimExample1
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. javac -classpath jars/cloudsim-<VERSION>.jar:examples examples/org/cloudbus/cloudsim/examples/CloudSimExample1.java
3. java -classpath jars/cloudsim-<VERSION>.jar:examples org.cloudbus.cloudsim.examples.CloudSimExample1
Compiling and running examples from the power package
-----------------------------------------------------
To compile and run an example (let's say org.cloudbus.cloudsim.examples.power.planetlab.LrMc) you need to do the following steps:
In Windows:
1. Download Michael Thomas Flanagan's Java Scientific Library from http://www.ee.ucl.ac.uk/~mflanaga/java/
2. Copy flanagan.jar to <PATH TO CLOUDSIM PACKAGE>/jars/
3. cd <PATH TO CLOUDSIM PACKAGE>
4. javac -classpath jars\cloudsim-<VERSION>.jar;jars\flanagan.jar;examples examples\org\cloudbus\cloudsim\examples\power\planetlab\LrMc.java
5. java -classpath jars\cloudsim-<VERSION>.jar;jars\flanagan.jar;examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. chmod +x ./install-flanagan.sh
3. ./install-flanagan.jar
4. javac -classpath jars/cloudsim-<VERSION>.jar:jars/flanagan.jar:examples examples/org/cloudbus/cloudsim/examples/power/planetlab/LrMc.java
5. java -classpath jars/cloudsim-<VERSION>.jar:jars/flanagan.jar:examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc
Description of the CloudSim examples
------------------------------------
Here is the description of what each example does:
CloudSimExample1.java : shows how to create a datacenter with one host and run one cloudlet on it.
CloudSimExample2.java : shows how to create a datacenter with one host and run two cloudlets on it.
The cloudlets run in VMs with the same MIPS requirements. The cloudlets will take the same
time to complete the execution.
CloudSimExample3.java : shows how to create a datacenter with two hosts and run two cloudlets on it.
The cloudlets run in VMs with different MIPS requirements. The cloudlets will take different
time to complete the execution depending on the requested VM performance.
CloudSimExample4.java : shows how to create two datacenters with one host each and run two cloudlets on them.
CloudSimExample5.java : shows how to create two datacenters with one host each and run cloudlets of two users on them.
CloudSimExample6.java : shows how to create scalable simulations.
CloudSimExample7.java : shows how to pause simulations.
CloudSimExample8.java : shows how to add entities in run time.
network: this package contains examples on how to run simulation with network simulation.
power: this package contains examples on how to use CloudSim's power-aware features.
\ No newline at end of file
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
<?xml version="1.0" encoding="UTF-8"?>
<!--
February 2011
Build file for CloudSim.
Note:
Make sure you have installed Maven and put the location of it into
your path so you can access it anywhere.
Maven can be downloadable from http://maven.apache.org/
Usage:
* Type 'mvn package' to compile all cloudsim source files, put them into the
classes/ directory and to create a cloudsim-new.jar file in the jars/ directory.
* Type 'mvn clean' to delete all the compiled classes and the classes/
directory itself. The generated cloudsim-new.jar is not deleted.
Note:
* The generated package is an OSGi-bundle can be used with any OSGi-container.
Particularly, it has been tested with Equinox.
Acknowledgement:
Thank to Miguel Rojas from the High Performance Lab (LAD) at Pontifical Catholic
University of Rio Grande do Sul (PUCRS), Porto Alegre, Brazil for providing this file.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.cloudbus.cloudsim</groupId>
<artifactId>cloudsim-toolkit</artifactId>
<version>4.0</version>
<packaging>bundle</packaging>
<name>cloudsim-toolkit</name>
<description>CloudSim: A Framework For Modeling And Simulation Of Cloud Computing Infrastructures And Services</description>
<url>http://www.cloudbus.org/cloudsim/</url>
<properties>
<jdk.version>1.6</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<felix-version>2.0.1</felix-version>
</properties>
<build>
<directory>classes</directory>
<outputDirectory>classes</outputDirectory>
<finalName>cloudsim-new</finalName>
<testOutputDirectory>classes/test-classes</testOutputDirectory>
<sourceDirectory>sources</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
<configuration>
<maxmemory>1024</maxmemory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>activator</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<bundlor.enabled>true</bundlor.enabled>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix-version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>cloudsim-toolkit</Bundle-Name>
<Bundle-SymbolicName>cloudsim-toolkit</Bundle-SymbolicName>
<Import-Package>org.apache.log4j;resolution:=optional</Import-Package>
<Export-Package>org.cloudbus.cloudsim.*;version="${project.version}"</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Table of Contents
-----------------
1. Directory structure of the CloudSim Toolkit
2. Software requirements: Java version 8 or newer
3. Installation and running the CloudSim Toolkit
4. Running the CloudSim examples
5. Learning CloudSim
1. Directory structure of the CloudSim Toolkit
----------------------------------------------
cloudsim/ -- top level CloudSim directory
docs/ -- CloudSim API Documentation
examples/ -- CloudSim examples
jars/ -- CloudSim jar archives
sources/ -- CloudSim source code
tests/ -- CloudSim unit tests
2. Software requirements: Java version 8 or newer
---------------------------------------------------
CloudSim has been tested and ran on Sun's Java version 8 or newer.
Older versions of Java are not compatible.
If you have non-Sun Java version, such as gcj or J++, they may not be compatible.
You also need to install Ant to compile CloudSim (explained in more details later).
3. Installation and running the CloudSim Toolkit
------------------------------------------------
You just need to unpack the CloudSim file to install.
If you want to remove CloudSim, then remove the whole cloudsim directory.
You do not need to compile CloudSim source code. The JAR files are
provided to compile and to run CloudSim applications:
* jars/cloudsim-<VERSION>.jar -- contains the CloudSim class files
* jars/cloudsim-<VERSION>-sources.jar -- contains the CloudSim source code files
* jars/cloudsim-examples-<VERSION>.jar -- contains the CloudSim examples class files
* jars/cloudsim-examples-<VERSION>-sources.jar -- contains the CloudSim examples source code files
4. Running the CloudSim examples
--------------------------------
Please read how to run the CloudSim examples in examples.txt
5. Learning CloudSim
--------------------
To understand how to use CloudSim, please go through the examples provided
in the examples/ directory.
Cloudsim Project to Release CloudSim Toolkit 4.0
The Cloudbus Project at The University of Melbourne, Australia is proud to announce the
release of the new version of its Cloud simulation software, the CloudSim.
Four years has passed since last major version of CloudSim was released. Cloud computing now is
mainstream, and has been heavily adopted by different industries. It is also omnipresent in
conferences and journals from diverse fields such as high performance computing, grid computing,
distributed systems, operating systems, software engineering, databases and so on. CloudSim has
been present in publications in all the above fields. New applications of Cloud computing are emerging
such as Internet of Things and Big Data, and new technologies are being incorporated to the fabric
of Cloud data centers such as Container virtualization. This version of CloudSim acknowledges these
advances by adding support for virtualization of Container as a Service features, and also solves
many bugs identified along the years.
We encourage the community to keep collaborating with us by notifying us about any identified
bugs, providing feedback on new features you would like to have in future versions of the toolkit,
and also developing your own extension packages, which we will be happy to promote on the project's
homepage. We will also be happy to list on our homepage scientific peer-reviewed papers, whose
results were obtained with CloudSim.
As in its previous version, all components developed as part of the CloudSim Toolkit are open
source released under the Apache license to encourage innovation and pass full freedom to our users.
We would like to thanks all the support we have received from users all around the world. Your
contribution in finding and reporting bugs, proposing (and developing) new features, and even in
using CloudSim has been paramount in the success of the project.
To download the CloudSim software, please visit the Cloudbus Project web site at
http://www.cloudbus.org/cloudsim/
The CloudSim Team
Melbourne, May 2016
<?xml version="1.0"?>
<!--
July 2010
Build file or Makefile for CloudSim.
Note:
Make sure you have installed 'ant' and put the location of it into
your path so you can access it anywhere.
'ant' can be downloadable from http://ant.apache.org/
Usage:
* Type 'ant' to compile all cloudsim source files, put them into the
classes/ directory and to create a cloudsim-new.jar file in the jars/ directory
* Type 'ant clean' to delete all the compiled classes and the classes/
directory itself. The generated cloudsim-new.jar is not deleted.
Note:
* You need to set up PATH for ant in Windows and/or Unix.
Acknowledgement:
Thank to Uros Cibej for providing this file and instruction on
how to use it.
-->
<project name="CloudSim" basedir="." default="makejar">
<description>
This is the build file for CloudSim
</description>
<!-- location to store Java classes -->
<property name="class.dir" location="./classes" />
<!-- location to store CloudSim source files -->
<property name="src.dir" location="./sources" />
<!-- location to store jar files -->
<property name="jar.dir" location="./jars" />
<!-- classpath declaration -->
<path id="classpath">
<fileset dir="./jars">
<include name="*.jar" />
</fileset>
</path>
<target name="prepare">
<mkdir dir="${class.dir}" />
</target>
<!-- rule to compile CloudSim source files -->
<target name="build" depends="prepare">
<javac srcdir="${src.dir}" destdir="${class.dir}" includeantruntime="false">
<classpath refid="classpath"/>
</javac>
</target>
<!-- Rule for making a jar file.
Note:
* The new jar file is named as "cloudsim-new.jar" to avoid overriding
the existing jar file.
* The new jar file only contains cloudsim classes only.
-->
<target name="makejar" depends="build">
<echo>Compiling a new jar file, named: "cloudsim-new.jar".</echo>
<echo>This jar file contains CloudSim classes only.</echo>
<jar destfile="${jar.dir}/cloudsim-new.jar" basedir="${class.dir}" />
</target>
<target name="clean" description="clean up" >
<delete dir="${class.dir}" />
</target>
</project>
This diff is collapsed.
Running the CloudSim examples
-----------------------------
To run the CloudSim examples you need to do the following steps.
In Windows:
1. cd <PATH TO CLOUDSIM PACKAGE>\jars
2. java -classpath cloudsim-<VERSION>.jar;cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>/jars
2. java -classpath cloudsim-<VERSION>.jar:cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
Where you need to replace:
<PATH TO CLOUDSIM PACKAGE> - by the path to a directory where you have unpacked the CloudSim package
<VERSION> - by the version of the downloaded CloudSim package
<EXAMPLE NUMBER> - by the of number of the example you want to run
CloudSim examples source code
-----------------------------
You can find the source code of the examples in <PATH TO CLOUDSIM PACKAGE>/examples/org/cloudbus/cloudsim/examples/
Compiling and running examples
------------------------------
To compile and run an example (let's say org.cloudbus.cloudsim.examples.CloudSimExample1) you need to do the following steps:
In Windows:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. javac -classpath jars\cloudsim-<VERSION>.jar;examples examples\org\cloudbus\cloudsim\examples\CloudSimExample1.java
3. java -classpath jars\cloudsim-<VERSION>.jar;examples org.cloudbus.cloudsim.examples.CloudSimExample1
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. javac -classpath jars/cloudsim-<VERSION>.jar:examples examples/org/cloudbus/cloudsim/examples/CloudSimExample1.java
3. java -classpath jars/cloudsim-<VERSION>.jar:examples org.cloudbus.cloudsim.examples.CloudSimExample1
Compiling and running examples from the power package
-----------------------------------------------------
To compile and run an example (let's say org.cloudbus.cloudsim.examples.power.planetlab.LrMc) you need to do the following steps:
In Windows:
1. Download Michael Thomas Flanagan's Java Scientific Library from http://www.ee.ucl.ac.uk/~mflanaga/java/
2. Copy flanagan.jar to <PATH TO CLOUDSIM PACKAGE>/jars/
3. cd <PATH TO CLOUDSIM PACKAGE>
4. javac -classpath jars\cloudsim-<VERSION>.jar;jars\flanagan.jar;examples examples\org\cloudbus\cloudsim\examples\power\planetlab\LrMc.java
5. java -classpath jars\cloudsim-<VERSION>.jar;jars\flanagan.jar;examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc
In Unix/Linux:
1. cd <PATH TO CLOUDSIM PACKAGE>
2. chmod +x ./install-flanagan.sh
3. ./install-flanagan.jar
4. javac -classpath jars/cloudsim-<VERSION>.jar:jars/flanagan.jar:examples examples/org/cloudbus/cloudsim/examples/power/planetlab/LrMc.java
5. java -classpath jars/cloudsim-<VERSION>.jar:jars/flanagan.jar:examples org.cloudbus.cloudsim.examples.power.planetlab.LrMc
Description of the CloudSim examples
------------------------------------
Here is the description of what each example does:
CloudSimExample1.java : shows how to create a datacenter with one host and run one cloudlet on it.
CloudSimExample2.java : shows how to create a datacenter with one host and run two cloudlets on it.
The cloudlets run in VMs with the same MIPS requirements. The cloudlets will take the same
time to complete the execution.
CloudSimExample3.java : shows how to create a datacenter with two hosts and run two cloudlets on it.
The cloudlets run in VMs with different MIPS requirements. The cloudlets will take different
time to complete the execution depending on the requested VM performance.
CloudSimExample4.java : shows how to create two datacenters with one host each and run two cloudlets on them.
CloudSimExample5.java : shows how to create two datacenters with one host each and run cloudlets of two users on them.
CloudSimExample6.java : shows how to create scalable simulations.
CloudSimExample7.java : shows how to pause simulations.
CloudSimExample8.java : shows how to add entities in run time.
network: this package contains examples on how to run simulation with network simulation.
power: this package contains examples on how to use CloudSim's power-aware features.
\ No newline at end of file
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of this License; and
You must cause any modified files to carry prominent notices stating that You changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
<?xml version="1.0" encoding="UTF-8"?>
<!--
February 2011
Build file for CloudSim.
Note:
Make sure you have installed Maven and put the location of it into
your path so you can access it anywhere.
Maven can be downloadable from http://maven.apache.org/
Usage:
* Type 'mvn package' to compile all cloudsim source files, put them into the
classes/ directory and to create a cloudsim-new.jar file in the jars/ directory.
* Type 'mvn clean' to delete all the compiled classes and the classes/
directory itself. The generated cloudsim-new.jar is not deleted.
Note:
* The generated package is an OSGi-bundle can be used with any OSGi-container.
Particularly, it has been tested with Equinox.
Acknowledgement:
Thank to Miguel Rojas from the High Performance Lab (LAD) at Pontifical Catholic
University of Rio Grande do Sul (PUCRS), Porto Alegre, Brazil for providing this file.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.cloudbus.cloudsim</groupId>
<artifactId>cloudsim-toolkit</artifactId>
<version>4.0</version>
<packaging>bundle</packaging>
<name>cloudsim-toolkit</name>
<description>CloudSim: A Framework For Modeling And Simulation Of Cloud Computing Infrastructures And Services</description>
<url>http://www.cloudbus.org/cloudsim/</url>
<properties>
<jdk.version>1.6</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<felix-version>2.0.1</felix-version>
</properties>
<build>
<directory>classes</directory>
<outputDirectory>classes</outputDirectory>
<finalName>cloudsim-new</finalName>
<testOutputDirectory>classes/test-classes</testOutputDirectory>
<sourceDirectory>sources</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
<configuration>
<maxmemory>1024</maxmemory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<debug>true</debug>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>activator</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<bundlor.enabled>true</bundlor.enabled>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${felix-version}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>cloudsim-toolkit</Bundle-Name>
<Bundle-SymbolicName>cloudsim-toolkit</Bundle-SymbolicName>
<Import-Package>org.apache.log4j;resolution:=optional</Import-Package>
<Export-Package>org.cloudbus.cloudsim.*;version="${project.version}"</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Table of Contents
-----------------
1. Directory structure of the CloudSim Toolkit
2. Software requirements: Java version 8 or newer
3. Installation and running the CloudSim Toolkit
4. Running the CloudSim examples
5. Learning CloudSim
1. Directory structure of the CloudSim Toolkit
----------------------------------------------
cloudsim/ -- top level CloudSim directory
docs/ -- CloudSim API Documentation
examples/ -- CloudSim examples
jars/ -- CloudSim jar archives
sources/ -- CloudSim source code
tests/ -- CloudSim unit tests
2. Software requirements: Java version 8 or newer
---------------------------------------------------
CloudSim has been tested and ran on Sun's Java version 8 or newer.
Older versions of Java are not compatible.
If you have non-Sun Java version, such as gcj or J++, they may not be compatible.
You also need to install Ant to compile CloudSim (explained in more details later).
3. Installation and running the CloudSim Toolkit
------------------------------------------------
You just need to unpack the CloudSim file to install.
If you want to remove CloudSim, then remove the whole cloudsim directory.
You do not need to compile CloudSim source code. The JAR files are
provided to compile and to run CloudSim applications:
* jars/cloudsim-<VERSION>.jar -- contains the CloudSim class files
* jars/cloudsim-<VERSION>-sources.jar -- contains the CloudSim source code files
* jars/cloudsim-examples-<VERSION>.jar -- contains the CloudSim examples class files
* jars/cloudsim-examples-<VERSION>-sources.jar -- contains the CloudSim examples source code files
4. Running the CloudSim examples
--------------------------------
Please read how to run the CloudSim examples in examples.txt
5. Learning CloudSim
--------------------
To understand how to use CloudSim, please go through the examples provided
in the examples/ directory.
Cloudsim Project to Release CloudSim Toolkit 4.0
The Cloudbus Project at The University of Melbourne, Australia is proud to announce the
release of the new version of its Cloud simulation software, the CloudSim.
Four years has passed since last major version of CloudSim was released. Cloud computing now is
mainstream, and has been heavily adopted by different industries. It is also omnipresent in
conferences and journals from diverse fields such as high performance computing, grid computing,
distributed systems, operating systems, software engineering, databases and so on. CloudSim has
been present in publications in all the above fields. New applications of Cloud computing are emerging
such as Internet of Things and Big Data, and new technologies are being incorporated to the fabric
of Cloud data centers such as Container virtualization. This version of CloudSim acknowledges these
advances by adding support for virtualization of Container as a Service features, and also solves
many bugs identified along the years.
We encourage the community to keep collaborating with us by notifying us about any identified
bugs, providing feedback on new features you would like to have in future versions of the toolkit,
and also developing your own extension packages, which we will be happy to promote on the project's
homepage. We will also be happy to list on our homepage scientific peer-reviewed papers, whose
results were obtained with CloudSim.
As in its previous version, all components developed as part of the CloudSim Toolkit are open
source released under the Apache license to encourage innovation and pass full freedom to our users.
We would like to thanks all the support we have received from users all around the world. Your
contribution in finding and reporting bugs, proposing (and developing) new features, and even in
using CloudSim has been paramount in the success of the project.
To download the CloudSim software, please visit the Cloudbus Project web site at
http://www.cloudbus.org/cloudsim/
The CloudSim Team
Melbourne, May 2016
File added
#Generated by Maven
#Tue Sep 11 15:48:58 IRDT 2018
version=4.0
groupId=org.cloudbus.cloudsim
artifactId=documentation
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>modules</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
/target/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>modules_cloudsim-examples</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>modules</artifactId>
<groupId>org.cloudbus.cloudsim</groupId>
<version>4.0</version>
</parent>
<artifactId>cloudsim-examples</artifactId>
<name>cloudsim-examples</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cloudsim</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>de.vandermeer</groupId>
<artifactId>asciitable</artifactId>
<version>0.3.2</version>
</dependency>
</dependencies>
</project>
/*
* 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, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* a datacenter with one host and run two
* cloudlets on it. The cloudlets run in
* VMs with the same MIPS requirements.
* The cloudlets will take the same time to
* complete the execution.
*/
public class CloudSimExample2 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample2...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
//Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();
//Fourth step: Create one virtual machine
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create two VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//add the VMs to the vmList
vmlist.add(vm1);
vmlist.add(vm2);
//submit vm list to the broker
broker.submitVmList(vmlist);
//Fifth step: Create two Cloudlets
cloudletList = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
pesNumber=1;
long length = 250000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId);
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
//add the cloudlets to the list
cloudletList.add(cloudlet1);
cloudletList.add(cloudlet2);
//submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);
//bind the cloudlets to the vms. This way, the broker
// will submit the bound cloudlets only to the specific VM
broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());
broker.bindCloudletToVm(cloudlet2.getCloudletId(),vm2.getId());
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("CloudSimExample2 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBroker createBroker(){
DatacenterBroker broker = null;
try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
e.printStackTrace();
return null;
}
return broker;
}
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
indent + indent + dft.format(cloudlet.getActualCPUTime()) + indent + indent + dft.format(cloudlet.getExecStartTime())+
indent + indent + dft.format(cloudlet.getFinishTime()));
}
}
}
}
/*
* 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, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerTimeShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* a datacenter with two hosts and run two
* cloudlets on it. The cloudlets run in
* VMs with different MIPS requirements.
* The cloudlets will take different time
* to complete the execution depending on
* the requested VM performance.
*/
public class CloudSimExample3 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample3...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
//Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();
//Fourth step: Create one virtual machine
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 2048; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create two VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//the second VM will have twice the priority of VM1 and so will receive twice CPU time
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips * 2, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//add the VMs to the vmList
vmlist.add(vm1);
vmlist.add(vm2);
//submit vm list to the broker
broker.submitVmList(vmlist);
//Fifth step: Create two Cloudlets
cloudletList = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId);
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
//add the cloudlets to the list
cloudletList.add(cloudlet1);
cloudletList.add(cloudlet2);
//submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);
//bind the cloudlets to the vms. This way, the broker
// will submit the bound cloudlets only to the specific VM
broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());
broker.bindCloudletToVm(cloudlet2.getCloudletId(),vm2.getId());
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("CloudSimExample3 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
//4. Create Hosts with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerTimeShared(peList)
)
); // This is our first machine
//create another machine in the Data center
List<Pe> peList2 = new ArrayList<Pe>();
peList2.add(new Pe(0, new PeProvisionerSimple(mips)));
hostId++;
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList2,
new VmSchedulerTimeShared(peList2)
)
); // This is our second machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBroker createBroker(){
DatacenterBroker broker = null;
try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
e.printStackTrace();
return null;
}
return broker;
}
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
indent + indent + dft.format(cloudlet.getActualCPUTime()) + indent + indent + dft.format(cloudlet.getExecStartTime())+
indent + indent + dft.format(cloudlet.getFinishTime()));
}
}
}
}
/*
* 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, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* two datacenters with one host each and
* run two cloudlets on them.
*/
public class CloudSimExample4 {
/** The cloudlet list. */
private static List<Cloudlet> cloudletList;
/** The vmlist. */
private static List<Vm> vmlist;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample4...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the GridSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
@SuppressWarnings("unused")
Datacenter datacenter1 = createDatacenter("Datacenter_1");
//Third step: Create Broker
DatacenterBroker broker = createBroker();
int brokerId = broker.getId();
//Fourth step: Create one virtual machine
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create two VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
vmid++;
Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//add the VMs to the vmList
vmlist.add(vm1);
vmlist.add(vm2);
//submit vm list to the broker
broker.submitVmList(vmlist);
//Fifth step: Create two Cloudlets
cloudletList = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId);
id++;
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId);
//add the cloudlets to the list
cloudletList.add(cloudlet1);
cloudletList.add(cloudlet2);
//submit cloudlet list to the broker
broker.submitCloudletList(cloudletList);
//bind the cloudlets to the vms. This way, the broker
// will submit the bound cloudlets only to the specific VM
broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());
broker.bindCloudletToVm(cloudlet2.getCloudletId(),vm2.getId());
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
Log.printLine("CloudSimExample4 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
//in this example, the VMAllocatonPolicy in use is SpaceShared. It means that only one VM
//is allowed to run on each Pe. As each Host has only one Pe, only one VM can run on each Host.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
); // This is our first machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBroker createBroker(){
DatacenterBroker broker = null;
try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
e.printStackTrace();
return null;
}
return broker;
}
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
indent + indent + dft.format(cloudlet.getActualCPUTime()) + indent + indent + dft.format(cloudlet.getExecStartTime())+
indent + indent + dft.format(cloudlet.getFinishTime()));
}
}
}
}
/*
* 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, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.examples;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicySimple;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
/**
* A simple example showing how to create
* two datacenters with one host each and
* run cloudlets of two users on them.
*/
public class CloudSimExample5 {
/** The cloudlet lists. */
private static List<Cloudlet> cloudletList1;
private static List<Cloudlet> cloudletList2;
/** The vmlists. */
private static List<Vm> vmlist1;
private static List<Vm> vmlist2;
/**
* Creates main() to run this example
*/
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample5...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 2; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation
@SuppressWarnings("unused")
Datacenter datacenter0 = createDatacenter("Datacenter_0");
@SuppressWarnings("unused")
Datacenter datacenter1 = createDatacenter("Datacenter_1");
//Third step: Create Brokers
DatacenterBroker broker1 = createBroker(1);
int brokerId1 = broker1.getId();
DatacenterBroker broker2 = createBroker(2);
int brokerId2 = broker2.getId();
//Fourth step: Create one virtual machine for each broker/user
vmlist1 = new ArrayList<Vm>();
vmlist2 = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name
//create two VMs: the first one belongs to user1
Vm vm1 = new Vm(vmid, brokerId1, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//the second VM: this one belongs to user2
Vm vm2 = new Vm(vmid, brokerId2, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared());
//add the VMs to the vmlists
vmlist1.add(vm1);
vmlist2.add(vm2);
//submit vm list to the broker
broker1.submitVmList(vmlist1);
broker2.submitVmList(vmlist2);
//Fifth step: Create two Cloudlets
cloudletList1 = new ArrayList<Cloudlet>();
cloudletList2 = new ArrayList<Cloudlet>();
//Cloudlet properties
int id = 0;
long length = 40000;
long fileSize = 300;
long outputSize = 300;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet1.setUserId(brokerId1);
Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize, utilizationModel, utilizationModel, utilizationModel);
cloudlet2.setUserId(brokerId2);
//add the cloudlets to the lists: each cloudlet belongs to one user
cloudletList1.add(cloudlet1);
cloudletList2.add(cloudlet2);
//submit cloudlet list to the brokers
broker1.submitCloudletList(cloudletList1);
broker2.submitCloudletList(cloudletList2);
// Sixth step: Starts the simulation
CloudSim.startSimulation();
// Final step: Print results when simulation is over
List<Cloudlet> newList1 = broker1.getCloudletReceivedList();
List<Cloudlet> newList2 = broker2.getCloudletReceivedList();
CloudSim.stopSimulation();
Log.print("=============> User "+brokerId1+" ");
printCloudletList(newList1);
Log.print("=============> User "+brokerId2+" ");
printCloudletList(newList2);
Log.printLine("CloudSimExample5 finished!");
}
catch (Exception e) {
e.printStackTrace();
Log.printLine("The simulation has been terminated due to an unexpected error");
}
}
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store
// our machine
List<Host> hostList = new ArrayList<Host>();
// 2. A Machine contains one or more PEs or CPUs/Cores.
// In this example, it will have only one core.
List<Pe> peList = new ArrayList<Pe>();
int mips=1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 2048; //host memory (MB)
long storage = 1000000; //host storage
int bw = 10000;
//in this example, the VMAllocatonPolicy in use is SpaceShared. It means that only one VM
//is allowed to run on each Pe. As each Host has only one Pe, only one VM can run on each Host.
hostList.add(
new Host(
hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList)
)
); // This is our first machine
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, cost, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);
} catch (Exception e) {
e.printStackTrace();
}
return datacenter;
}
//We strongly encourage users to develop their own broker policies, to submit vms and cloudlets according
//to the specific rules of the simulated scenario
private static DatacenterBroker createBroker(int id){
DatacenterBroker broker = null;
try {
broker = new DatacenterBroker("Broker"+id);
} catch (Exception e) {
e.printStackTrace();
return null;
}
return broker;
}
/**
* Prints the Cloudlet objects
* @param list list of Cloudlets
*/
private static void printCloudletList(List<Cloudlet> list) {
int size = list.size();
Cloudlet cloudlet;
String indent = " ";
Log.printLine();
Log.printLine("========== OUTPUT ==========");
Log.printLine("Cloudlet ID" + indent + "STATUS" + indent +
"Data center ID" + indent + "VM ID" + indent + "Time" + indent + "Start Time" + indent + "Finish Time");
DecimalFormat dft = new DecimalFormat("###.##");
for (int i = 0; i < size; i++) {
cloudlet = list.get(i);
Log.print(indent + cloudlet.getCloudletId() + indent + indent);
if (cloudlet.getCloudletStatus() == Cloudlet.SUCCESS){
Log.print("SUCCESS");
Log.printLine( indent + indent + cloudlet.getResourceId() + indent + indent + indent + cloudlet.getVmId() +
indent + indent + dft.format(cloudlet.getActualCPUTime()) + indent + indent + dft.format(cloudlet.getExecStartTime())+
indent + indent + dft.format(cloudlet.getFinishTime()));
}
}
}
}
package org.cloudbus.cloudsim.examples.container;
import org.cloudbus.cloudsim.power.models.PowerModel;
import org.cloudbus.cloudsim.power.models.PowerModelSpecPowerHpProLiantMl110G4Xeon3040;
import org.cloudbus.cloudsim.power.models.PowerModelSpecPowerHpProLiantMl110G5Xeon3075;
import org.cloudbus.cloudsim.power.models.PowerModelSpecPowerIbmX3550XeonX5670;
/**
* In this class the specifications of the Cloudlets, Containers, VMs and Hosts are coded.
* Regarding to the hosts, the powermodel of each type of the hosts are all included in this class.
*/
public class ConstantsExamples {
/**
* Simulation parameters including the interval and limit
*/
public static final boolean ENABLE_OUTPUT = true;
public static final boolean OUTPUT_CSV = false;
public static final double SCHEDULING_INTERVAL = 300.0D;
public static final double SIMULATION_LIMIT = 87400.0D;
/**
* Cloudlet specs
*/
public static final int CLOUDLET_LENGTH = 30;
public static final int CLOUDLET_PES = 1;
/**
* Startup delay for VMs and the containers are mentioned here.
*/
public static final double CONTAINER_STARTTUP_DELAY = 0.4;//the amount is in seconds
public static final double VM_STARTTUP_DELAY = 100;//the amoun is in seconds
/**
* The available virtual machine types along with the specs.
*/
public static final int VM_TYPES = 4;
public static final double[] VM_MIPS = new double[]{37274/ 2, 37274 / 2, 37274 / 2, 37274 / 2};
public static final int[] VM_PES = new int[]{2, 4, 1, 8};
public static final float[] VM_RAM = new float[] {(float)1024, (float) 2048, (float) 4096, (float) 8192};//**MB*
public static final int VM_BW = 100000;
public static final int VM_SIZE = 2500;
/**
* The available types of container along with the specs.
*/
public static final int CONTAINER_TYPES = 3;
public static final int[] CONTAINER_MIPS = new int[]{4658, 9320, 18636};
public static final int[] CONTAINER_PES = new int[]{1, 1, 1};
public static final int[] CONTAINER_RAM = new int[]{128, 256, 512};
public static final int CONTAINER_BW = 2500;
/**
* The available types of hosts along with the specs.
*/
public static final int HOST_TYPES = 3;
public static final int[] HOST_MIPS = new int[]{37274, 37274, 37274};
public static final int[] HOST_PES = new int[]{4, 8, 16};
public static final int[] HOST_RAM = new int[]{65536, 131072, 262144};
public static final int HOST_BW = 1000000;
public static final int HOST_STORAGE = 1000000;
public static final PowerModel[] HOST_POWER = new PowerModel[]{new PowerModelSpecPowerHpProLiantMl110G4Xeon3040(),
new PowerModelSpecPowerHpProLiantMl110G5Xeon3075(), new PowerModelSpecPowerIbmX3550XeonX5670()};
/**
* The population of hosts, containers, and VMs are specified.
* The containers population is equal to the cloudlets population as each cloudlet is mapped to each container.
* However, depending on the simualtion scenario the container's population can also be different from cloudlet's
* population.
*/
public static final int NUMBER_HOSTS = 20;
public static final int NUMBER_VMS = 25;
public static final int NUMBER_CLOUDLETS = 50;
//-----------------------The Addresses
// public static String logAddress;
//
// public String getLogAddress() {
// return logAddress;
// }
//
// public void setLogAddress(String logAddress) {
// this.logAddress = logAddress;
// }
//
public ConstantsExamples() {
}
}
package org.cloudbus.cloudsim.examples.container;
import java.io.IOException;
/**
* This Example is following the format for {@link org.cloudbus.cloudsim.examples.power.planetlab.Dvfs}
* It specifically studies the initial placement of containers.
*
* @author Sareh Fotuhi Piraghaj
*/
public class ContainerInitialPlacementTest {
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
/**
* The experiments can be repeated for (repeat - runtime +1) times.
* Please set these values as the arguments of the main function or set them bellow:
*/
int runTime = Integer.parseInt(args[0]);
int repeat = Integer.parseInt(args[1]);
for (int i = runTime; i < repeat; ++i) {
boolean enableOutput = true;
boolean outputToFile = true;
/**
* Getting the path of the planet lab workload that is included in the cloudSim Package
*/
String inputFolder = ContainerOverbooking.class.getClassLoader().getResource("workload/planetlab").getPath();
/**
* The output folder for the logs. The log files would be located in this folder.
*/
String outputFolder = "~/Results";
/**
* The allocation policy for VMs.
*/
String vmAllocationPolicy = "MSThreshold-Under_0.80_0.70";
/**
* The selection policy for containers where a container migration is triggered.
*/
String containerSelectionPolicy = "MaxUsage";
/**
* The allocation policy used for allocating containers to VMs.
*/
String containerAllocationPolicy = "MostFull";
/**
* The host selection policy determines which hosts should be selected as the migration destination.
*/
String hostSelectionPolicy = "FirstFit";
/**
* The VM Selection Policy is used for selecting VMs to migrate when a host status is determined as
* "Overloaded"
*/
String vmSelectionPolicy = "VmMaxC";
/**
* The container overbooking factor is used for overbooking resources of the VM. In this specific case
* the overbooking is performed on CPU only.
*/
int OverBookingFactor = 80;
new RunnerInitiator(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
vmAllocationPolicy,
containerAllocationPolicy,
vmSelectionPolicy,
containerSelectionPolicy,
hostSelectionPolicy,
OverBookingFactor, Integer.toString(i), outputFolder);
}
}
}
package org.cloudbus.cloudsim.examples.container;
import java.io.IOException;
/**
* This Example is following the format for {@link org.cloudbus.cloudsim.examples.power.planetlab.Dvfs}
* It specifically studies the placement of containers.
*
* @author Sareh Fotuhi Piraghaj
*/
public class ContainerOverbooking {
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
/**
* The experiments can be repeated for (repeat - runtime +1) times.
* Please set these values as the arguments of the main function or set them bellow:
*/
int runTime = Integer.parseInt(args[0]);
int repeat = Integer.parseInt(args[1]);
for (int i = 10; i < repeat; i += 10) {
boolean enableOutput = true;
boolean outputToFile = true;
/**
* Getting the path of the planet lab workload that is included in the cloudSim Package
*/
String inputFolder = ContainerOverbooking.class.getClassLoader().getResource("workload/planetlab").getPath();
/**
* The output folder for the logs. The log files would be located in this folder.
*/
String outputFolder = "/Results";
/**
* The allocation policy for VMs. It has the under utilization and over utilization thresholds used for
* determining the underloaded and oberloaded hosts.
*/
String vmAllocationPolicy = "MSThreshold-Under_0.80_0.70"; // DVFS policy without VM migrations
/**
* The selection policy for containers where a container migration is triggered.
*/
String containerSelectionPolicy = "Cor";
/**
* The allocation policy used for allocating containers to VMs.
*/
String containerAllocationPolicy = "MostFull";
// String containerAllocationPolicy= "FirstFit";
// String containerAllocationPolicy= "LeastFull";
// String containerAllocationPolicy= "Simple";
// String containerAllocationPolicy = "Random";
/**
* The host selection policy determines which hosts should be selected as the migration destination.
*/
String hostSelectionPolicy = "FirstFit";
/**
* The VM Selection Policy is used for selecting VMs to migrate when a host status is determined as
* "Overloaded"
*/
String vmSelectionPolicy = "VmMaxC";
new RunnerInitiator(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
vmAllocationPolicy,
containerAllocationPolicy,
vmSelectionPolicy,
containerSelectionPolicy,
hostSelectionPolicy,
i, Integer.toString(runTime), outputFolder);
}
}
}
package org.cloudbus.cloudsim.examples.container;
import java.io.IOException;
/**
* This Example is following the format for {@link org.cloudbus.cloudsim.examples.power.planetlab.Dvfs}
* It specifically studies the placement of containers.
*
* @author Sareh Fotuhi Piraghaj
*/
public class ContainerSelectionTest {
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public static void main(String[] args) throws IOException {
/**
* The experiments can be repeated for (repeat - runtime +1) times.
* Please set these values as the arguments of the main function or set them bellow:
*/
int runTime = Integer.parseInt(args[0]);
int repeat = Integer.parseInt(args[1]);
for (int i = runTime ; i < repeat; ++i) {
boolean enableOutput = true;
boolean outputToFile = true;
/**
* Getting the path of the planet lab workload that is included in the cloudSim Package
*/
String inputFolder = ContainerOverbooking.class.getClassLoader().getResource("workload/planetlab").getPath();
/**
* The output folder for the logs. The log files would be located in this folder.
*/
String outputFolder = "~/Results";
/**
* The allocation policy for VMs.
*/
String vmAllocationPolicy = "MSThreshold-Under_0.80_0.70"; // DVFS policy without VM migrations
/**
* The selection policy for containers where a container migration is triggered.
*/
// String containerSelectionPolicy = "MaxUsage";
String containerSelectionPolicy = "Cor";
/**
* The allocation policy used for allocating containers to VMs.
*/
// String containerAllocationPolicy= "MostFull";
String containerAllocationPolicy= "FirstFit";
/**
* The host selection policy determines which hosts should be selected as the migration destination.
*/
String hostSelectionPolicy = "FirstFit";
/**
* The VM Selection Policy is used for selecting VMs to migrate when a host status is determined as
* "Overloaded"
*/
String vmSelectionPolicy = "VmMaxC";
/**
* The container overbooking factor is used for overbooking resources of the VM. In this specific case
* the overbooking is performed on CPU only.
*/
int OverBookingFactor = 80;
new RunnerInitiator(
enableOutput,
outputToFile,
inputFolder,
outputFolder,
vmAllocationPolicy,
containerAllocationPolicy,
vmSelectionPolicy,
containerSelectionPolicy,
hostSelectionPolicy,
OverBookingFactor, Integer.toString(i), outputFolder);
}
}
}
package org.cloudbus.cloudsim.examples.container;
import org.cloudbus.cloudsim.UtilizationModelPlanetLabInMemory;
import org.cloudbus.cloudsim.examples.power.Constants;
import java.io.IOException;
/**
* Created by sareh on 5/08/15.
*/
public class UtilizationModelPlanetLabInMemoryExtended extends UtilizationModelPlanetLabInMemory {
public UtilizationModelPlanetLabInMemoryExtended(String inputPath, double schedulingInterval) throws NumberFormatException, IOException {
super(inputPath, schedulingInterval);
}
public UtilizationModelPlanetLabInMemoryExtended(String inputPath, double schedulingInterval, int dataSamples) throws NumberFormatException, IOException {
super(inputPath, schedulingInterval, dataSamples);
}
/*
* (non-Javadoc)
* @see cloudsim.power.UtilizationModel#getUtilization(double)
*/
@Override
public double getUtilization(double inputTime) {
double utilization;
if (inputTime > Constants.SIMULATION_LIMIT || inputTime == Constants.SIMULATION_LIMIT) {
utilization = calUtilization(inputTime % Constants.SIMULATION_LIMIT);
} else {
utilization = calUtilization(inputTime);
}
return utilization;
}
public double calUtilization(double time) {
// Log.print(time);
double[] data = super.getData();
if (time % getSchedulingInterval() == 0) {
return data[(int) time / (int) getSchedulingInterval()];
}
int time1 = (int) Math.floor(time / getSchedulingInterval());
int time2 = (int) Math.ceil(time / getSchedulingInterval());
double utilization1 = data[time1];
double utilization2 = data[time2];
double delta = (utilization2 - utilization1) / ((time2 - time1) * getSchedulingInterval());
double utilization = utilization1 + delta * (time - time1 * getSchedulingInterval());
return utilization;
}
}
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