SwfWorkloadFileReader

public final class SwfWorkloadFileReader extends TraceReaderAbstract

Reads resource traces and creates a list of (Cloudlets) (jobs). It follows the Standard Workload Format (*.swf files) from The Hebrew University of Jerusalem.

NOTES:

  • This class can only read trace files in the following format: ASCII text, zip, gz.
  • If you need to load multiple trace files, then you need to create multiple instances of this class each with a unique entity name.
  • If size of the trace reader is huge or contains lots of traces, please increase the JVM heap size accordingly by using java -Xmx option when running the simulation.
  • 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 using Cloudlet.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.
Author:Anthony Sulistio, Marcos Dias de Assuncao, Manoel Campos da Silva Filho

See also: .getInstance(String,int), .generateWorkload()

Constructors

SwfWorkloadFileReader

public SwfWorkloadFileReader(String filePath, int mips)

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 the length 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 <= 0
  • FileNotFoundException – when the file is not found

See also: .getInstance(String,int)

Methods

generateWorkload

public List<Cloudlet> generateWorkload()

Generates a list of jobs (Cloudlets) to be executed, if it wasn’t generated yet.

Returns:a generated Cloudlet list

getInstance

public static SwfWorkloadFileReader getInstance(String fileName, int mips)

Gets a SwfWorkloadFileReader 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 the length 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 <= 0
  • UncheckedIOException – when the file cannot be accessed (such as when it doesn’t exist)

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 the length 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

public SwfWorkloadFileReader setMips(int mips)

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 the length 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

setPredicate

public SwfWorkloadFileReader setPredicate(Predicate<Cloudlet> predicate)

Defines a Predicate which indicates when a Cloudlet 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