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
b2023e0d
Commit
b2023e0d
authored
Oct 19, 2012
by
Nikolay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started put hardcoded constants in a dedicated Const class.
parent
0222c63c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
45 additions
and
12 deletions
+45
-12
CloudletSchedulerDynamicWorkload.java
...g/cloudbus/cloudsim/CloudletSchedulerDynamicWorkload.java
+1
-1
CloudletSchedulerSpaceShared.java
...a/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
+1
-1
CloudletSchedulerTimeShared.java
...va/org/cloudbus/cloudsim/CloudletSchedulerTimeShared.java
+1
-1
FileAttribute.java
...im/src/main/java/org/cloudbus/cloudsim/FileAttribute.java
+1
-1
ResCloudlet.java
...dsim/src/main/java/org/cloudbus/cloudsim/ResCloudlet.java
+5
-5
CloudletList.java
...c/main/java/org/cloudbus/cloudsim/lists/CloudletList.java
+17
-0
ResCloudletList.java
...ain/java/org/cloudbus/cloudsim/lists/ResCloudletList.java
+16
-0
HostDynamicWorkloadTest.java
...t/java/org/cloudbus/cloudsim/HostDynamicWorkloadTest.java
+1
-1
HostTest.java
...loudsim/src/test/java/org/cloudbus/cloudsim/HostTest.java
+1
-1
TimeSharedProblemDetector.java
...java/org/cloudbus/cloudsim/TimeSharedProblemDetector.java
+1
-1
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerDynamicWorkload.java
View file @
b2023e0d
...
...
@@ -74,7 +74,7 @@ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShare
for
(
ResCloudlet
rcl
:
getCloudletExecList
())
{
rcl
.
updateCloudletFinishedSoFar
((
long
)
(
timeSpan
*
getTotalCurrentAllocatedMipsForCloudlet
(
rcl
,
getPreviousTime
())
*
1000000
));
*
getTotalCurrentAllocatedMipsForCloudlet
(
rcl
,
getPreviousTime
())
*
Consts
.
MILLION
));
if
(
rcl
.
getRemainingCloudletLength
()
==
0
)
{
// finished: remove from the list
cloudletsToFinish
.
add
(
rcl
);
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerSpaceShared.java
View file @
b2023e0d
...
...
@@ -89,7 +89,7 @@ public class CloudletSchedulerSpaceShared extends CloudletScheduler {
// each machine in the exec list has the same amount of cpu
for
(
ResCloudlet
rcl
:
getCloudletExecList
())
{
rcl
.
updateCloudletFinishedSoFar
((
long
)
(
capacity
*
timeSpam
*
rcl
.
getNumberOfPes
()
*
1000000
));
rcl
.
updateCloudletFinishedSoFar
((
long
)
(
capacity
*
timeSpam
*
rcl
.
getNumberOfPes
()
*
Consts
.
MILLION
));
}
// no more cloudlets in this scheduler
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/CloudletSchedulerTimeShared.java
View file @
b2023e0d
...
...
@@ -65,7 +65,7 @@ public class CloudletSchedulerTimeShared extends CloudletScheduler {
double
timeSpam
=
currentTime
-
getPreviousTime
();
for
(
ResCloudlet
rcl
:
getCloudletExecList
())
{
rcl
.
updateCloudletFinishedSoFar
((
long
)
(
getCapacity
(
mipsShare
)
*
timeSpam
*
rcl
.
getNumberOfPes
()
*
1000000
));
rcl
.
updateCloudletFinishedSoFar
((
long
)
(
getCapacity
(
mipsShare
)
*
timeSpam
*
rcl
.
getNumberOfPes
()
*
Consts
.
MILLION
));
}
if
(
getCloudletExecList
().
size
()
==
0
)
{
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/FileAttribute.java
View file @
b2023e0d
...
...
@@ -237,7 +237,7 @@ public class FileAttribute {
* @return the file size (in bytes)
*/
public
int
getFileSizeInByte
()
{
return
size
*
1000000
;
// 1e6
return
size
*
Consts
.
MILLION
;
// 1e6
// return size * 1048576; // 1e6 - more accurate
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/ResCloudlet.java
View file @
b2023e0d
...
...
@@ -216,7 +216,7 @@ public class ResCloudlet {
// In case a Cloudlet has been executed partially by some other grid
// hostList.
cloudletFinishedSoFar
=
cloudlet
.
getCloudletFinishedSoFar
()
*
1000000
;
cloudletFinishedSoFar
=
cloudlet
.
getCloudletFinishedSoFar
()
*
Consts
.
MILLION
;
}
/**
...
...
@@ -430,14 +430,14 @@ public class ResCloudlet {
* @post $result >= 0
*/
public
long
getRemainingCloudletLength
()
{
long
length
=
cloudlet
.
getCloudletTotalLength
()
*
1000000
-
cloudletFinishedSoFar
;
long
length
=
cloudlet
.
getCloudletTotalLength
()
*
Consts
.
MILLION
-
cloudletFinishedSoFar
;
// Remaining Cloudlet length can't be negative number.
if
(
length
<
0
)
{
return
0
;
}
return
(
long
)
Math
.
floor
(
length
/
1000000
);
return
(
long
)
Math
.
floor
(
length
/
Consts
.
MILLION
);
}
/**
...
...
@@ -459,11 +459,11 @@ public class ResCloudlet {
cloudlet
.
setExecParam
(
wallClockTime
,
totalCompletionTime
);
long
finished
=
0
;
//if (cloudlet.getCloudletTotalLength() *
1000000
< cloudletFinishedSoFar) {
//if (cloudlet.getCloudletTotalLength() *
Consts.MILLION
< cloudletFinishedSoFar) {
if
(
cloudlet
.
getCloudletStatus
()==
Cloudlet
.
SUCCESS
)
{
finished
=
cloudlet
.
getCloudletLength
();
}
else
{
finished
=
cloudletFinishedSoFar
/
1000000
;
finished
=
cloudletFinishedSoFar
/
Consts
.
MILLION
;
}
cloudlet
.
setCloudletFinishedSoFar
(
finished
);
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/lists/CloudletList.java
View file @
b2023e0d
...
...
@@ -38,6 +38,23 @@ public class CloudletList {
return
null
;
}
/**
* Returns the position of the cloudlet with that id, if it exists. Otherwise -1.
* @param cloudletList - the list of cloudlets.
* @param id - the id we search for.
* @return - the position of the cloudlet with that id, or -1 otherwise.
*/
public
static
<
T
extends
Cloudlet
>
int
getPositionById
(
List
<
T
>
cloudletList
,
int
id
)
{
int
i
=
0
;
for
(
T
cloudlet
:
cloudletList
)
{
if
(
cloudlet
.
getCloudletId
()
==
id
)
{
return
i
;
}
i
++;
}
return
-
1
;
}
/**
* Sorts the Cloudlets in a list based on their lengths.
*
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/lists/ResCloudletList.java
View file @
b2023e0d
...
...
@@ -89,4 +89,20 @@ public class ResCloudletList {
return
false
;
}
/**
* Returns the position of the cloudlet with that id, if it exists. Otherwise -1.
* @param cloudletList - the list of cloudlets.
* @param id - the id we search for.
* @return - the position of the cloudlet with that id, or -1 otherwise.
*/
public
static
<
T
extends
ResCloudlet
>
int
getPositionById
(
List
<
T
>
cloudletList
,
int
id
)
{
int
i
=
0
;
for
(
T
cloudlet
:
cloudletList
)
{
if
(
cloudlet
.
getCloudletId
()
==
id
)
{
return
i
;
}
i
++;
}
return
-
1
;
}
}
modules/cloudsim/src/test/java/org/cloudbus/cloudsim/HostDynamicWorkloadTest.java
View file @
b2023e0d
...
...
@@ -27,7 +27,7 @@ import org.junit.Test;
public
class
HostDynamicWorkloadTest
{
private
static
final
int
ID
=
0
;
private
static
final
long
STORAGE
=
1000000
;
private
static
final
long
STORAGE
=
Consts
.
MILLION
;
private
static
final
int
RAM
=
1024
;
private
static
final
int
BW
=
10000
;
private
static
final
double
MIPS
=
1000
;
...
...
modules/cloudsim/src/test/java/org/cloudbus/cloudsim/HostTest.java
View file @
b2023e0d
...
...
@@ -31,7 +31,7 @@ import org.junit.Test;
public
class
HostTest
{
private
static
final
int
ID
=
0
;
private
static
final
long
STORAGE
=
1000000
;
private
static
final
long
STORAGE
=
Consts
.
MILLION
;
private
static
final
int
RAM
=
1024
;
private
static
final
int
BW
=
10000
;
private
static
final
double
MIPS
=
1000
;
...
...
modules/cloudsim/src/test/java/org/cloudbus/cloudsim/TimeSharedProblemDetector.java
View file @
b2023e0d
...
...
@@ -172,7 +172,7 @@ public class TimeSharedProblemDetector {
// of machines
int
hostId
=
0
;
int
ram
=
2048
;
// host memory (MB)
long
storage
=
1000000
;
// host storage
long
storage
=
Consts
.
MILLION
;
// host storage
int
bw
=
10000
;
hostList
.
add
(
...
...
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