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
6645832b
Commit
6645832b
authored
Jan 05, 2012
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the examples of the static threshold policy with a random workload
parent
dbf5b821
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
288 additions
and
298 deletions
+288
-298
Constants.java
.../java/org/cloudbus/cloudsim/examples/power/Constants.java
+1
-1
Dvfs.java
...ava/org/cloudbus/cloudsim/examples/power/random/Dvfs.java
+13
-2
NonPowerAware.java
...loudbus/cloudsim/examples/power/random/NonPowerAware.java
+14
-1
ThrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
+65
-0
ThrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
+65
-0
ThrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
+65
-0
ThrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
+65
-0
ThresholdsMc.java
...cloudbus/cloudsim/examples/power/random/ThresholdsMc.java
+0
-75
ThresholdsMmt.java
...loudbus/cloudsim/examples/power/random/ThresholdsMmt.java
+0
-73
ThresholdsMu.java
...cloudbus/cloudsim/examples/power/random/ThresholdsMu.java
+0
-73
ThresholdsRs.java
...cloudbus/cloudsim/examples/power/random/ThresholdsRs.java
+0
-73
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Constants.java
View file @
6645832b
...
...
@@ -10,7 +10,7 @@ public class Constants {
public
final
static
boolean
OUTPUT_CSV
=
false
;
public
final
static
double
SCHEDULING_INTERVAL
=
300
;
public
final
static
double
SIMULATION_LIMIT
=
24
*
60
*
60
;
public
final
static
double
SIMULATION_LIMIT
=
24
*
60
;
public
final
static
int
CLOUDLET_LENGTH
=
2500
*
(
int
)
SIMULATION_LIMIT
;
public
final
static
int
CLOUDLET_PES
=
1
;
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/Dvfs.java
View file @
6645832b
...
...
@@ -7,6 +7,16 @@ import java.io.IOException;
* optimization of the VM allocation. The adjustment of the hosts' power consumption according to
* their CPU utilization is happening in the PowerDatacenter class.
*
* 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
*/
...
...
@@ -55,8 +65,8 @@ public class Dvfs extends RandomRunnerAbstract {
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"
"
;
String
vmAllocationPolicy
=
"dvfs"
;
String
workload
=
"
random"
;
// Random workload
String
vmAllocationPolicy
=
"dvfs"
;
// DVFS policy without VM migrations
String
vmSelectionPolicy
=
""
;
String
parameter
=
""
;
...
...
@@ -70,4 +80,5 @@ public class Dvfs extends RandomRunnerAbstract {
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/NonPowerAware.java
View file @
6645832b
...
...
@@ -18,6 +18,19 @@ import org.cloudbus.cloudsim.power.PowerVmAllocationPolicySimple;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*
* 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
NonPowerAware
{
...
...
@@ -28,7 +41,7 @@ public class NonPowerAware {
* @throws IOException
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"npa"
;
String
experimentName
=
"
random_
npa"
;
String
outputFolder
=
"output"
;
Log
.
setDisabled
(!
Constants
.
ENABLE_OUTPUT
);
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
0 → 100644
View file @
6645832b
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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
ThrMc
extends
RandomRunnerAbstract
{
public
ThrMc
(
boolean
enableOutput
,
boolean
outputToFile
,
String
inputFolder
,
String
outputFolder
,
String
workload
,
String
vmAllocationPolicy
,
String
vmSelectionPolicy
,
String
parameter
)
{
super
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"mmt"
;
// Maximum Correlation VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
0 → 100644
View file @
6645832b
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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
ThrMmt
extends
RandomRunnerAbstract
{
public
ThrMmt
(
boolean
enableOutput
,
boolean
outputToFile
,
String
inputFolder
,
String
outputFolder
,
String
workload
,
String
vmAllocationPolicy
,
String
vmSelectionPolicy
,
String
parameter
)
{
super
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
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
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
0 → 100644
View file @
6645832b
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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
ThrMu
extends
RandomRunnerAbstract
{
public
ThrMu
(
boolean
enableOutput
,
boolean
outputToFile
,
String
inputFolder
,
String
outputFolder
,
String
workload
,
String
vmAllocationPolicy
,
String
vmSelectionPolicy
,
String
parameter
)
{
super
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
0 → 100644
View file @
6645832b
package
org
.
cloudbus
.
cloudsim
.
examples
.
power
.
random
;
import
java.io.IOException
;
/**
* A simulation of a heterogeneous power aware data center that applies the Static Threshold (THR)
* 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
ThrRs
extends
RandomRunnerAbstract
{
public
ThrRs
(
boolean
enableOutput
,
boolean
outputToFile
,
String
inputFolder
,
String
outputFolder
,
String
workload
,
String
vmAllocationPolicy
,
String
vmSelectionPolicy
,
String
parameter
)
{
super
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThresholdsMc.java
deleted
100644 → 0
View file @
dbf5b821
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.PowerVmAllocationPolicyMigrationStaticThreshold
;
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.
*/
public
class
ThresholdsMc
{
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"thresh_mc_0.8"
;
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
PowerVmAllocationPolicyMigrationStaticThreshold
(
hostList
,
new
PowerVmSelectionPolicyMaximumCorrelation
(
new
PowerVmSelectionPolicyRandomSelection
()),
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/ThresholdsMmt.java
deleted
100644 → 0
View file @
dbf5b821
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.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumMigrationTime
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public
class
ThresholdsMmt
{
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"thresh_mmt_0.8"
;
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
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
new
PowerVmSelectionPolicyMinimumMigrationTime
(),
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/ThresholdsMu.java
deleted
100644 → 0
View file @
dbf5b821
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.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyMinimumUtilization
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public
class
ThresholdsMu
{
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"thresh_mu_0.8"
;
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
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
new
PowerVmSelectionPolicyMinimumUtilization
(),
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/ThresholdsRs.java
deleted
100644 → 0
View file @
dbf5b821
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.PowerVmAllocationPolicyMigrationThresholds
;
import
org.cloudbus.cloudsim.power.PowerVmSelectionPolicyRandomSelection
;
/**
* A simulation of a heterogeneous non-power aware data center: all hosts consume maximum power all
* the time.
*/
public
class
ThresholdsRs
{
/**
* Creates main() to run this example.
*
* @param args the args
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
experimentName
=
"thresh_rs_0.8"
;
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
PowerVmAllocationPolicyMigrationThresholds
(
hostList
,
new
PowerVmSelectionPolicyRandomSelection
(),
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
);
}
}
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