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
dff82476
Commit
dff82476
authored
May 24, 2016
by
sarehfotuhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ContainerExamples
parent
5dd1dea0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
35 deletions
+28
-35
ContainerCloudSimExample1.java
...loudsim/examples/container/ContainerCloudSimExample1.java
+17
-27
PowerContainerDatacenterCM.java
...s/cloudsim/container/core/PowerContainerDatacenterCM.java
+11
-8
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/container/ContainerCloudSimExample1.java
View file @
dff82476
...
...
@@ -11,6 +11,10 @@ package org.cloudbus.cloudsim.examples.container;
*/
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Storage
;
import
org.cloudbus.cloudsim.UtilizationModelNull
;
import
org.cloudbus.cloudsim.container.containerProvisioners.ContainerBwProvisionerSimple
;
import
org.cloudbus.cloudsim.container.containerProvisioners.ContainerPe
;
import
org.cloudbus.cloudsim.container.containerProvisioners.ContainerRamProvisionerSimple
;
...
...
@@ -32,10 +36,9 @@ import org.cloudbus.cloudsim.container.schedulers.ContainerVmSchedulerTimeShared
import
org.cloudbus.cloudsim.container.utils.IDs
;
import
org.cloudbus.cloudsim.container.vmSelectionPolicies.PowerContainerVmSelectionPolicy
;
import
org.cloudbus.cloudsim.container.vmSelectionPolicies.PowerContainerVmSelectionPolicyMaximumUsage
;
import
org.cloudbus.cloudsim.*
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
java.io.
*
;
import
java.io.
FileNotFoundException
;
import
java.text.DecimalFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
...
...
@@ -132,9 +135,9 @@ public class ContainerCloudSimExample1 {
* 6- The host list is created considering the number of hosts, and host types which are specified
* in the {@link ConstantsExamples}.
*/
hostList
=
new
ArrayList
<>();
hostList
=
new
ArrayList
<
ContainerHost
>();
hostList
=
createHostList
(
ConstantsExamples
.
NUMBER_HOSTS
);
cloudletList
=
new
ArrayList
<>();
cloudletList
=
new
ArrayList
<
ContainerCloudlet
>();
vmList
=
new
ArrayList
<
ContainerVm
>();
/**
* 7- The container allocation policy which defines the allocation of VMs to containers.
...
...
@@ -163,7 +166,9 @@ public class ContainerCloudSimExample1 {
@SuppressWarnings
(
"unused"
)
PowerContainerDatacenter
e
=
(
PowerContainerDatacenter
)
createDatacenter
(
"datacenter"
,
PowerContainerDatacenterCM
.
class
,
hostList
,
vmAllocationPolicy
,
containerAllocationPolicy
,
getExperimentName
(
"ContainerCloudSimExample-1"
,
String
.
valueOf
(
overBookingFactor
)),
logAddress
);
getExperimentName
(
"ContainerCloudSimExample-1"
,
String
.
valueOf
(
overBookingFactor
)),
ConstantsExamples
.
SCHEDULING_INTERVAL
,
logAddress
,
ConstantsExamples
.
VM_STARTTUP_DELAY
,
ConstantsExamples
.
CONTAINER_STARTTUP_DELAY
);
/**
...
...
@@ -351,7 +356,8 @@ public class ContainerCloudSimExample1 {
List
<
ContainerHost
>
hostList
,
ContainerVmAllocationPolicy
vmAllocationPolicy
,
ContainerAllocationPolicy
containerAllocationPolicy
,
String
experimentName
,
String
logAddress
)
throws
Exception
{
String
experimentName
,
double
schedulingInterval
,
String
logAddress
,
double
VMStartupDelay
,
double
ContainerStartupDelay
)
throws
Exception
{
String
arch
=
"x86"
;
String
os
=
"Linux"
;
String
vmm
=
"Xen"
;
...
...
@@ -361,27 +367,11 @@ public class ContainerCloudSimExample1 {
double
costPerStorage
=
0.001
D
;
double
costPerBw
=
0.0
D
;
ContainerDatacenterCharacteristics
characteristics
=
new
ContainerDatacenterCharacteristics
(
arch
,
os
,
vmm
,
hostList
,
time_zone
,
cost
,
costPerMem
,
costPerStorage
,
costPerBw
);
ContainerDatacenter
datacenter
=
null
;
try
{
datacenter
=
datacenterClass
.
getConstructor
(
String
.
class
,
ContainerDatacenterCharacteristics
.
class
,
ContainerVmAllocationPolicy
.
class
,
ContainerAllocationPolicy
.
class
,
List
.
class
,
Double
.
TYPE
,
String
.
class
,
String
.
class
).
newInstance
(
name
,
characteristics
,
vmAllocationPolicy
,
containerAllocationPolicy
,
new
LinkedList
<
Storage
>(),
ConstantsExamples
.
SCHEDULING_INTERVAL
,
experimentName
,
logAddress
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
0
);
}
ContainerDatacenterCharacteristics
(
arch
,
os
,
vmm
,
hostList
,
time_zone
,
cost
,
costPerMem
,
costPerStorage
,
costPerBw
);
ContainerDatacenter
datacenter
=
new
PowerContainerDatacenterCM
(
name
,
characteristics
,
vmAllocationPolicy
,
containerAllocationPolicy
,
new
LinkedList
<
Storage
>(),
schedulingInterval
,
experimentName
,
logAddress
,
VMStartupDelay
,
ContainerStartupDelay
);
return
datacenter
;
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/container/core/PowerContainerDatacenterCM.java
View file @
dff82476
package
org
.
cloudbus
.
cloudsim
.
container
.
core
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Storage
;
import
org.cloudbus.cloudsim.container.resourceAllocators.ContainerAllocationPolicy
;
import
org.cloudbus.cloudsim.container.resourceAllocators.ContainerVmAllocationPolicy
;
import
org.cloudbus.cloudsim.container.utils.CostumeCSVWriter
;
import
org.cloudbus.cloudsim.Log
;
import
org.cloudbus.cloudsim.Storage
;
import
org.cloudbus.cloudsim.core.CloudSim
;
import
org.cloudbus.cloudsim.core.CloudSimTags
;
import
org.cloudbus.cloudsim.core.SimEvent
;
import
org.cloudbus.cloudsim.core.predicates.PredicateType
;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by sareh on 3/08/15.
...
...
@@ -25,15 +28,15 @@ public class PowerContainerDatacenterCM extends PowerContainerDatacenter {
private
CostumeCSVWriter
newlyCreatedVmWriter
;
private
int
newlyCreatedVms
;
private
List
<
Integer
>
newlyCreatedVmsList
;
private
int
vmStartupDelay
;
private
int
containerStartupDelay
;
private
double
vmStartupDelay
;
private
double
containerStartupDelay
;
public
PowerContainerDatacenterCM
(
String
name
,
ContainerDatacenterCharacteristics
characteristics
,
ContainerVmAllocationPolicy
vmAllocationPolicy
,
ContainerAllocationPolicy
containerAllocationPolicy
,
List
<
Storage
>
storageList
,
double
schedulingInterval
,
String
experimentName
,
String
logAddress
,
int
vmStartupDelay
,
int
containerStartupDelay
)
throws
Exception
{
double
vmStartupDelay
,
double
containerStartupDelay
)
throws
Exception
{
super
(
name
,
characteristics
,
vmAllocationPolicy
,
containerAllocationPolicy
,
storageList
,
schedulingInterval
,
experimentName
,
logAddress
);
String
newlyCreatedVmsAddress
;
int
index
=
getExperimentName
().
lastIndexOf
(
"_"
);
...
...
@@ -69,7 +72,7 @@ public class PowerContainerDatacenterCM extends PowerContainerDatacenter {
int
previousContainerMigrationCount
=
getContainerMigrationCount
();
int
previousVmMigrationCount
=
getVmMigrationCount
();
if
(
migrationMap
!=
null
)
{
List
<
ContainerVm
>
vmList
=
new
ArrayList
<>();
List
<
ContainerVm
>
vmList
=
new
ArrayList
<
ContainerVm
>();
for
(
Map
<
String
,
Object
>
migrate
:
migrationMap
)
{
if
(
migrate
.
containsKey
(
"container"
))
{
Container
container
=
(
Container
)
migrate
.
get
(
"container"
);
...
...
@@ -240,7 +243,7 @@ public class PowerContainerDatacenterCM extends PowerContainerDatacenter {
// containerVm.addMigratingInContainer((Container) map.get("container"));
ack
=
true
;
if
(
ack
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
Map
<
String
,
Object
>
data
=
new
HashMap
<
String
,
Object
>();
data
.
put
(
"vm"
,
containerVm
);
data
.
put
(
"result"
,
containerVm
);
data
.
put
(
"datacenterID"
,
getId
());
...
...
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