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 {
...
@@ -10,7 +10,7 @@ public class Constants {
public
final
static
boolean
OUTPUT_CSV
=
false
;
public
final
static
boolean
OUTPUT_CSV
=
false
;
public
final
static
double
SCHEDULING_INTERVAL
=
300
;
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_LENGTH
=
2500
*
(
int
)
SIMULATION_LIMIT
;
public
final
static
int
CLOUDLET_PES
=
1
;
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;
...
@@ -20,39 +20,7 @@ import java.io.IOException;
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
Dvfs
extends
RandomRunnerAbstract
{
public
class
Dvfs
{
/**
* 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
);
}
/**
/**
* The main method.
* The main method.
...
@@ -70,7 +38,7 @@ public class Dvfs extends RandomRunnerAbstract {
...
@@ -70,7 +38,7 @@ public class Dvfs extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
""
;
String
vmSelectionPolicy
=
""
;
String
parameter
=
""
;
String
parameter
=
""
;
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
enableOutput
,
outputToFile
,
outputToFile
,
inputFolder
,
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
;
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.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
* A simulation of a heterogeneous power aware data center that applies the Inter Quartile Range
* the time.
* (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
{
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.
* @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
=
"iqr_ms_1"
;
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
=
"iqr"
;
// Inter Quartile Range VM allocation policy
try
{
String
vmSelectionPolicy
=
"mc"
;
// Maximum Correlation VM selection policy
CloudSim
.
init
(
1
,
Calendar
.
getInstance
(),
false
);
String
parameter
=
"1.5"
;
// the safety parameter of the IQR 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
,
PowerDatacenter
datacenter
=
(
PowerDatacenter
)
RandomHelper
.
createDatacenter
(
"Datacenter"
,
vmSelectionPolicy
,
PowerDatacenter
.
class
,
hostList
,
new
PowerVmAllocationPolicyMigrationInterQuartileRange
(
parameter
);
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
);
}
}
}
}
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;
...
@@ -12,7 +12,7 @@ import org.cloudbus.cloudsim.examples.power.RunnerAbstract;
* @since Dec 17, 2011
* @since Dec 17, 2011
*
*
*/
*/
public
class
RandomRunner
Abstract
extends
RunnerAbstract
{
public
class
RandomRunner
extends
RunnerAbstract
{
/**
/**
* @param enableOutput
* @param enableOutput
...
@@ -24,7 +24,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
...
@@ -24,7 +24,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
* @param vmSelectionPolicy
* @param vmSelectionPolicy
* @param parameter
* @param parameter
*/
*/
public
RandomRunner
Abstract
(
public
RandomRunner
(
boolean
enableOutput
,
boolean
enableOutput
,
boolean
outputToFile
,
boolean
outputToFile
,
String
inputFolder
,
String
inputFolder
,
...
@@ -62,7 +62,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
...
@@ -62,7 +62,7 @@ public class RandomRunnerAbstract extends RunnerAbstract {
hostList
=
Helper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
hostList
=
Helper
.
createHostList
(
RandomConstants
.
NUMBER_OF_HOSTS
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
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;
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
ThrMc
extends
RandomRunnerAbstract
{
public
class
ThrMc
{
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
);
}
/**
* 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
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
boolean
outputToFile
=
false
;
...
@@ -48,10 +34,10 @@ public class ThrMc extends RandomRunnerAbstract {
...
@@ -48,10 +34,10 @@ public class ThrMc extends RandomRunnerAbstract {
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 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
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
enableOutput
,
outputToFile
,
outputToFile
,
inputFolder
,
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;
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
ThrMmt
extends
RandomRunnerAbstract
{
public
class
ThrMmt
{
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
);
}
/**
* 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
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
boolean
outputToFile
=
false
;
...
@@ -51,7 +37,7 @@ public class ThrMmt extends RandomRunnerAbstract {
...
@@ -51,7 +37,7 @@ public class ThrMmt extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
String
vmSelectionPolicy
=
"mmt"
;
// Minimum Migration Time VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
enableOutput
,
outputToFile
,
outputToFile
,
inputFolder
,
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;
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
ThrMu
extends
RandomRunnerAbstract
{
public
class
ThrMu
{
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
);
}
/**
* 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
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
boolean
outputToFile
=
false
;
...
@@ -51,7 +37,7 @@ public class ThrMu extends RandomRunnerAbstract {
...
@@ -51,7 +37,7 @@ public class ThrMu extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
vmSelectionPolicy
=
"mu"
;
// Minimum Utilization VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
enableOutput
,
outputToFile
,
outputToFile
,
inputFolder
,
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;
...
@@ -19,28 +19,14 @@ import java.io.IOException;
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since Jan 5, 2012
* @since Jan 5, 2012
*/
*/
public
class
ThrRs
extends
RandomRunnerAbstract
{
public
class
ThrRs
{
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
);
}
/**
* 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
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
boolean
enableOutput
=
true
;
boolean
enableOutput
=
true
;
boolean
outputToFile
=
false
;
boolean
outputToFile
=
false
;
...
@@ -51,7 +37,7 @@ public class ThrRs extends RandomRunnerAbstract {
...
@@ -51,7 +37,7 @@ public class ThrRs extends RandomRunnerAbstract {
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
vmSelectionPolicy
=
"rs"
;
// Random Selection VM selection policy
String
parameter
=
"0.8"
;
// the static utilization threshold
String
parameter
=
"0.8"
;
// the static utilization threshold
new
Dvfs
(
new
RandomRunner
(
enableOutput
,
enableOutput
,
outputToFile
,
outputToFile
,
inputFolder
,
inputFolder
,
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerVm.java
View file @
c73c1838
...
@@ -19,7 +19,7 @@ public class PowerVm extends Vm {
...
@@ -19,7 +19,7 @@ public class PowerVm extends Vm {
public
static
final
int
HISTORY_LENGTH
=
30
;
public
static
final
int
HISTORY_LENGTH
=
30
;
/** The utilization history. */
/** The utilization history. */
private
List
<
Double
>
utilizationHistory
;
private
final
List
<
Double
>
utilizationHistory
=
new
LinkedList
<
Double
>()
;
/** The previous time. */
/** The previous time. */
private
double
previousTime
;
private
double
previousTime
;
...
@@ -55,7 +55,6 @@ public class PowerVm extends Vm {
...
@@ -55,7 +55,6 @@ public class PowerVm extends Vm {
CloudletScheduler
cloudletScheduler
,
CloudletScheduler
cloudletScheduler
,
double
schedulingInterval
)
{
double
schedulingInterval
)
{
super
(
id
,
userId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
cloudletScheduler
);
super
(
id
,
userId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
cloudletScheduler
);
setUtilizationHistory
(
new
LinkedList
<
Double
>());
setSchedulingInterval
(
schedulingInterval
);
setSchedulingInterval
(
schedulingInterval
);
}
}
...
@@ -74,7 +73,7 @@ public class PowerVm extends Vm {
...
@@ -74,7 +73,7 @@ public class PowerVm extends Vm {
@Override
@Override
public
double
updateVmProcessing
(
double
currentTime
,
List
<
Double
>
mipsShare
)
{
public
double
updateVmProcessing
(
double
currentTime
,
List
<
Double
>
mipsShare
)
{
double
time
=
super
.
updateVmProcessing
(
currentTime
,
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
());
double
utilization
=
getTotalUtilizationOfCpu
(
getCloudletScheduler
().
getPreviousTime
());
if
(
CloudSim
.
clock
()
!=
0
||
utilization
!=
0
)
{
if
(
CloudSim
.
clock
()
!=
0
||
utilization
!=
0
)
{
addUtilizationHistoryValue
(
utilization
);
addUtilizationHistoryValue
(
utilization
);
...
@@ -169,15 +168,6 @@ public class PowerVm extends Vm {
...
@@ -169,15 +168,6 @@ public class PowerVm extends Vm {
return
utilizationHistory
;
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.
* 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