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
8a508691
Commit
8a508691
authored
Jan 05, 2012
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the examples of the MAD policy with a random workload
parent
350e61ea
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
149 additions
and
397 deletions
+149
-397
RunnerAbstract.java
.../org/cloudbus/cloudsim/examples/power/RunnerAbstract.java
+1
-12
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
MadMc.java
...va/org/cloudbus/cloudsim/examples/power/random/MadMc.java
+35
-60
MadMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/MadMmt.java
+35
-58
MadMu.java
...va/org/cloudbus/cloudsim/examples/power/random/MadMu.java
+35
-58
MadRs.java
...va/org/cloudbus/cloudsim/examples/power/random/MadRs.java
+35
-58
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
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2.java
...rVmAllocationPolicyMigrationMedianAbsoluteDeviation2.java
+0
-143
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/RunnerAbstract.java
View file @
8a508691
...
...
@@ -14,14 +14,13 @@ import org.cloudbus.cloudsim.VmAllocationPolicy;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.power.PowerDatacenter
;
import
org.cloudbus.cloudsim.power.PowerHost
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationAbstract
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationInterQuartileRange
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegression
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationLocalRegressionRobust
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicyMigrationStaticThreshold
;
import
org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMaximumCorrelation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
...
...
@@ -246,16 +245,6 @@ public abstract class RunnerAbstract {
vmSelectionPolicy
,
parameter
,
fallbackVmSelectionPolicy
);
}
else
if
(
vmAllocationPolicyName
.
equals
(
"mad2"
))
{
PowerVmAllocationPolicyMigrationAbstract
fallbackVmSelectionPolicy
=
new
PowerVmAllocationPolicyMigrationStaticThreshold
(
hostList
,
vmSelectionPolicy
,
0.7
);
vmAllocationPolicy
=
new
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2
(
hostList
,
vmSelectionPolicy
,
parameter
,
fallbackVmSelectionPolicy
);
}
else
if
(
vmAllocationPolicyName
.
equals
(
"lr"
))
{
PowerVmAllocationPolicyMigrationAbstract
fallbackVmSelectionPolicy
=
new
PowerVmAllocationPolicyMigrationStaticThreshold
(
hostList
,
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMc.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class IqrMc {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation VM selection policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation
(MC)
VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMmt.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class IqrMmt {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time
(MMT)
VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMu.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class IqrMu {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization
(MU)
VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrRs.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class IqrRs {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"iqr"
;
// Inter Quartile Range VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection
(RS)
VM selection policy
String
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMc.java
View file @
8a508691
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
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.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
;
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
* the time.
* A simulation of a heterogeneous power aware data center that applies the Median Absolute
* Deviation (MAD) 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
MadMc
{
/**
*
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.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"mad_mc_1"
;
String
outputFolder
=
"output"
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
Log
.
printLine
(
"Starting "
+
experimentName
);
try
{
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
int
brokerId
=
broker
.
getId
();
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
(
hostList
,
new
PowerVmSelectionPolicyMaximumCorrelation
(
new
PowerVmSelectionPolicyRandomSelection
()),
1
),
-
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
);
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation (MC) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMmt.java
View file @
8a508691
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
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.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
* A simulation of a heterogeneous power aware data center that applies the Median Absolute
* Deviation (MAD) 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
MadMmt
{
/**
*
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.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"mad_mmt_1"
;
String
outputFolder
=
"output"
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
Log
.
printLine
(
"Starting "
+
experimentName
);
try
{
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
int
brokerId
=
broker
.
getId
();
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
(
hostList
,
new
PowerVmSelectionPolicyMinimumMigrationTime
(),
1
),
-
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
);
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time (MMT) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadMu.java
View file @
8a508691
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
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.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
* A simulation of a heterogeneous power aware data center that applies the Median Absolute
* Deviation (MAD) 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
MadMu
{
/**
*
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.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"mad_mu_1"
;
String
outputFolder
=
"output"
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
Log
.
printLine
(
"Starting "
+
experimentName
);
try
{
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
int
brokerId
=
broker
.
getId
();
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
(
hostList
,
new
PowerVmSelectionPolicyMinimumUtilization
(),
1
),
-
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
);
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization (MU) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/MadRs.java
View file @
8a508691
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
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.PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
* A simulation of a heterogeneous power aware data center that applies the Median Absolute
* Deviation (MAD) 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
MadRs
{
/**
*
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.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"mad_rs_1"
;
String
outputFolder
=
"output"
;
Log
.
setDisabled
(!
RandomConstants
.
ENABLE_OUTPUT
);
Log
.
printLine
(
"Starting "
+
experimentName
);
try
{
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
DatacenterBroker
broker
=
RandomHelper
.
createBroker
();
int
brokerId
=
broker
.
getId
();
List
<
Cloudlet
>
cloudletList
=
RandomHelper
.
createCloudletList
(
brokerId
,
RandomConstants
.
NUMBER_OF_VMS
);
List
<
Vm
>
vmList
=
RandomHelper
.
createVmList
(
brokerId
,
cloudletList
.
size
());
List
<
PowerHost
>
hostList
=
RandomHelper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation
(
hostList
,
new
PowerVmSelectionPolicyRandomSelection
(),
1
),
-
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
);
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"mad"
;
// Median Absolute Deviation VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection (RS) VM selection policy
String
parameter
=
"2.5"
;
// the safety parameter of the MAD policy
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class ThrMc {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation VM selection policy
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation
(MC)
VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class ThrMmt {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time
(MMT)
VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class ThrMu {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization
(MU)
VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
RandomRunner
(
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
View file @
8a508691
...
...
@@ -34,7 +34,7 @@ public class ThrRs {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection
(RS)
VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
RandomRunner
(
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2.java
deleted
100644 → 0
View file @
350e61ea
package
org
.
cloudbus
.
cloudsim
.
power
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.cloudbus.cloudsim.Host
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Vm
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.util.MathUtil
;
/**
* The Class PowerVmAllocationPolicyMigrationMad.
*/
public
class
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2
extends
PowerVmAllocationPolicyMigrationAbstract
{
/** The safety parameter. */
private
double
safetyParameter
=
0
;
/** The fallback vm allocation policy. */
private
PowerVmAllocationPolicyMigrationAbstract
fallbackVmAllocationPolicy
;
/**
* Instantiates a new power vm allocation policy migration mad.
*
* @param hostList the host list
* @param vmSelectionPolicy the vm selection policy
* @param safetyParameter the safety parameter
* @param utilizationThreshold the utilization threshold
*/
public
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2
(
List
<?
extends
Host
>
hostList
,
PowerVmSelectionPolicy
vmSelectionPolicy
,
double
safetyParameter
,
PowerVmAllocationPolicyMigrationAbstract
fallbackVmAllocationPolicy
,
double
utilizationThreshold
)
{
super
(
hostList
,
vmSelectionPolicy
);
setSafetyParameter
(
safetyParameter
);
setFallbackVmAllocationPolicy
(
fallbackVmAllocationPolicy
);
}
/**
* Instantiates a new power vm allocation policy migration mad.
*
* @param hostList the host list
* @param vmSelectionPolicy the vm selection policy
* @param safetyParameter the safety parameter
*/
public
PowerVmAllocationPolicyMigrationMedianAbsoluteDeviation2
(
List
<?
extends
Host
>
hostList
,
PowerVmSelectionPolicy
vmSelectionPolicy
,
double
safetyParameter
,
PowerVmAllocationPolicyMigrationAbstract
fallbackVmAllocationPolicy
)
{
super
(
hostList
,
vmSelectionPolicy
);
setSafetyParameter
(
safetyParameter
);
setFallbackVmAllocationPolicy
(
fallbackVmAllocationPolicy
);
}
/**
* Checks if is host over utilized.
*
* @param _host the _host
* @return true, if is host over utilized
*/
@Override
protected
boolean
isHostOverUtilized
(
PowerHost
host
)
{
PowerHostUtilizationHistory
_host
=
(
PowerHostUtilizationHistory
)
host
;
if
(
CloudSim
.
clock
()
==
5400
&&
host
.
getId
()
==
81
)
{
Log
.
printLine
();
}
double
upperThreshold
=
0
;
try
{
upperThreshold
=
getSafetyParameter
()
-
getHostUtilizationMad
(
_host
);
}
catch
(
IllegalArgumentException
e
)
{
return
getFallbackVmAllocationPolicy
().
isHostOverUtilized
(
host
);
}
addHistoryEntry
(
host
,
upperThreshold
);
double
totalRequestedMips
=
0
;
for
(
Vm
vm
:
host
.
getVmList
())
{
totalRequestedMips
+=
vm
.
getCurrentRequestedTotalMips
();
}
double
utilization
=
totalRequestedMips
/
host
.
getTotalMips
();
return
utilization
>
upperThreshold
;
}
/**
* Gets the host utilization mad.
*
* @param host the host
* @return the host utilization mad
*/
protected
double
getHostUtilizationMad
(
PowerHostUtilizationHistory
host
)
throws
IllegalArgumentException
{
double
[]
data
=
host
.
getUtilizationHistory
();
if
(
MathUtil
.
countNonZeroBeginning
(
data
)
>=
12
)
{
// 12 has been suggested as a safe value
return
MathUtil
.
mad
(
Arrays
.
copyOfRange
(
data
,
0
,
12
));
}
throw
new
IllegalArgumentException
();
}
/**
* Sets the safety parameter.
*
* @param safetyParameter the new safety parameter
*/
protected
void
setSafetyParameter
(
double
safetyParameter
)
{
if
(
safetyParameter
<
0
)
{
Log
.
printLine
(
"The safety parameter cannot be less than zero. The passed value is: "
+
safetyParameter
);
System
.
exit
(
0
);
}
this
.
safetyParameter
=
safetyParameter
;
}
/**
* Gets the safety parameter.
*
* @return the safety parameter
*/
protected
double
getSafetyParameter
()
{
return
safetyParameter
;
}
/**
* Sets the fallback vm allocation policy.
*
* @param fallbackVmAllocationPolicy the new fallback vm allocation policy
*/
public
void
setFallbackVmAllocationPolicy
(
PowerVmAllocationPolicyMigrationAbstract
fallbackVmAllocationPolicy
)
{
this
.
fallbackVmAllocationPolicy
=
fallbackVmAllocationPolicy
;
}
/**
* Gets the fallback vm allocation policy.
*
* @return the fallback vm allocation policy
*/
public
PowerVmAllocationPolicyMigrationAbstract
getFallbackVmAllocationPolicy
()
{
return
fallbackVmAllocationPolicy
;
}
}
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