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
2faca426
Commit
2faca426
authored
Sep 02, 2013
by
Nikolay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored the CloudletSchedulers, moved duplicate code to the superclass.
parent
03509e81
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
270 deletions
+127
-270
CloudletScheduler.java
...rc/main/java/org/cloudbus/cloudsim/CloudletScheduler.java
+127
-0
CloudletSchedulerSpaceShared.java
...a/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
+0
-100
CloudletSchedulerTimeShared.java
...va/org/cloudbus/cloudsim/CloudletSchedulerTimeShared.java
+0
-74
NetworkCloudletSpaceSharedScheduler.java
...twork/datacenter/NetworkCloudletSpaceSharedScheduler.java
+0
-96
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletScheduler.java
View file @
2faca426
...
...
@@ -8,8 +8,10 @@
package
org
.
cloudbus
.
cloudsim
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* CloudletScheduler is an abstract class that represents the policy of scheduling performed by a
* virtual machine. So, classes extending this must execute Cloudlets. Also, the interface for
...
...
@@ -27,6 +29,21 @@ public abstract class CloudletScheduler {
/** The current mips share. */
private
List
<
Double
>
currentMipsShare
;
/** The cloudlet waiting list. */
protected
List
<?
extends
ResCloudlet
>
cloudletWaitingList
;
/** The cloudlet exec list. */
protected
List
<?
extends
ResCloudlet
>
cloudletExecList
;
/** The cloudlet paused list. */
protected
List
<?
extends
ResCloudlet
>
cloudletPausedList
;
/** The cloudlet finished list. */
protected
List
<?
extends
ResCloudlet
>
cloudletFinishedList
;
/** The cloudlet failed list. */
protected
List
<?
extends
ResCloudlet
>
cloudletFailedList
;
/**
* Creates a new CloudletScheduler object. This method must be invoked before starting the
* actual simulation.
...
...
@@ -36,6 +53,11 @@ public abstract class CloudletScheduler {
*/
public
CloudletScheduler
()
{
setPreviousTime
(
0.0
);
cloudletWaitingList
=
new
ArrayList
<
ResCloudlet
>();
cloudletExecList
=
new
ArrayList
<
ResCloudlet
>();
cloudletPausedList
=
new
ArrayList
<
ResCloudlet
>();
cloudletFinishedList
=
new
ArrayList
<
ResCloudlet
>();
cloudletFailedList
=
new
ArrayList
<
ResCloudlet
>();
}
/**
...
...
@@ -248,4 +270,109 @@ public abstract class CloudletScheduler {
return
currentMipsShare
;
}
/**
* Gets the cloudlet waiting list.
*
* @param <T> the generic type
* @return the cloudlet waiting list
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletWaitingList
()
{
return
(
List
<
T
>)
cloudletWaitingList
;
}
/**
* Cloudlet waiting list.
*
* @param <T> the generic type
* @param cloudletWaitingList the cloudlet waiting list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletWaitingList
(
List
<
T
>
cloudletWaitingList
)
{
this
.
cloudletWaitingList
=
cloudletWaitingList
;
}
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletExecList
()
{
return
(
List
<
T
>)
cloudletExecList
;
}
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletExecList
(
List
<
T
>
cloudletExecList
)
{
this
.
cloudletExecList
=
cloudletExecList
;
}
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletPausedList
()
{
return
(
List
<
T
>)
cloudletPausedList
;
}
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletPausedList
(
List
<
T
>
cloudletPausedList
)
{
this
.
cloudletPausedList
=
cloudletPausedList
;
}
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletFinishedList
()
{
return
(
List
<
T
>)
cloudletFinishedList
;
}
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletFinishedList
(
List
<
T
>
cloudletFinishedList
)
{
this
.
cloudletFinishedList
=
cloudletFinishedList
;
}
/**
* Gets the cloudlet failed list.
*
* @param <T> the generic type
* @return the cloudlet failed list.
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletFailedList
()
{
return
(
List
<
T
>)
cloudletFailedList
;
}
/**
* Sets the cloudlet failed list.
*
* @param <T> the generic type
* @param cloudletFailedList the new cloudlet failed list.
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletFailedList
(
List
<
T
>
cloudletFailedList
)
{
this
.
cloudletFailedList
=
cloudletFailedList
;
}
}
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
View file @
2faca426
...
...
@@ -26,18 +26,6 @@ import org.cloudbus.cloudsim.core.CloudSim;
*/
public
class
CloudletSchedulerSpaceShared
extends
CloudletScheduler
{
/** The cloudlet waiting list. */
private
List
<?
extends
ResCloudlet
>
cloudletWaitingList
;
/** The cloudlet exec list. */
private
List
<?
extends
ResCloudlet
>
cloudletExecList
;
/** The cloudlet paused list. */
private
List
<?
extends
ResCloudlet
>
cloudletPausedList
;
/** The cloudlet finished list. */
private
List
<?
extends
ResCloudlet
>
cloudletFinishedList
;
/** The current CPUs. */
protected
int
currentCpus
;
...
...
@@ -53,10 +41,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
*/
public
CloudletSchedulerSpaceShared
()
{
super
();
cloudletWaitingList
=
new
ArrayList
<
ResCloudlet
>();
cloudletExecList
=
new
ArrayList
<
ResCloudlet
>();
cloudletPausedList
=
new
ArrayList
<
ResCloudlet
>();
cloudletFinishedList
=
new
ArrayList
<
ResCloudlet
>();
usedPes
=
0
;
currentCpus
=
0
;
}
...
...
@@ -509,90 +493,6 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
return
cl
;
}
/**
* Gets the cloudlet waiting list.
*
* @param <T> the generic type
* @return the cloudlet waiting list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletWaitingList
()
{
return
(
List
<
T
>)
cloudletWaitingList
;
}
/**
* Cloudlet waiting list.
*
* @param <T> the generic type
* @param cloudletWaitingList the cloudlet waiting list
*/
protected
<
T
extends
ResCloudlet
>
void
cloudletWaitingList
(
List
<
T
>
cloudletWaitingList
)
{
this
.
cloudletWaitingList
=
cloudletWaitingList
;
}
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletExecList
()
{
return
(
List
<
T
>)
cloudletExecList
;
}
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletExecList
(
List
<
T
>
cloudletExecList
)
{
this
.
cloudletExecList
=
cloudletExecList
;
}
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletPausedList
()
{
return
(
List
<
T
>)
cloudletPausedList
;
}
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletPausedList
(
List
<
T
>
cloudletPausedList
)
{
this
.
cloudletPausedList
=
cloudletPausedList
;
}
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletFinishedList
()
{
return
(
List
<
T
>)
cloudletFinishedList
;
}
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletFinishedList
(
List
<
T
>
cloudletFinishedList
)
{
this
.
cloudletFinishedList
=
cloudletFinishedList
;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getCurrentRequestedMips()
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerTimeShared.java
View file @
2faca426
...
...
@@ -22,15 +22,6 @@ import org.cloudbus.cloudsim.core.CloudSim;
*/
public
class
CloudletSchedulerTimeShared
extends
CloudletScheduler
{
/** The cloudlet exec list. */
private
List
<?
extends
ResCloudlet
>
cloudletExecList
;
/** The cloudlet paused list. */
private
List
<?
extends
ResCloudlet
>
cloudletPausedList
;
/** The cloudlet finished list. */
private
List
<?
extends
ResCloudlet
>
cloudletFinishedList
;
/** The current cp us. */
protected
int
currentCPUs
;
...
...
@@ -43,9 +34,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
*/
public
CloudletSchedulerTimeShared
()
{
super
();
cloudletExecList
=
new
ArrayList
<
ResCloudlet
>();
cloudletPausedList
=
new
ArrayList
<
ResCloudlet
>();
cloudletFinishedList
=
new
ArrayList
<
ResCloudlet
>();
currentCPUs
=
0
;
}
...
...
@@ -416,68 +404,6 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
return
rgl
.
getCloudlet
();
}
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletExecList
()
{
return
(
List
<
T
>)
cloudletExecList
;
}
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletExecList
(
List
<
T
>
cloudletExecList
)
{
this
.
cloudletExecList
=
cloudletExecList
;
}
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletPausedList
()
{
return
(
List
<
T
>)
cloudletPausedList
;
}
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletPausedList
(
List
<
T
>
cloudletPausedList
)
{
this
.
cloudletPausedList
=
cloudletPausedList
;
}
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletFinishedList
()
{
return
(
List
<
T
>)
cloudletFinishedList
;
}
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletFinishedList
(
List
<
T
>
cloudletFinishedList
)
{
this
.
cloudletFinishedList
=
cloudletFinishedList
;
}
/*
* (non-Javadoc)
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/network/datacenter/NetworkCloudletSpaceSharedScheduler.java
View file @
2faca426
...
...
@@ -33,18 +33,6 @@ import org.cloudbus.cloudsim.core.CloudSimTags;
*/
public
class
NetworkCloudletSpaceSharedScheduler
extends
CloudletScheduler
{
/** The cloudlet waiting list. */
private
List
<?
extends
ResCloudlet
>
cloudletWaitingList
;
/** The cloudlet exec list. */
private
List
<?
extends
ResCloudlet
>
cloudletExecList
;
/** The cloudlet paused list. */
private
List
<?
extends
ResCloudlet
>
cloudletPausedList
;
/** The cloudlet finished list. */
private
List
<?
extends
ResCloudlet
>
cloudletFinishedList
;
/** The current CPUs. */
protected
int
currentCpus
;
...
...
@@ -645,90 +633,6 @@ public class NetworkCloudletSpaceSharedScheduler extends CloudletScheduler {
return
cl
;
}
/**
* Gets the cloudlet waiting list.
*
* @param <T> the generic type
* @return the cloudlet waiting list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletWaitingList
()
{
return
(
List
<
T
>)
cloudletWaitingList
;
}
/**
* Cloudlet waiting list.
*
* @param <T> the generic type
* @param cloudletWaitingList the cloudlet waiting list
*/
protected
<
T
extends
ResCloudlet
>
void
cloudletWaitingList
(
List
<
T
>
cloudletWaitingList
)
{
this
.
cloudletWaitingList
=
cloudletWaitingList
;
}
/**
* Gets the cloudlet exec list.
*
* @param <T> the generic type
* @return the cloudlet exec list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletExecList
()
{
return
(
List
<
T
>)
cloudletExecList
;
}
/**
* Sets the cloudlet exec list.
*
* @param <T> the generic type
* @param cloudletExecList the new cloudlet exec list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletExecList
(
List
<
T
>
cloudletExecList
)
{
this
.
cloudletExecList
=
cloudletExecList
;
}
/**
* Gets the cloudlet paused list.
*
* @param <T> the generic type
* @return the cloudlet paused list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletPausedList
()
{
return
(
List
<
T
>)
cloudletPausedList
;
}
/**
* Sets the cloudlet paused list.
*
* @param <T> the generic type
* @param cloudletPausedList the new cloudlet paused list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletPausedList
(
List
<
T
>
cloudletPausedList
)
{
this
.
cloudletPausedList
=
cloudletPausedList
;
}
/**
* Gets the cloudlet finished list.
*
* @param <T> the generic type
* @return the cloudlet finished list
*/
@SuppressWarnings
(
"unchecked"
)
protected
<
T
extends
ResCloudlet
>
List
<
T
>
getCloudletFinishedList
()
{
return
(
List
<
T
>)
cloudletFinishedList
;
}
/**
* Sets the cloudlet finished list.
*
* @param <T> the generic type
* @param cloudletFinishedList the new cloudlet finished list
*/
protected
<
T
extends
ResCloudlet
>
void
setCloudletFinishedList
(
List
<
T
>
cloudletFinishedList
)
{
this
.
cloudletFinishedList
=
cloudletFinishedList
;
}
/*
* (non-Javadoc)
* @see org.cloudbus.cloudsim.CloudletScheduler#getCurrentRequestedMips()
...
...
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