Commit 53023e7a authored by Anton Beloglazov's avatar Anton Beloglazov

- Added ant build file

- Updated the readme files
parent 9de43c8d
<?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" />
<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}" classpath="${classpath}" />
</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 directory contains examples in the use of CloudSim Running the CloudSim examples
-----------------------------
To run the CloudSim examples you need to do the following steps.
To compile the example source codes: In Windows:
In Unix/Linux: javac -classpath $CLOUDSIM/jar/cloudsim-2.0.jar:. cloudsim/examples/CloudSimExampleX.java 1. cd <PATH TO CLOUDSIM PACKAGE>\jars
In Windows: javac -classpath %CLOUDSIM%\jar\cloudsim-2.0.jar;. cloudsim\examples\CloudSimExampleX.java 2. java -classpath cloudsim-<VERSION>.jar;cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
To run the class file: In Unix/Linux:
In Unix/Linux:
java -classpath $CLOUDSIM/jar/cloudsim-2.0.jar:. cloudsim.examples.CloudSimExampleX > file.txt
In Windows: 1. cd <PATH TO CLOUDSIM PACKAGE>/jars
java -classpath %CLOUDSIM%\jar\cloudsim-2.0.jar;. cloudsim.examples.CloudSimExampleX > file.txt 2. java -classpath cloudsim-<VERSION>.jar:cloudsim-examples-<VERSION>.jar org.cloudbus.cloudsim.examples.CloudSimExample<EXAMPLE NUMBER>
The above command means run the program and output the results into a file Where you need to replace:
named "file.txt" rather than into screen or standard output.
<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
Here are the summary of what each example does:
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\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/org/cloudbus/cloudsim/examples/CloudSimExample1.java
3. java -classpath jars/cloudsim-<VERSION>.jar:examples org.cloudbus.cloudsim.examples.CloudSimExample1
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. CloudSimExample1.java : shows how to create a datacenter with one host and run one cloudlet on it.
...@@ -38,6 +68,6 @@ CloudSimExample7.java : shows how to pause simulations. ...@@ -38,6 +68,6 @@ CloudSimExample7.java : shows how to pause simulations.
CloudSimExample8.java : shows how to add entities in run time. CloudSimExample8.java : shows how to add entities in run time.
network: this directory contains examples on how to run simulation with network simulation. network: this package contains examples on how to run simulation with network simulation.
power: this directory contains examples on how to use CloudSim's power-aware features. power: this package contains examples on how to use CloudSim's power-aware features.
\ No newline at end of file \ No newline at end of file
Directory Structure of CloudSim Toolkit 2.0 Directory structure of the CloudSim Toolkit
--------------------------------------- -------------------------------------------
$CLOUDSIM/ -- top level CloudSim directory cloudsim/ -- top level CloudSim directory
classes/ -- The CloudSim class files docs/ -- CloudSim API Documentation
doc/ -- CloudSim API Documentation examples/ -- CloudSim examples
examples/ -- CloudSim examples and Class Diagram jars/ -- CloudSim jar archives
jar/ -- CloudSim jar archives sources/ -- CloudSim source code
lib/ -- external libraries tests/ -- CloudSim unit tests
src/ -- CloudSim source code
test -- CloudSim unit tests
Software requirements: Java version 1.6 or newer
Software Requirements : Java version 1.6 or newer -------------------------------------------------
---------------------
CloudSim has been tested and ran on Sun's Java version 1.6.0 or newer. CloudSim has been tested and ran on Sun's Java version 1.6.0 or newer.
Older versions of Java are not compatible. Older versions of Java are not compatible.
If you have non-Sun Java version, such as gcj or J++, they may not be 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). You also need to install Ant to compile CloudSim (explained in more details later).
Installation and Running CloudSim Toolkit 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.
NOTE: You do not need to compile CloudSim source code. The JAR file is
provided to compile and to run CloudSim applications.
* cloudsim.jar -- contains CloudSim class files only 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:
To compile and run CloudSim applications, do the following step: * jars/cloudsim-<VERSION>.jar -- contains the CloudSim class files
1) Go the directory where the CloudSim's Examples reside * jars/cloudsim-<VERSION>-sources.jar -- contains the CloudSim source code files
In Unix or Linux: cd $CLOUDSIM/examples/ * jars/cloudsim-examples-<VERSION>.jar -- contains the CloudSim examples class files
In Windows: cd %CLOUDSIM%\examples\ * jars/cloudsim-examples-<VERSION>-sources.jar -- contains the CloudSim examples source code files
2) Compile the Java source file
In Unix or Linux: javac -classpath $CLOUDSIM/jar/cloudsim-2.0.jar:. cloudsim/examples/CloudSimExampleX.java
In Windows: javac -classpath %CLOUDSIM%\jar\cloudsim-2.0.jar;. cloudsim\examples\CloudSimExampleX.java
3) Running the Java class file Running the CloudSim examples
In Unix or Linux: java -classpath $CLOUDSIM/jar/cloudsim-2.0.jar:. cloudsim.examples.CloudSimExampleX -----------------------------
In Windows: java -classpath %CLOUDSIM%\jar\cloudsim-2.0.jar;. cloudsim.examples.CloudSimExampleX
NOTE: Please read how to run the CloudSim examples in examples.txt
* $CLOUDSIM or %CLOUDSIM% is the location of the CloudSim Toolkit package.
Learning CloudSim Learning CloudSim
----------------- -----------------
To understand how to use CloudSim, please go through the examples provided To understand how to use CloudSim, please go through the examples provided
in the $CLOUDSIM/examples/ directory. in the examples/ directory.
Compiling CloudSim: using Ant
-----------------------------
Compiling CloudSim : Using Ant
------------------
This release contains a simple buildfile for compiling CloudSim classes. This release contains a simple buildfile for compiling CloudSim classes.
You need to have ant installed (http://ant.apache.org/). You need to have ant installed (http://ant.apache.org/).
Ant can be used in both Windows and Unix/Linux environment. Ant can be used in both Windows and Unix/Linux environment.
Usage: Usage:
* type 'ant' to compile all CloudSim source files and put them into
classes/ directory * Being in the CloudSim root directory (cloudsim/), type 'ant' to compile all
* type 'ant makejar' to compile the source files (if necessary) and to create cloudsim source files, put them into the classes/ directory and to create
a new jar file called "new_cloudsim.jar" into jars/ directory. a cloudsim-new.jar file in the jars/ directory
NOTE: * Being in the CloudSim root directory (cloudsim/), type 'ant clean' to delete
* You need to set up PATH for ant in Windows and/or Unix. all the compiled classes and the classes/ directory itself. The generated
* rule for javadoc is not included yet. Use javadoc.sh script on Unix instead. cloudsim-new.jar is not deleted.
Note:
* You need to set up PATH for ant in Windows and/or Unix.
...@@ -79,7 +79,7 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy { ...@@ -79,7 +79,7 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
if (!getVmTable().containsKey(vm.getUid())) { //if this vm was not created if (!getVmTable().containsKey(vm.getUid())) { //if this vm was not created
do {//we still trying until we find a host or untill we try all of them do {//we still trying until we find a host or until we try all of them
int moreFree = Integer.MIN_VALUE; int moreFree = Integer.MIN_VALUE;
int idx = -1; int idx = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment