Package org.cloudbus.cloudsim.util
Class SwfWorkloadFileReader
java.lang.Object
org.cloudbus.cloudsim.util.TraceReaderAbstract
org.cloudbus.cloudsim.util.SwfWorkloadFileReader
- All Implemented Interfaces:
TraceReader
Reads resource traces and creates a list of (
Cloudlets
) (jobs).
It follows the Standard Workload Format (*.swf files)
from The Hebrew University of Jerusalem.
Check important details at TraceReaderAbstract
.
NOTES:
- The default Cloudlet reader size for sending to and receiving from a Datacenter is
DataCloudTags.DEFAULT_MTU
. However, you can specify the reader size by usingCloudlet.setFileSize(long)
. - A job run time considers the time spent for a single PE (since all PEs will be used for the same amount of time)not not the total execution time across all PEs. For example, job #1 in the trace has a run time of 100 seconds for 2 processors. This means each processor runs job #1 for 100 seconds, if the processors have the same specification.
- Required running time (index 8): This can be either runtime (measured in wall-clock seconds), or average CPU time per processor (also in seconds). The exact meaning is determined by a header comment. If a log contains a request for total CPU time, it is divided by the number of requested processors.
- User who submitted the job (index 11)
- Group of the user who submitted the job (index 12)
- Author:
- Anthony Sulistio, Marcos Dias de Assuncao, Manoel Campos da Silva Filho
- See Also:
-
Field Summary
Fields inherited from interface org.cloudbus.cloudsim.util.TraceReader
LOGGER
-
Constructor Summary
ConstructorDescriptionSwfWorkloadFileReader
(String filePath, int mips) Create a new SwfWorkloadFileReader object. -
Method Summary
Modifier and TypeMethodDescriptionGenerates a list of jobs (Cloudlets
) to be executed, if it wasn't generated yet.static SwfWorkloadFileReader
getInstance
(String fileName, int mips) Gets aSwfWorkloadFileReader
instance from a workload file inside the application's resource directory.int
getMips()
Gets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run.setMips
(int mips) Sets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run.setPredicate
(Predicate<Cloudlet> predicate) Methods inherited from class org.cloudbus.cloudsim.util.TraceReaderAbstract
getCommentString, getFieldDelimiterRegex, getFilePath, getInputStream, getLastLineNumber, getMaxLinesToRead, parseTraceLine, readFile, readGZIPFile, readTextFile, readZipFile, setCommentString, setFieldDelimiterRegex, setMaxLinesToRead
-
Constructor Details
-
SwfWorkloadFileReader
Create a new SwfWorkloadFileReader object.- Parameters:
filePath
- the workload trace file path in one of the following formats: ASCII text, zip, gz.mips
- the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Considering the workload reader provides the run time for each application registered inside the reader, the MIPS value will be used to compute thelength of the Cloudlet (in MI)
so that it's expected to execute, inside the VM with the given MIPS capacity, for the same time as specified into the workload reader.- Throws:
IllegalArgumentException
- when the workload trace file name is null or empty; or the resource PE mips is less or equal to 0FileNotFoundException
- when the file is not foundIOException
- See Also:
-
-
Method Details
-
getInstance
Gets aSwfWorkloadFileReader
instance from a workload file inside the application's resource directory. Use the available constructors if you want to load a file outside the resource directory.- Parameters:
fileName
- the workload trace relative file name in one of the following formats: ASCII text, zip, gz.mips
- the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Considering the workload reader provides the run time for each application registered inside the reader, the MIPS value will be used to compute thelength of the Cloudlet (in MI)
so that it's expected to execute, inside the VM with the given MIPS capacity, for the same time as specified into the workload reader.- Throws:
IllegalArgumentException
- when the workload trace file name is null or empty; or the resource PE mips is less or equal to 0UncheckedIOException
- when the file cannot be accessed (such as when it doesn't exist)
-
generateWorkload
Generates a list of jobs (Cloudlets
) to be executed, if it wasn't generated yet.- Returns:
- a generated Cloudlet list
-
setPredicate
Defines aPredicate
which indicates when aCloudlet
must be created from a trace line read from the workload file. If a Predicate is not set, a Cloudlet will be created for any line read.- Parameters:
predicate
- the predicate to define when a Cloudlet must be created from a line read from the workload file- Returns:
-
getMips
public int getMips()Gets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Considering the workload reader provides the run time for each application registered inside the reader, the MIPS value will be used to compute thelength of the Cloudlet (in MI)
so that it's expected to execute, inside the VM with the given MIPS capacity, for the same time as specified into the workload reader. -
setMips
Sets the MIPS capacity of the PEs from the VM where each created Cloudlet is supposed to run. Considering the workload reader provides the run time for each application registered inside the reader, the MIPS value will be used to compute thelength of the Cloudlet (in MI)
so that it's expected to execute, inside the VM with the given MIPS capacity, for the same time as specified into the workload reader.- Parameters:
mips
- the MIPS value to set
-