GridSim 5.0 beta

gridsim.parallel.util
Class WorkloadFileReader

Object
  extended by WorkloadFileReader
All Implemented Interfaces:
WorkloadModel

public class WorkloadFileReader
extends Object
implements WorkloadModel

This class is responsible for reading resource traces from a file and creating a list of jobs.

NOTE:

By default, this class follows the standard workload format as specified in http://www.cs.huji.ac.il/labs/parallel/workload/
However, you can use other format by calling the below methods before running the simulation:

Since:
5.0
Author:
Anthony Sulistio and Marcos Dias de Assuncao
See Also:
Workload

Constructor Summary
WorkloadFileReader(String fileName, int rating)
          Create a new WorkloadFileReader object.
 
Method Summary
 ArrayList<WorkloadJob> generateWorkload()
          Reads job information from a given file.
 boolean setComment(String cmt)
          Identifies the start of a comment line.
 boolean setField(int maxField, int jobNum, int submitTime, int runTime, int numProc)
          Tells this class what to look in the trace file.
 boolean setGridletFileSize(int size)
          Sets a Gridlet file size (in byte) for sending to/from a resource.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkloadFileReader

public WorkloadFileReader(String fileName,
                          int rating)
Create a new WorkloadFileReader object.

Parameters:
fileName - the workload trace filename in one of the following format: ASCII text, zip, gz.
rating - the resource's PE rating
Throws:
IllegalArgumentException - This happens for the following conditions:
  • the workload trace file name is null or empty
  • the resource PE rating <= 0
Pre Condition:
fileName != null, rating > 0
Post Condition:
$none
Method Detail

setGridletFileSize

public boolean setGridletFileSize(int size)
Sets a Gridlet file size (in byte) for sending to/from a resource.

Parameters:
size - a Gridlet file size (in byte)
Returns:
true if it is successful, false otherwise
Pre Condition:
size > 0
Post Condition:
$none

setComment

public boolean setComment(String cmt)
Identifies the start of a comment line.

Parameters:
cmt - a character that denotes the start of a comment, e.g. ";" or "#"
Returns:
true if it is successful, false otherwise
Pre Condition:
comment != null
Post Condition:
$none

setField

public boolean setField(int maxField,
                        int jobNum,
                        int submitTime,
                        int runTime,
                        int numProc)
Tells this class what to look in the trace file. This method should be called before the start of the simulation.

By default, this class follows the standard workload format as specified in http://www.cs.huji.ac.il/labs/parallel/workload/
However, you can use other format by calling this method.

The parameters must be a positive integer number starting from 1. A special case is where jobNum == -1, meaning the job or gridlet ID starts at 1.

Parameters:
maxField - max. number of field/column in one row
jobNum - field/column number for locating the job ID
submitTime - field/column number for locating the job submit time
runTime - field/column number for locating the job run time
numProc - field/column number for locating the number of PEs required to run a job
Returns:
true if successful, false otherwise
Throws:
IllegalArgumentException - if any of the arguments are not within the acceptable ranges
Pre Condition:
maxField > 0, submitTime > 0, runTime > 0, numProc > 0
Post Condition:
$none

generateWorkload

public ArrayList<WorkloadJob> generateWorkload()
Reads job information from a given file.

Specified by:
generateWorkload in interface WorkloadModel
Returns:
the list of gridlets read from the file; null in case of failure.

GridSim 5.0 beta

The University of Melbourne, Australia, 2009