Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gpucloudsim
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LPDS
gpucloudsim
Commits
bc1fa0a6
Commit
bc1fa0a6
authored
Jan 05, 2012
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the examples of the LR and LRR policies with a random workload
parent
8a508691
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
292 additions
and
512 deletions
+292
-512
IqrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrMc.java
+1
-1
IqrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/IqrMmt.java
+1
-1
IqrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrMu.java
+1
-1
IqrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrRs.java
+1
-1
LrMc.java
...ava/org/cloudbus/cloudsim/examples/power/random/LrMc.java
+35
-64
LrMmt.java
...va/org/cloudbus/cloudsim/examples/power/random/LrMmt.java
+35
-62
LrMu.java
...ava/org/cloudbus/cloudsim/examples/power/random/LrMu.java
+35
-62
LrRs.java
...ava/org/cloudbus/cloudsim/examples/power/random/LrRs.java
+35
-62
LrrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/LrrMc.java
+35
-64
LrrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/LrrMmt.java
+35
-62
LrrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/LrrMu.java
+35
-62
LrrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/LrrRs.java
+35
-62
MadMc.java
...va/org/cloudbus/cloudsim/examples/power/random/MadMc.java
+1
-1
MadMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/MadMmt.java
+1
-1
MadMu.java
...va/org/cloudbus/cloudsim/examples/power/random/MadMu.java
+1
-1
MadRs.java
...va/org/cloudbus/cloudsim/examples/power/random/MadRs.java
+1
-1
ThrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
+1
-1
ThrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
+1
-1
ThrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
+1
-1
ThrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
+1
-1
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMc.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class IqrMc {
...
@@ -33,7 +33,7 @@ public class IqrMc {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range
(IQR)
VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMmt.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class IqrMmt {
...
@@ -33,7 +33,7 @@ public class IqrMmt {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range
(IQR)
VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMu.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class IqrMu {
...
@@ -33,7 +33,7 @@ public class IqrMu {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range
(IQR)
VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrRs.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class IqrRs {
...
@@ -33,7 +33,7 @@ public class IqrRs {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range
(IQR)
VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrMc.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMaximumCorrelation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time.
* allocation policy and Maximum Correlation (MC) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrMc
{
public
class
LrMc
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lr_mc"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lr"
;
// Local Regression (LR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMaximumCorrelation
(
vmSelectionPolicy
,
new
PowerVmSelectionPolicyRandomSelection
());
parameter
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegression
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrMmt.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time.
* allocation policy and Minimum Migration Time (MMT) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrMmt
{
public
class
LrMmt
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lr_mmt"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lr"
;
// Local Regression (LR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMinimumMigrationTime
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegression
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrMu.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time.
* allocation policy and Minimum Utilization (MU) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrMu
{
public
class
LrMu
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lr_mu"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lr"
;
// Local Regression (LR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMinimumUtilization
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegression
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrRs.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression (LR) VM
* the time.
* allocation policy and Random Selection (RS) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrRs
{
public
class
LrRs
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lr_rs"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lr"
;
// Local Regression (LR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyRandomSelection
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegression
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrrMc.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMaximumCorrelation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time.
* (LRR) VM allocation policy and Maximum Correlation (MC) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrrMc
{
public
class
LrrMc
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lrr_mc"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lrr"
;
// Local Regression Robust (LRR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LRR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMaximumCorrelation
(
vmSelectionPolicy
,
new
PowerVmSelectionPolicyRandomSelection
());
parameter
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegressionRobust
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrrMmt.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time.
* (LRR) VM allocation policy and Minimum Migration Time (MMT) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrrMmt
{
public
class
LrrMmt
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lrr_mmt"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lrr"
;
// Local Regression Robust (LRR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LRR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMinimumMigrationTime
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegressionRobust
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationStaticThreshold
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"The simulation has been terminated due to an unexpected error"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrrMu.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time.
* (LRR) VM allocation policy and Minimum Utilization (MU) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrrMu
{
public
class
LrrMu
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lrr_mu"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lrr"
;
// Local Regression Robust (LRR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LRR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyMinimumUtilization
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegressionRobust
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationStaticThreshold
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"The simulation has been terminated due to an unexpected error"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/LrrRs.java
View file @
bc1fa0a6
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* A simulation of a heterogeneous power aware data center that applies the Local Regression Robust
* the time.
* (LRR) VM allocation policy and Random Selection (RS) VM selection policy.
*
* The remaining configuration parameters are in the Constants and RandomConstants classes.
*
* If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
* Anton Beloglazov, and Rajkumar Buyya, "Optimal Online Deterministic Algorithms and Adaptive
* Heuristics for Energy and Performance Efficient Dynamic Consolidation of Virtual Machines in
* Cloud Data Centers", Concurrency and Computation: Practice and Experience, ISSN: 1532-0626, Wiley
* Press, New York, USA, 2011, DOI: 10.1002/cpe.1867
*
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
*/
public
class
LrrRs
{
public
class
LrrRs
{
/**
/**
*
Creates main() to run this example
.
*
The main method
.
*
*
* @param args the args
* @param args the arg
ument
s
* @throws IOException Signals that an I/O exception has occurred.
* @throws IOException Signals that an I/O exception has occurred.
*/
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"lrr_rs"
;
boolean
enableOutput
=
true
;
String
outputFolder
=
"output"
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
String
outputFolder
=
""
;
Log
.
printLine
(
"Starting "
+
experimentName
);
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"lrr"
;
// Local Regression Robust (LRR) VM allocation policy
try
{
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.2"
;
// the safety parameter of the LRR policy
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
new
RandomRunner
(
int
brokerId
=
broker
.
getId
();
enableOutput
,
outputToFile
,
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
inputFolder
,
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
outputFolder
,
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
workload
,
vmAllocationPolicy
,
PowerVmSelectionPolicy
vmSelectionPolicy
=
new
PowerVmSelectionPolicyRandomSelection
();
vmSelectionPolicy
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
parameter
);
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationLocalRegressionRobust
(
hostList
,
vmSelectionPolicy
,
RandomConstants
.
SCHEDULING_INTERVAL
,
new
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
vmSelectionPolicy
,
0.8
)),
-
1
);
datacenter
.
setDisableMigrations
(
false
);
broker
.
submitVmList
(
vmList
);
broker
.
submitCloudletList
(
cloudletList
);
double
lastClock
=
CloudSim
.
startSimulation
();
List
<
Cloudlet
>
newList
=
broker
.
getCloudletReceivedList
();
Log
.
printLine
(
"Received "
+
newList
.
size
()
+
" cloudlets"
);
CloudSim
.
stopSimulation
();
RandomHelper
.
printResults
(
datacenter
,
vmList
,
lastClock
,
experimentName
,
RandomConstants
.
OUTPUT_CSV
,
outputFolder
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"Unwanted errors happen"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
}
}
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMc.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class MadMc {
...
@@ -33,7 +33,7 @@ public class MadMc {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation
(MAD)
VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMmt.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class MadMmt {
...
@@ -33,7 +33,7 @@ public class MadMmt {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation
(MAD)
VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMu.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class MadMu {
...
@@ -33,7 +33,7 @@ public class MadMu {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation
(MAD)
VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadRs.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class MadRs {
...
@@ -33,7 +33,7 @@ public class MadRs {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation
(MAD)
VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class ThrMc {
...
@@ -33,7 +33,7 @@ public class ThrMc {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold
(THR)
VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class ThrMmt {
...
@@ -33,7 +33,7 @@ public class ThrMmt {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold
(THR)
VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class ThrMu {
...
@@ -33,7 +33,7 @@ public class ThrMu {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold
(THR)
VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
View file @
bc1fa0a6
...
@@ -33,7 +33,7 @@ public class ThrRs {
...
@@ -33,7 +33,7 @@ public class ThrRs {
String
inputFolder
=
""
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold
(THR)
VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment