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
c73c1838
Commit
c73c1838
authored
Jan 05, 2012
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the VM utilization history saving
parent
6645832b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
76 additions
and
198 deletions
+76
-198
Constants.java
.../java/org/cloudbus/cloudsim/examples/power/Constants.java
+1
-1
Dvfs.java
...ava/org/cloudbus/cloudsim/examples/power/random/Dvfs.java
+2
-34
IqrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/IqrMc.java
+35
-59
RandomRunner.java
...cloudbus/cloudsim/examples/power/random/RandomRunner.java
+3
-3
ThrMc.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
+9
-23
ThrMmt.java
...a/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
+8
-22
ThrMu.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
+8
-22
ThrRs.java
...va/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
+8
-22
PowerVm.java
...im/src/main/java/org/cloudbus/cloudsim/power/PowerVm.java
+2
-12
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/Constants.java
View file @
c73c1838
...
...
@@ -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
;
public
final
static
double
SIMULATION_LIMIT
=
24
*
60
*
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 @
c73c1838
...
...
@@ -20,39 +20,7 @@ import java.io.IOException;
* @author Anton Beloglazov
* @since Jan 5, 2012
*/
public
class
Dvfs
extends
RandomRunnerAbstract
{
/**
* Instantiates a new dvfs.
*
* @param enableOutput the enable output
* @param outputToFile the output to file
* @param inputFolder the input folder
* @param outputFolder the output folder
* @param workload the workload
* @param vmAllocationPolicy the vm allocation policy
* @param vmSelectionPolicy the vm selection policy
* @param parameter the parameter
*/
public
Dvfs
(
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
class
Dvfs
{
/**
* The main method.
...
...
@@ -70,7 +38,7 @@ public class Dvfs extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
""
;
String
parameter
=
""
;
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/IqrMc.java
View file @
c73c1838
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.PowerVmAllocationPolicyMigrationInterQuartileRange
;
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 Inter Quartile Range
* (IQR) 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
IqrMc
{
/**
*
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
=
"iqr_ms_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
PowerVmAllocationPolicyMigrationInterQuartileRange
(
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
(
"The simulation has been terminated due to an unexpected error"
);
}
Log
.
printLine
(
"Finished "
+
experimentName
);
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
String
inputFolder
=
""
;
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
parameter
=
"1.5"
;
// the safety parameter of the IQR policy
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
outputFolder
,
workload
,
vmAllocationPolicy
,
vmSelectionPolicy
,
parameter
);
}
}
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/RandomRunner
Abstract
.java
→
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/RandomRunner.java
View file @
c73c1838
...
...
@@ -12,7 +12,7 @@ import org.cloudbus.cloudsim.examples.power.RunnerAbstract;
* @since Dec 17, 2011
*
*/
public
class
RandomRunner
Abstract
extends
RunnerAbstract
{
public
class
RandomRunner
extends
RunnerAbstract
{
/**
* @param enableOutput
...
...
@@ -24,7 +24,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
* @param vmSelectionPolicy
* @param parameter
*/
public
RandomRunner
Abstract
(
public
RandomRunner
(
boolean
enableOutput
,
boolean
outputToFile
,
String
inputFolder
,
...
...
@@ -62,7 +62,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
hostList
=
Helper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
printLine
(
"
Unwanted errors happen
"
);
Log
.
printLine
(
"
The simulation has been terminated due to an unexpected error
"
);
}
}
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMc.java
View file @
c73c1838
...
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @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
class
ThrMc
{
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
...
...
@@ -48,10 +34,10 @@ public class ThrMc extends RandomRunnerAbstract {
String
outputFolder
=
""
;
String
workload
=
"random"
;
// Random workload
String
vmAllocationPolicy
=
"thr"
;
// Static Threshold VM allocation policy
String
vmSelectionPolicy
=
"m
mt
"
;
// Maximum Correlation VM selection policy
String
vmSelectionPolicy
=
"m
c
"
;
// Maximum Correlation VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMmt.java
View file @
c73c1838
...
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @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
class
ThrMmt
{
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
...
...
@@ -51,7 +37,7 @@ public class ThrMmt extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrMu.java
View file @
c73c1838
...
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @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
class
ThrMu
{
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
...
...
@@ -51,7 +37,7 @@ public class ThrMu extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/random/ThrRs.java
View file @
c73c1838
...
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @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
class
ThrRs
{
/**
* The main method.
*
* @param args the arguments
* @throws IOException Signals that an I/O exception has occurred.
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
...
...
@@ -51,7 +37,7 @@ public class ThrRs extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
outputToFile
,
inputFolder
,
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerVm.java
View file @
c73c1838
...
...
@@ -19,7 +19,7 @@ public class PowerVm extends Vm {
public
static
final
int
HISTORY_LENGTH
=
30
;
/** The utilization history. */
private
List
<
Double
>
utilizationHistory
;
private
final
List
<
Double
>
utilizationHistory
=
new
LinkedList
<
Double
>()
;
/** The previous time. */
private
double
previousTime
;
...
...
@@ -55,7 +55,6 @@ public class PowerVm extends Vm {
CloudletScheduler
cloudletScheduler
,
double
schedulingInterval
)
{
super
(
id
,
userId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
cloudletScheduler
);
setUtilizationHistory
(
new
LinkedList
<
Double
>());
setSchedulingInterval
(
schedulingInterval
);
}
...
...
@@ -74,7 +73,7 @@ public class PowerVm extends Vm {
@Override
public
double
updateVmProcessing
(
double
currentTime
,
List
<
Double
>
mipsShare
)
{
double
time
=
super
.
updateVmProcessing
(
currentTime
,
mipsShare
);
if
(
currentTime
>
getPreviousTime
()
&&
currentTime
%
getSchedulingInterval
()
==
0
)
{
if
(
currentTime
>
getPreviousTime
()
&&
(
currentTime
-
0.1
)
%
getSchedulingInterval
()
==
0
)
{
double
utilization
=
getTotalUtilizationOfCpu
(
getCloudletScheduler
().
getPreviousTime
());
if
(
CloudSim
.
clock
()
!=
0
||
utilization
!=
0
)
{
addUtilizationHistoryValue
(
utilization
);
...
...
@@ -169,15 +168,6 @@ public class PowerVm extends Vm {
return
utilizationHistory
;
}
/**
* Sets the utilization history.
*
* @param utilizationHistory the new utilization history
*/
protected
void
setUtilizationHistory
(
List
<
Double
>
utilizationHistory
)
{
this
.
utilizationHistory
=
utilizationHistory
;
}
/**
* Gets the previous time.
*
...
...
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