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
7b66bab7
Commit
7b66bab7
authored
May 07, 2011
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Performance optimization
parent
c1b660b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
CloudSim.java
...im/src/main/java/org/cloudbus/cloudsim/core/CloudSim.java
+20
-1
PowerDatacenter.java
...ain/java/org/cloudbus/cloudsim/power/PowerDatacenter.java
+17
-2
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/core/CloudSim.java
View file @
7b66bab7
...
...
@@ -543,7 +543,7 @@ public class CloudSim {
SimEvent
e
=
new
SimEvent
(
SimEvent
.
SEND
,
clock
+
delay
,
src
,
dest
,
tag
,
data
);
future
.
addEvent
(
e
);
}
/**
* Used to send an event from one entity to another, with priority in the queue.
*
...
...
@@ -620,6 +620,25 @@ public class CloudSim {
return
ev
;
}
/**
* Find first deferred event matching a predicate.
*
* @param src the src
* @param p the p
* @return the sim event
*/
public
static
SimEvent
findFirstDeferred
(
int
src
,
Predicate
p
)
{
SimEvent
ev
=
null
;
Iterator
<
SimEvent
>
iterator
=
deferred
.
iterator
();
while
(
iterator
.
hasNext
())
{
ev
=
iterator
.
next
();
if
(
ev
.
getDestination
()
==
src
&&
p
.
match
(
ev
))
{
break
;
}
}
return
ev
;
}
/**
* Removes an event from the event queue.
*
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerDatacenter.java
View file @
7b66bab7
...
...
@@ -87,7 +87,7 @@ public class PowerDatacenter extends Datacenter {
// if some time passed since last processing
if
(
currentTime
>
getLastProcessTime
())
{
double
minTime
=
updateCloudetProcessingWithoutSchedulingFutureEvents
();
double
minTime
=
updateCloudetProcessingWithoutSchedulingFutureEvents
Force
();
if
(!
isDisableMigrations
())
{
List
<
Map
<
String
,
Object
>>
migrationMap
=
getVmAllocationPolicy
().
optimizeAllocation
(
getVmList
());
...
...
@@ -131,6 +131,18 @@ public class PowerDatacenter extends Datacenter {
* @return the double
*/
protected
double
updateCloudetProcessingWithoutSchedulingFutureEvents
()
{
if
(
CloudSim
.
clock
()
>
getLastProcessTime
())
{
return
updateCloudetProcessingWithoutSchedulingFutureEventsForce
();
}
return
0
;
}
/**
* Update cloudet processing without scheduling future events.
*
* @return the double
*/
protected
double
updateCloudetProcessingWithoutSchedulingFutureEventsForce
()
{
double
currentTime
=
CloudSim
.
clock
();
double
minTime
=
Double
.
MAX_VALUE
;
double
timeDiff
=
currentTime
-
getLastProcessTime
();
...
...
@@ -191,7 +203,10 @@ public class PowerDatacenter extends Datacenter {
protected
void
processVmMigrate
(
SimEvent
ev
,
boolean
ack
)
{
updateCloudetProcessingWithoutSchedulingFutureEvents
();
super
.
processVmMigrate
(
ev
,
ack
);
updateCloudetProcessingWithoutSchedulingFutureEvents
();
SimEvent
event
=
CloudSim
.
findFirstDeferred
(
getId
(),
new
PredicateType
(
CloudSimTags
.
VM_MIGRATE
));
if
(
event
==
null
||
event
.
eventTime
()
>
CloudSim
.
clock
())
{
updateCloudetProcessingWithoutSchedulingFutureEventsForce
();
}
}
/* (non-Javadoc)
...
...
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