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
ea31eb0e
Commit
ea31eb0e
authored
Feb 01, 2016
by
Manoel Campos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved documentation of classes from package org.cloudbus.cloudsim.util.
parent
a2543cff
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
596 additions
and
511 deletions
+596
-511
Cloudlet.java
...loudsim/src/main/java/org/cloudbus/cloudsim/Cloudlet.java
+2
-2
ExecutionTimeMeasurer.java
...ava/org/cloudbus/cloudsim/util/ExecutionTimeMeasurer.java
+24
-9
MathUtil.java
...im/src/main/java/org/cloudbus/cloudsim/util/MathUtil.java
+51
-46
WorkloadFileReader.java
...n/java/org/cloudbus/cloudsim/util/WorkloadFileReader.java
+515
-450
WorkloadModel.java
...c/main/java/org/cloudbus/cloudsim/util/WorkloadModel.java
+4
-4
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/Cloudlet.java
View file @
ea31eb0e
...
@@ -86,7 +86,7 @@ public class Cloudlet {
...
@@ -86,7 +86,7 @@ public class Cloudlet {
private
int
reservationId
=
-
1
;
private
int
reservationId
=
-
1
;
/** Indicates if transaction history records for this Cloudlet
/** Indicates if transaction history records for this Cloudlet
* i
t
to be outputted. */
* i
s
to be outputted. */
private
final
boolean
record
;
private
final
boolean
record
;
/** Stores the operating system line separator. */
/** Stores the operating system line separator. */
...
@@ -1015,7 +1015,7 @@ public class Cloudlet {
...
@@ -1015,7 +1015,7 @@ public class Cloudlet {
/**
/**
* Gets the total length (across all PEs) of this Cloudlet.
* Gets the total length (across all PEs) of this Cloudlet.
* It considers the {@link #cloudletLength} of the cloudlet to be execute
* It considers the {@link #cloudletLength} of the cloudlet to be execute
d
* in each Pe and the {@link #numberOfPes}.<br/>
* in each Pe and the {@link #numberOfPes}.<br/>
*
*
* For example, setting the cloudletLenght as 10000 MI and {@link #numberOfPes}
* For example, setting the cloudletLenght as 10000 MI and {@link #numberOfPes}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/util/ExecutionTimeMeasurer.java
View file @
ea31eb0e
...
@@ -12,30 +12,44 @@ import java.util.HashMap;
...
@@ -12,30 +12,44 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
*
The class for measuring the execution time
.
*
Measurement of execution times of CloudSim's methods
.
*
*
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
* @since CloudSim Toolkit 3.0
*/
*/
public
class
ExecutionTimeMeasurer
{
public
class
ExecutionTimeMeasurer
{
/** The execution times. */
/** A map of execution times where each key
* represents the name of the method/process being its
* execution time computed and each key is the
* time the method/process started (in milliseconds).
* Usually, this name is the method/process name, making
* easy to identify the execution times into the map.
*
* @todo The name of the attribute doesn't match with what it stores.
* It in fact stores the method/process start time,
* no the time it spent executing.
*/
private
final
static
Map
<
String
,
Long
>
executionTimes
=
new
HashMap
<
String
,
Long
>();
private
final
static
Map
<
String
,
Long
>
executionTimes
=
new
HashMap
<
String
,
Long
>();
/**
/**
* Start.
* Start measuring the execution time of a method/process.
* Usually this method has to be called at the first line of the method
* that has to be its execution time measured.
*
*
* @param name the name
* @param name the name of the method/process being measured.
* @see #executionTimes
*/
*/
public
static
void
start
(
String
name
)
{
public
static
void
start
(
String
name
)
{
getExecutionTimes
().
put
(
name
,
System
.
currentTimeMillis
());
getExecutionTimes
().
put
(
name
,
System
.
currentTimeMillis
());
}
}
/**
/**
*
End
.
*
Finalizes measuring the execution time of a method/process
.
*
*
* @param name the name
* @param name the name of the method/process being measured.
* @return the double
* @see #executionTimes
* @return the time the method/process spent in execution (in seconds)
*/
*/
public
static
double
end
(
String
name
)
{
public
static
double
end
(
String
name
)
{
double
time
=
(
System
.
currentTimeMillis
()
-
getExecutionTimes
().
get
(
name
))
/
1000.0
;
double
time
=
(
System
.
currentTimeMillis
()
-
getExecutionTimes
().
get
(
name
))
/
1000.0
;
...
@@ -44,9 +58,10 @@ public class ExecutionTimeMeasurer {
...
@@ -44,9 +58,10 @@ public class ExecutionTimeMeasurer {
}
}
/**
/**
* Gets the execution times.
* Gets
map
the execution times.
*
*
* @return the execution times
* @return the execution times map
* @see #executionTimes
*/
*/
public
static
Map
<
String
,
Long
>
getExecutionTimes
()
{
public
static
Map
<
String
,
Long
>
getExecutionTimes
()
{
return
executionTimes
;
return
executionTimes
;
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/util/MathUtil.java
View file @
ea31eb0e
...
@@ -20,13 +20,14 @@ import org.apache.commons.math3.stat.regression.SimpleRegression;
...
@@ -20,13 +20,14 @@ import org.apache.commons.math3.stat.regression.SimpleRegression;
*
*
* @author Anton Beloglazov
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
* @since CloudSim Toolkit 3.0
* @todo Using Java 8 Stream, some methods here can be improved or removed.
*/
*/
public
class
MathUtil
{
public
class
MathUtil
{
/**
/**
* Sums a list of numbers.
* Sums a list of numbers.
*
*
* @param list the list
* @param list the list
of numbers
* @return the double
* @return the double
*/
*/
public
static
double
sum
(
final
List
<?
extends
Number
>
list
)
{
public
static
double
sum
(
final
List
<?
extends
Number
>
list
)
{
...
@@ -38,10 +39,12 @@ public class MathUtil {
...
@@ -38,10 +39,12 @@ public class MathUtil {
}
}
/**
/**
* List to array.
*
Converts a
List to array.
*
*
* @param list the list
* @param list the list
of numbers
* @return the double[]
* @return the double[]
* @todo The method {@link List#toArray()} could be used directly
* instead of creating this method.
*/
*/
public
static
double
[]
listToArray
(
final
List
<?
extends
Number
>
list
)
{
public
static
double
[]
listToArray
(
final
List
<?
extends
Number
>
list
)
{
double
[]
array
=
new
double
[
list
.
size
()];
double
[]
array
=
new
double
[
list
.
size
()];
...
@@ -52,9 +55,9 @@ public class MathUtil {
...
@@ -52,9 +55,9 @@ public class MathUtil {
}
}
/**
/**
* Gets the median.
* Gets the median
from a list of numbers
.
*
*
* @param list the list
* @param list the list
of numbers
* @return the median
* @return the median
*/
*/
public
static
double
median
(
final
List
<
Double
>
list
)
{
public
static
double
median
(
final
List
<
Double
>
list
)
{
...
@@ -62,9 +65,9 @@ public class MathUtil {
...
@@ -62,9 +65,9 @@ public class MathUtil {
}
}
/**
/**
* Gets the median.
* Gets the median
from an array of numbers
.
*
*
* @param list the
list
* @param list the
array of numbers
*
*
* @return the median
* @return the median
*/
*/
...
@@ -73,11 +76,10 @@ public class MathUtil {
...
@@ -73,11 +76,10 @@ public class MathUtil {
}
}
/**
/**
* Returns
descriptive statistics for the
list of numbers.
* Returns
an object to compute descriptive statistics for an
list of numbers.
*
*
* @param list
* @param list the list of numbers. Must not be null.
* - the list of numbers. Must not be null.
* @return descriptive statistics for the list of numbers.
* @return - descriptive statistics for the list of numbers.
*/
*/
public
static
DescriptiveStatistics
getStatistics
(
final
List
<
Double
>
list
)
{
public
static
DescriptiveStatistics
getStatistics
(
final
List
<
Double
>
list
)
{
// Get a DescriptiveStatistics instance
// Get a DescriptiveStatistics instance
...
@@ -91,10 +93,10 @@ public class MathUtil {
...
@@ -91,10 +93,10 @@ public class MathUtil {
}
}
/**
/**
* Returns
descriptive statistics for the
array of numbers.
* Returns
an object to compute descriptive statistics for an
array of numbers.
*
*
* @param list
-
the array of numbers. Must not be null.
* @param list the array of numbers. Must not be null.
* @return
-
descriptive statistics for the array of numbers.
* @return descriptive statistics for the array of numbers.
*/
*/
public
static
DescriptiveStatistics
getStatistics
(
final
double
[]
list
)
{
public
static
DescriptiveStatistics
getStatistics
(
final
double
[]
list
)
{
// Get a DescriptiveStatistics instance
// Get a DescriptiveStatistics instance
...
@@ -108,9 +110,9 @@ public class MathUtil {
...
@@ -108,9 +110,9 @@ public class MathUtil {
}
}
/**
/**
* Gets the average.
* Gets the average
from a list of numbers
.
*
*
* @param list the list
* @param list the list
of numbers
*
*
* @return the average
* @return the average
*/
*/
...
@@ -123,10 +125,10 @@ public class MathUtil {
...
@@ -123,10 +125,10 @@ public class MathUtil {
}
}
/**
/**
*
Variance
.
*
Gets the Variance from a list of numbers
.
*
*
* @param list the list
* @param list the list
of numbers
* @return the
doubl
e
* @return the
varianc
e
*/
*/
public
static
double
variance
(
final
List
<
Double
>
list
)
{
public
static
double
variance
(
final
List
<
Double
>
list
)
{
long
n
=
0
;
long
n
=
0
;
...
@@ -145,19 +147,19 @@ public class MathUtil {
...
@@ -145,19 +147,19 @@ public class MathUtil {
}
}
/**
/**
* Gets the standard deviation.
* Gets the standard deviation
from a list of numbers
.
*
*
* @param list the list
* @param list the list
of numbers
* @return the
double
* @return the
standard deviation
*/
*/
public
static
double
stDev
(
final
List
<
Double
>
list
)
{
public
static
double
stDev
(
final
List
<
Double
>
list
)
{
return
Math
.
sqrt
(
variance
(
list
));
return
Math
.
sqrt
(
variance
(
list
));
}
}
/**
/**
* Gets the mad.
* Gets the mad
from a array of numbers
.
*
*
* @param data the
data
* @param data the
array of numbers
* @return the mad
* @return the mad
*/
*/
public
static
double
mad
(
final
double
[]
data
)
{
public
static
double
mad
(
final
double
[]
data
)
{
...
@@ -174,9 +176,9 @@ public class MathUtil {
...
@@ -174,9 +176,9 @@ public class MathUtil {
}
}
/**
/**
* Gets the I
QR
.
* Gets the I
nterquartile Range (IQR) from an array of numbers
.
*
*
* @param data the
data
* @param data the
array of numbers
* @return the IQR
* @return the IQR
*/
*/
public
static
double
iqr
(
final
double
[]
data
)
{
public
static
double
iqr
(
final
double
[]
data
)
{
...
@@ -187,10 +189,11 @@ public class MathUtil {
...
@@ -187,10 +189,11 @@ public class MathUtil {
}
}
/**
/**
* Count non zero beginning of the data.
* Counts the number of values different of zero at the beginning of
* an array.
*
*
* @param data the
data
* @param data the
array of numbers
* @return the
int
* @return the
number of values different of zero at the beginning of the array
*/
*/
public
static
int
countNonZeroBeginning
(
final
double
[]
data
)
{
public
static
int
countNonZeroBeginning
(
final
double
[]
data
)
{
int
i
=
data
.
length
-
1
;
int
i
=
data
.
length
-
1
;
...
@@ -203,10 +206,10 @@ public class MathUtil {
...
@@ -203,10 +206,10 @@ public class MathUtil {
}
}
/**
/**
*
Count shortest row.
*
Gets the length of the shortest row in a given matrix
*
*
* @param data the data
* @param data the data
matrix
* @return the
int
* @return the
length of the shortest row int he matrix
*/
*/
public
static
int
countShortestRow
(
final
double
[][]
data
)
{
public
static
int
countShortestRow
(
final
double
[][]
data
)
{
int
minLength
=
0
;
int
minLength
=
0
;
...
@@ -219,10 +222,10 @@ public class MathUtil {
...
@@ -219,10 +222,10 @@ public class MathUtil {
}
}
/**
/**
* Trim
zero tail
.
* Trim
s zeros at the end of an array
.
*
*
* @param data the data
* @param data the data
array
* @return the
double[]
* @return the
trimmed array
*/
*/
public
static
double
[]
trimZeroTail
(
final
double
[]
data
)
{
public
static
double
[]
trimZeroTail
(
final
double
[]
data
)
{
return
Arrays
.
copyOfRange
(
data
,
0
,
countNonZeroBeginning
(
data
));
return
Arrays
.
copyOfRange
(
data
,
0
,
countNonZeroBeginning
(
data
));
...
@@ -231,7 +234,7 @@ public class MathUtil {
...
@@ -231,7 +234,7 @@ public class MathUtil {
/**
/**
* Gets the loess parameter estimates.
* Gets the loess parameter estimates.
*
*
* @param y the y
* @param y the y
array
* @return the loess parameter estimates
* @return the loess parameter estimates
*/
*/
public
static
double
[]
getLoessParameterEstimates
(
final
double
[]
y
)
{
public
static
double
[]
getLoessParameterEstimates
(
final
double
[]
y
)
{
...
@@ -291,7 +294,7 @@ public class MathUtil {
...
@@ -291,7 +294,7 @@ public class MathUtil {
/**
/**
* Gets the robust loess parameter estimates.
* Gets the robust loess parameter estimates.
*
*
* @param y the y
* @param y the y
array
* @return the robust loess parameter estimates
* @return the robust loess parameter estimates
*/
*/
public
static
double
[]
getRobustLoessParameterEstimates
(
final
double
[]
y
)
{
public
static
double
[]
getRobustLoessParameterEstimates
(
final
double
[]
y
)
{
...
@@ -318,10 +321,11 @@ public class MathUtil {
...
@@ -318,10 +321,11 @@ public class MathUtil {
}
}
/**
/**
* Gets the tricube weigts.
* Gets the tricube weigt
h
s.
*
*
* @param n the n
* @param n the number of weights
* @return the tricube weigts
* @return an array of tricube weigths with n elements
* @todo The word "weight" is misspelled in the method name.
*/
*/
public
static
double
[]
getTricubeWeigts
(
final
int
n
)
{
public
static
double
[]
getTricubeWeigts
(
final
int
n
)
{
double
[]
weights
=
new
double
[
n
];
double
[]
weights
=
new
double
[
n
];
...
@@ -340,10 +344,11 @@ public class MathUtil {
...
@@ -340,10 +344,11 @@ public class MathUtil {
}
}
/**
/**
* Gets the tricube bisquare weigts.
* Gets the tricube bisquare weigt
h
s.
*
*
* @param residuals the residuals
* @param residuals the residuals array
* @return the tricube bisquare weigts
* @return the tricube bisquare weigths
* @todo The word "weight" is misspelled in the method name.
*/
*/
public
static
double
[]
getTricubeBisquareWeigts
(
final
double
[]
residuals
)
{
public
static
double
[]
getTricubeBisquareWeigts
(
final
double
[]
residuals
)
{
int
n
=
residuals
.
length
;
int
n
=
residuals
.
length
;
...
@@ -363,10 +368,10 @@ public class MathUtil {
...
@@ -363,10 +368,10 @@ public class MathUtil {
}
}
/**
/**
*
Abs.
*
Gets the absolute values of an array of values
*
*
* @param data the
data
* @param data the
array of values
* @return
the double[]
* @return
a new array with the absolute value of each element in the given array.
*/
*/
public
static
double
[]
abs
(
final
double
[]
data
)
{
public
static
double
[]
abs
(
final
double
[]
data
)
{
double
[]
result
=
new
double
[
data
.
length
];
double
[]
result
=
new
double
[
data
.
length
];
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/util/WorkloadFileReader.java
View file @
ea31eb0e
This diff is collapsed.
Click to expand it.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/util/WorkloadModel.java
View file @
ea31eb0e
...
@@ -13,8 +13,8 @@ import java.util.List;
...
@@ -13,8 +13,8 @@ import java.util.List;
import
org.cloudbus.cloudsim.Cloudlet
;
import
org.cloudbus.cloudsim.Cloudlet
;
/**
/**
*
This interface d
efines what a workload model should provide. A workload model generates a list of
*
D
efines what a workload model should provide. A workload model generates a list of
* jobs that can be dispatched to a resource by {@link Workload}.
* jobs
({@link Cloudlet Cloudlets})
that can be dispatched to a resource by {@link Workload}.
*
*
* @author Marcos Dias de Assuncao
* @author Marcos Dias de Assuncao
* @since 5.0
* @since 5.0
...
@@ -25,9 +25,9 @@ import org.cloudbus.cloudsim.Cloudlet;
...
@@ -25,9 +25,9 @@ import org.cloudbus.cloudsim.Cloudlet;
public
interface
WorkloadModel
{
public
interface
WorkloadModel
{
/**
/**
*
Returns a list with the jobs generated by the workload
.
*
Generates a list of jobs to be executed ({@link Cloudlet Cloudlets})
.
*
*
* @return a list with the jobs generated by the workload.
* @return a list with the jobs generated by the workload
or null in case of failure
.
*/
*/
List
<
Cloudlet
>
generateWorkload
();
List
<
Cloudlet
>
generateWorkload
();
...
...
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