Class SwfWorkloadFileReader

java.lang.Object
org.cloudbus.cloudsim.util.TraceReaderAbstract
org.cloudbus.cloudsim.util.SwfWorkloadFileReader
All Implemented Interfaces:
TraceReader

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. 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 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.

List of unused fields:

  • 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:
  • Constructor Details

    • SwfWorkloadFileReader

      public SwfWorkloadFileReader(String filePath, int mips) throws IOException
      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 is less or equal to 0
      FileNotFoundException - when the file is not found
      IOException
      See Also:
  • Method Details

    • 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 is less or equal to 0
      UncheckedIOException - when the file cannot be accessed (such as when it doesn't exist)
    • 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
    • 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
      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 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