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
09118073
Commit
09118073
authored
Dec 15, 2011
by
rodrigo.calheiros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issues solved: 2, 5, 9, 10, 19
Issue solution not tested: 8
parent
656e4f68
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
112 additions
and
40 deletions
+112
-40
CloudSimExample1.java
...java/org/cloudbus/cloudsim/examples/CloudSimExample1.java
+18
-0
DVFS.java
.../main/java/org/cloudbus/cloudsim/examples/power/DVFS.java
+8
-8
CloudletSchedulerSpaceShared.java
...a/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
+0
-1
Datacenter.java
...udsim/src/main/java/org/cloudbus/cloudsim/Datacenter.java
+2
-2
DatacenterBroker.java
...src/main/java/org/cloudbus/cloudsim/DatacenterBroker.java
+14
-16
DatacenterCharacteristics.java
...java/org/cloudbus/cloudsim/DatacenterCharacteristics.java
+2
-2
Vm.java
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/Vm.java
+6
-7
VmAllocationPolicySimple.java
.../java/org/cloudbus/cloudsim/VmAllocationPolicySimple.java
+6
-0
VmSchedulerSpaceShared.java
...in/java/org/cloudbus/cloudsim/VmSchedulerSpaceShared.java
+0
-1
VmSchedulerTimeShared.java
...ain/java/org/cloudbus/cloudsim/VmSchedulerTimeShared.java
+3
-1
CloudSim.java
...im/src/main/java/org/cloudbus/cloudsim/core/CloudSim.java
+39
-1
CloudSimTags.java
...rc/main/java/org/cloudbus/cloudsim/core/CloudSimTags.java
+12
-1
PeProvisionerSimple.java
...g/cloudbus/cloudsim/provisioners/PeProvisionerSimple.java
+2
-0
No files found.
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/CloudSimExample1.java
View file @
09118073
...
...
@@ -89,9 +89,15 @@ public class CloudSimExample1 {
// create VM
Vm
vm
=
new
Vm
(
vmid
,
brokerId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
new
CloudletSchedulerTimeShared
());
Vm
vm1
=
new
Vm
(
1
,
brokerId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
new
CloudletSchedulerTimeShared
());
Vm
vm2
=
new
Vm
(
2
,
brokerId
,
mips
,
pesNumber
,
ram
,
bw
,
size
,
vmm
,
new
CloudletSchedulerTimeShared
());
// add the VM to the vmList
vmlist
.
add
(
vm
);
vmlist
.
add
(
vm1
);
vmlist
.
add
(
vm2
);
// submit vm list to the broker
broker
.
submitVmList
(
vmlist
);
...
...
@@ -109,9 +115,21 @@ public class CloudSimExample1 {
cloudlet
.
setUserId
(
brokerId
);
cloudlet
.
setVmId
(
vmid
);
Cloudlet
cloudlet1
=
new
Cloudlet
(
1
,
length
,
pesNumber
,
fileSize
,
outputSize
,
utilizationModel
,
utilizationModel
,
utilizationModel
);
cloudlet1
.
setUserId
(
brokerId
);
cloudlet1
.
setVmId
(
1
);
Cloudlet
cloudlet2
=
new
Cloudlet
(
2
,
length
,
pesNumber
,
fileSize
,
outputSize
,
utilizationModel
,
utilizationModel
,
utilizationModel
);
cloudlet2
.
setUserId
(
brokerId
);
cloudlet2
.
setVmId
(
2
);
// add the cloudlet to the list
cloudletList
.
add
(
cloudlet
);
cloudletList
.
add
(
cloudlet1
);
cloudletList
.
add
(
cloudlet2
);
// submit cloudlet list to the broker
broker
.
submitCloudletList
(
cloudletList
);
...
...
modules/cloudsim-examples/src/main/java/org/cloudbus/cloudsim/examples/power/DVFS.java
View file @
09118073
...
...
@@ -18,6 +18,7 @@ import java.util.Map.Entry;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.CloudletSchedulerDynamicWorkload
;
import
org.cloudbus.cloudsim.CloudletSchedulerSpaceShared
;
import
org.cloudbus.cloudsim.DatacenterBroker
;
import
org.cloudbus.cloudsim.DatacenterCharacteristics
;
import
org.cloudbus.cloudsim.Log
;
...
...
@@ -48,9 +49,9 @@ public class DVFS {
/** The vm list. */
private
static
List
<
Vm
>
vmList
;
private
static
double
hostsNumber
=
10
;
private
static
double
vmsNumber
=
2
0
;
private
static
double
cloudletsNumber
=
2
0
;
private
static
double
hostsNumber
=
2
;
private
static
double
vmsNumber
=
1
0
;
private
static
double
cloudletsNumber
=
1
0
;
/**
* Creates main() to run this example.
...
...
@@ -109,7 +110,7 @@ public class DVFS {
int
totalTotalRequested
=
0
;
int
totalTotalAllocated
=
0
;
ArrayList
<
Double
>
sla
=
new
ArrayList
<
Double
>();
int
numberOfAllocations
=
0
;
/*
int numberOfAllocations = 0;
for (Entry<String, List<List<Double>>> entry : datacenter.getUnderAllocatedMips().entrySet()) {
List<List<Double>> underAllocatedMips = entry.getValue();
double totalRequested = 0;
...
...
@@ -127,7 +128,7 @@ public class DVFS {
}
totalTotalRequested += totalRequested;
totalTotalAllocated += totalAllocated;
}
}
*/
double
averageSla
=
0
;
if
(
sla
.
size
()
>
0
)
{
...
...
@@ -167,7 +168,7 @@ public class DVFS {
List
<
Cloudlet
>
list
=
new
ArrayList
<
Cloudlet
>();
long
length
=
150000
;
// 10 min on 250 MIPS
int
pesNumber
=
1
;
int
pesNumber
=
2
;
long
fileSize
=
300
;
long
outputSize
=
300
;
...
...
@@ -201,8 +202,7 @@ public class DVFS {
for
(
int
i
=
0
;
i
<
vmsNumber
;
i
++)
{
vms
.
add
(
new
Vm
(
i
,
brokerId
,
mips
[
i
%
mips
.
length
],
pesNumber
,
ram
,
bw
,
size
,
vmm
,
new
CloudletSchedulerDynamicWorkload
(
mips
[
i
%
mips
.
length
],
pesNumber
))
);
new
Vm
(
i
,
brokerId
,
mips
[
i
%
mips
.
length
],
pesNumber
,
ram
,
bw
,
size
,
vmm
,
new
CloudletSchedulerSpaceShared
()));
}
return
vms
;
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
View file @
09118073
...
...
@@ -376,7 +376,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
for
(
int
i
=
0
;
i
<
cloudlet
.
getPesNumber
();
i
++)
{
rcl
.
setMachineAndPeId
(
0
,
i
);
}
getCloudletExecList
().
add
(
rcl
);
usedPes
+=
cloudlet
.
getPesNumber
();
}
else
{
// no enough free PEs: go to the waiting queue
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/Datacenter.java
View file @
09118073
...
...
@@ -471,7 +471,7 @@ public class Datacenter extends SimEntity {
}
else
{
data
[
2
]
=
CloudSimTags
.
FALSE
;
}
send
Now
(
vm
.
getUserId
()
,
CloudSimTags
.
VM_CREATE_ACK
,
data
);
send
(
vm
.
getUserId
(),
0.1
,
CloudSimTags
.
VM_CREATE_ACK
,
data
);
}
if
(
result
)
{
...
...
@@ -909,7 +909,7 @@ public class Datacenter extends SimEntity {
* @post $none
*/
protected
void
updateCloudletProcessing
()
{
//Log.printLine(CloudSim.clock()+": PowerDatacenter #
"+this.get_id()+"
: updating cloudlet processing.......................................");
//Log.printLine(CloudSim.clock()+": PowerDatacenter #: updating cloudlet processing.......................................");
//if some time passed since last processing
if
(
CloudSim
.
clock
()
>
this
.
getLastProcessTime
()+
0.1
)
{
List
<?
extends
Host
>
list
=
getVmAllocationPolicy
().
getHostList
();
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/DatacenterBroker.java
View file @
09118073
...
...
@@ -33,46 +33,44 @@ import org.cloudbus.cloudsim.lists.VmList;
*/
public
class
DatacenterBroker
extends
SimEntity
{
// TODO: remove unnecessary variables
/** The vm list. */
pr
ivate
List
<?
extends
Vm
>
vmList
;
pr
otected
List
<?
extends
Vm
>
vmList
;
/** The vms created list. */
pr
ivate
List
<?
extends
Vm
>
vmsCreatedList
;
pr
otected
List
<?
extends
Vm
>
vmsCreatedList
;
/** The cloudlet list. */
pr
ivate
List
<?
extends
Cloudlet
>
cloudletList
;
pr
otected
List
<?
extends
Cloudlet
>
cloudletList
;
/** The cloudlet submitted list. */
pr
ivate
List
<?
extends
Cloudlet
>
cloudletSubmittedList
;
pr
otected
List
<?
extends
Cloudlet
>
cloudletSubmittedList
;
/** The cloudlet received list. */
pr
ivate
List
<?
extends
Cloudlet
>
cloudletReceivedList
;
pr
otected
List
<?
extends
Cloudlet
>
cloudletReceivedList
;
/** The cloudlets submitted. */
pr
ivate
int
cloudletsSubmitted
;
pr
otected
int
cloudletsSubmitted
;
/** The vms requested. */
pr
ivate
int
vmsRequested
;
pr
otected
int
vmsRequested
;
/** The vms acks. */
pr
ivate
int
vmsAcks
;
pr
otected
int
vmsAcks
;
/** The vms destroyed. */
pr
ivate
int
vmsDestroyed
;
pr
otected
int
vmsDestroyed
;
/** The datacenter ids list. */
pr
ivate
List
<
Integer
>
datacenterIdsList
;
pr
otected
List
<
Integer
>
datacenterIdsList
;
/** The datacenter requested ids list. */
pr
ivate
List
<
Integer
>
datacenterRequestedIdsList
;
pr
otected
List
<
Integer
>
datacenterRequestedIdsList
;
/** The vms to datacenters map. */
pr
ivate
Map
<
Integer
,
Integer
>
vmsToDatacentersMap
;
pr
otected
Map
<
Integer
,
Integer
>
vmsToDatacentersMap
;
/** The datacenter characteristics list. */
pr
ivate
Map
<
Integer
,
DatacenterCharacteristics
>
datacenterCharacteristicsList
;
pr
otected
Map
<
Integer
,
DatacenterCharacteristics
>
datacenterCharacteristicsList
;
/**
...
...
@@ -396,7 +394,7 @@ public class DatacenterBroker extends SimEntity {
* @pre $none
* @post $none
*/
pr
ivate
void
finishExecution
()
{
pr
otected
void
finishExecution
()
{
sendNow
(
getId
(),
CloudSimTags
.
END_OF_SIMULATION
);
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/DatacenterCharacteristics.java
View file @
09118073
...
...
@@ -452,7 +452,7 @@ public class DatacenterCharacteristics {
*
* @return the id
*/
p
rotected
int
getId
()
{
p
ublic
int
getId
()
{
return
id
;
}
...
...
@@ -545,7 +545,7 @@ public class DatacenterCharacteristics {
*
* @return the cost per second
*/
p
rotected
double
getCostPerSecond
()
{
p
ublic
double
getCostPerSecond
()
{
return
costPerSecond
;
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/Vm.java
View file @
09118073
...
...
@@ -151,11 +151,11 @@ public class Vm {
List
<
Double
>
currentRequestedMips
=
getCloudletScheduler
().
getCurrentRequestedMips
();
if
(
isRecentlyCreated
())
{
boolean
mipsIsNull
=
true
;
if
(
CloudSim
.
clock
()
>
0
)
{
mipsIsNull
=
false
;
//
boolean mipsIsNull = true;
//
if (CloudSim.clock() > 0) {
//
mipsIsNull = false;
setRecentlyCreated
(
false
);
}
//
}
// for (double mips : currentRequestedMips) {
// if (mips > 0.0) {
// mipsIsNull = false;
...
...
@@ -165,14 +165,13 @@ public class Vm {
// }
//if (mipsIsNull && isRecentlyCreated()) {
if
(
mipsIsNull
)
{
//
if (mipsIsNull) {
currentRequestedMips
=
new
ArrayList
<
Double
>();
for
(
int
i
=
0
;
i
<
getPesNumber
();
i
++)
{
currentRequestedMips
.
add
(
getMips
());
}
//}
}
}
return
currentRequestedMips
;
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/VmAllocationPolicySimple.java
View file @
09118073
...
...
@@ -232,6 +232,12 @@ public class VmAllocationPolicySimple extends VmAllocationPolicy {
public
boolean
allocateHostForVm
(
Vm
vm
,
Host
host
)
{
if
(
host
.
vmCreate
(
vm
))
{
//if vm has been succesfully created in the host
getVmTable
().
put
(
vm
.
getUid
(),
host
);
int
requiredPes
=
vm
.
getPesNumber
();
int
idx
=
getHostList
().
indexOf
(
host
);
getUsedPes
().
put
(
vm
.
getUid
(),
requiredPes
);
getFreePes
().
set
(
idx
,
getFreePes
().
get
(
idx
)
-
requiredPes
);
Log
.
formatLine
(
"%.2f: VM #"
+
vm
.
getId
()
+
" has been allocated to the host #"
+
host
.
getId
(),
CloudSim
.
clock
());
return
true
;
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/VmSchedulerSpaceShared.java
View file @
09118073
...
...
@@ -77,7 +77,6 @@ public class VmSchedulerSpaceShared extends VmScheduler {
getPeAllocationMap
().
put
(
vm
.
getUid
(),
selectedPes
);
getMipsMap
().
put
(
vm
.
getUid
(),
mipsShare
);
setAvailableMips
(
getAvailableMips
()
-
totalMips
);
return
true
;
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/VmSchedulerTimeShared.java
View file @
09118073
...
...
@@ -166,10 +166,12 @@ public class VmSchedulerTimeShared extends VmScheduler {
Pe
pe
=
peIterator
.
next
();
PeProvisioner
peProvisioner
=
pe
.
getPeProvisioner
();
double
availableMips
=
peProvisioner
.
getAvailableMips
();
for
(
Map
.
Entry
<
String
,
List
<
Double
>>
entry
:
getMipsMap
().
entrySet
())
{
String
vmUid
=
entry
.
getKey
();
getPeMap
().
put
(
vmUid
,
new
LinkedList
<
Pe
>());
for
(
double
mips
:
entry
.
getValue
())
{
System
.
out
.
println
(
"=> mips:"
+
mips
);
while
(
mips
>=
0.1
)
{
if
(
availableMips
>=
mips
)
{
peProvisioner
.
allocateMipsForVm
(
vmUid
,
mips
);
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/core/CloudSim.java
View file @
09118073
...
...
@@ -60,6 +60,9 @@ public class CloudSim {
/** The calendar. */
private
static
Calendar
calendar
=
null
;
/** The termination time. */
private
static
long
terminateAt
=
-
1
;
/**
* Initialises all the common attributes.
*
...
...
@@ -190,6 +193,34 @@ public class CloudSim {
}
}
/**
* This method is called if one wants to terminate the simulation.
*
* @return true, if successful; false otherwise.
*/
public
static
boolean
terminateSimulation
()
{
running
=
false
;
printMessage
(
"Simulation: Reached termination time."
);
return
true
;
}
/**
* This method is called if one wants to terminate the simulation at a
* given time.
*
* @param time the time at which the simulation has to be terminated
* @return true, if successful
* otherwise.
*/
public
static
boolean
terminateSimulation
(
long
time
)
{
if
(
time
<=
clock
)
{
return
false
;
}
else
{
terminateAt
=
time
;
}
return
true
;
}
/**
* Gets a new copy of initial simulation Calendar.
*
...
...
@@ -831,6 +862,13 @@ public class CloudSim {
break
;
}
//this block allows termination of simulation at a specific time
if
(
terminateAt
!=
-
1
&&
clock
>=
terminateAt
)
{
terminateSimulation
();
clock
=
terminateAt
;
break
;
}
if
(
pauseAt
!=
-
1
&&
((
future
.
size
()
>
0
&&
clock
<=
pauseAt
&&
pauseAt
<=
future
.
iterator
().
next
().
eventTime
())
||
future
.
size
()
==
0
&&
pauseAt
<=
clock
))
{
pauseSimulation
();
clock
=
pauseAt
;
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/core/CloudSimTags.java
View file @
09118073
...
...
@@ -20,7 +20,7 @@ package org.cloudbus.cloudsim.core;
* @author Anthony Sulistio
* @since CloudSim Toolkit 1.0
*/
public
final
class
CloudSimTags
{
public
class
CloudSimTags
{
// starting constant value for cloud-related tags
private
static
final
int
BASE
=
0
;
...
...
@@ -389,6 +389,17 @@ public final class CloudSimTags {
*/
public
static
final
int
VM_BROKER_EVENT
=
BASE
+
42
;
public
static
final
int
Network_Event_UP
=
BASE
+
43
;
public
static
final
int
Network_Event_send
=
BASE
+
44
;
public
static
final
int
RESOURCE_Register
=
BASE
+
45
;
public
static
final
int
Network_Event_DOWN
=
BASE
+
46
;
public
static
final
int
Network_Event_Host
=
BASE
+
47
;
public
static
final
int
NextCycle
=
BASE
+
48
;
// /////////////////////////////////////////////////////////////
// // NOTE: below are new tags needed for the resource failure functionality
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/provisioners/PeProvisionerSimple.java
View file @
09118073
...
...
@@ -68,6 +68,8 @@ public class PeProvisionerSimple extends PeProvisioner {
setAvailableMips
(
getAvailableMips
()
-
mips
);
getPeTable
().
put
(
vmUid
,
allocatedMips
);
System
.
out
.
print
(
"MIPS allocated for vm "
+
vmUid
+
" :"
);
for
(
double
m:
allocatedMips
)
System
.
out
.
print
(
" "
+
m
+
" "
);
System
.
out
.
println
();
return
true
;
}
...
...
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