GridSim 5.0 beta

gridsim
Class ResGridlet

Object
  extended by ResGridlet

public class ResGridlet
extends Object

GridSim ResGridlet represents a Gridlet submitted to GridResource for processing. This class keeps track the time for all activities in the GridResource for a specific Gridlet. Before a Gridlet exits the GridResource, it is RECOMMENDED to call this method finalizeGridlet().

It contains a Gridlet object along with its arrival time and the ID of the machine and the PE (Processing Element) allocated to it. It acts as a placeholder for maintaining the amount of resource share allocated at various times for simulating any scheduling using internal events.

Since:
GridSim Toolkit 1.0
Author:
Manzur Murshed and Rajkumar Buyya
Invariant:
$none

Constructor Summary
ResGridlet(Gridlet gridlet)
          Allocates a new ResGridlet object upon the arrival of a Gridlet object.
ResGridlet(Gridlet gridlet, long startTime, int duration, int reservID)
          Allocates a new ResGridlet object upon the arrival of a Gridlet object.
 
Method Summary
 void finalizeGridlet()
          Finalizes all relevant information before exiting the GridResource entity.
 int getDurationTime()
          Gets the reservation duration time.
 double getExecStartTime()
          Gets the Gridlet's execution start time
 Gridlet getGridlet()
          Gets this Gridlet object
 double getGridletArrivalTime()
          Gets arrival time of a gridlet
 int getGridletClassType()
          Gets the Gridlet's class type
 double getGridletFinishTime()
          Gets the Gridlet's finish time
 int getGridletID()
          Gets this Gridlet entity Id
 double getGridletLength()
          Gets the Gridlet's length
 int getGridletStatus()
          Gets the Gridlet status
 int[] getListMachineID()
          Gets a list of Machine IDs.
 int[] getListPEID()
          Gets a list of PE IDs.
 int getMachineID()
          Gets machine ID
 int getNumPE()
          Gets the number of PEs required to execute this Gridlet.
 int getPEID()
          Gets PE ID
 double getRemainingGridletLength()
          Gets the remaining gridlet length
 int getReservationID()
          Gets the reservation ID that owns this Gridlet
 long getStartTime()
          Gets the Gridlet or reservation start time.
 int getUserID()
          Gets the user or owner of this Gridlet
 boolean hasReserved()
          Checks whether this Gridlet is submitted by reserving or not.
 void setExecParam(double wallClockTime, double actualCPUTime)
          Sets this Gridlet's execution parameters.
 void setFinishTime(double time)
          Sets the finish time for this Gridlet.
 boolean setGridletStatus(int status)
          Sets the Gridlet status.
 void setMachineAndPEID(int machineID, int peID)
          Sets the machine and PE (Processing Element) ID
 void updateGridletFinishedSoFar(double miLength)
          A method that updates the length of gridlet that has been completed
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResGridlet

public ResGridlet(Gridlet gridlet)
Allocates a new ResGridlet object upon the arrival of a Gridlet object. The arriving time is determined by GridSim.clock().

Parameters:
gridlet - a gridlet object
See Also:
GridSim.clock()
Pre Condition:
gridlet != null
Post Condition:
$none

ResGridlet

public ResGridlet(Gridlet gridlet,
                  long startTime,
                  int duration,
                  int reservID)
Allocates a new ResGridlet object upon the arrival of a Gridlet object. Use this constructor to store reserved Gridlets, i.e. Gridlets that done reservation before. The arriving time is determined by GridSim.clock().

Parameters:
gridlet - a gridlet object
startTime - a reservation start time. Can also be interpreted as starting time to execute this Gridlet.
duration - a reservation duration time. Can also be interpreted as how long to execute this Gridlet.
reservID - a reservation ID that owns this Gridlet
See Also:
GridSim.clock()
Pre Condition:
gridlet != null, startTime > 0, duration > 0, reservID > 0
Post Condition:
$none
Method Detail

getStartTime

public long getStartTime()
Gets the Gridlet or reservation start time.

Returns:
Gridlet's starting time
Pre Condition:
$none
Post Condition:
$none

getDurationTime

public int getDurationTime()
Gets the reservation duration time.

Returns:
reservation duration time
Pre Condition:
$none
Post Condition:
$none

getNumPE

public int getNumPE()
Gets the number of PEs required to execute this Gridlet.

Returns:
number of PE
Pre Condition:
$none
Post Condition:
$none

getReservationID

public int getReservationID()
Gets the reservation ID that owns this Gridlet

Returns:
a reservation ID
Pre Condition:
$none
Post Condition:
$none

hasReserved

public boolean hasReserved()
Checks whether this Gridlet is submitted by reserving or not.

Returns:
true if this Gridlet has reserved before, false otherwise
Pre Condition:
$none
Post Condition:
$none

getGridletID

public int getGridletID()
Gets this Gridlet entity Id

Returns:
the Gridlet entity Id
Pre Condition:
$none
Post Condition:
$none

getUserID

public int getUserID()
Gets the user or owner of this Gridlet

Returns:
the Gridlet's user Id
Pre Condition:
$none
Post Condition:
$none

getGridletLength

public double getGridletLength()
Gets the Gridlet's length

Returns:
Gridlet's length
Pre Condition:
$none
Post Condition:
$none

getGridletClassType

public int getGridletClassType()
Gets the Gridlet's class type

Returns:
class type of the Gridlet
Pre Condition:
$none
Post Condition:
$none

setGridletStatus

public boolean setGridletStatus(int status)
Sets the Gridlet status.

Parameters:
status - the Gridlet status
Returns:
true if the new status has been set, false otherwise
Pre Condition:
status >= 0
Post Condition:
$none

getExecStartTime

public double getExecStartTime()
Gets the Gridlet's execution start time

Returns:
Gridlet's execution start time
Pre Condition:
$none
Post Condition:
$none

setExecParam

public void setExecParam(double wallClockTime,
                         double actualCPUTime)
Sets this Gridlet's execution parameters. These parameters are set by the GridResource before departure or sending back to the original Gridlet's owner.

Parameters:
wallClockTime - the time of this Gridlet resides in a GridResource (from arrival time until departure time).
actualCPUTime - the total execution time of this Gridlet in a GridResource.
Pre Condition:
wallClockTime >= 0.0, actualCPUTime >= 0.0
Post Condition:
$none

setMachineAndPEID

public void setMachineAndPEID(int machineID,
                              int peID)
Sets the machine and PE (Processing Element) ID

Parameters:
machineID - machine ID
peID - PE ID
Pre Condition:
machineID >= 0, peID >= 0
Post Condition:
$none

getMachineID

public int getMachineID()
Gets machine ID

Returns:
machine ID or -1 if it is not specified before
Pre Condition:
$none
Post Condition:
$result >= -1

getPEID

public int getPEID()
Gets PE ID

Returns:
PE ID or -1 if it is not specified before
Pre Condition:
$none
Post Condition:
$result >= -1

getListPEID

public int[] getListPEID()
Gets a list of PE IDs.
NOTE: To get the machine IDs corresponding to these PE IDs, use getListMachineID().

Returns:
an array containing PE IDs.
Pre Condition:
$none
Post Condition:
$none

getListMachineID

public int[] getListMachineID()
Gets a list of Machine IDs.
NOTE: To get the PE IDs corresponding to these machine IDs, use getListPEID().

Returns:
an array containing Machine IDs.
Pre Condition:
$none
Post Condition:
$none

getRemainingGridletLength

public double getRemainingGridletLength()
Gets the remaining gridlet length

Returns:
gridlet length
Pre Condition:
$none
Post Condition:
$result >= 0

finalizeGridlet

public void finalizeGridlet()
Finalizes all relevant information before exiting the GridResource entity. This method sets the final data of:

Pre Condition:
$none
Post Condition:
$none

updateGridletFinishedSoFar

public void updateGridletFinishedSoFar(double miLength)
A method that updates the length of gridlet that has been completed

Parameters:
miLength - gridlet length in Million Instructions (MI)
Pre Condition:
miLength >= 0.0
Post Condition:
$none

getGridletArrivalTime

public double getGridletArrivalTime()
Gets arrival time of a gridlet

Returns:
arrival time
Pre Condition:
$none
Post Condition:
$result >= 0.0

setFinishTime

public void setFinishTime(double time)
Sets the finish time for this Gridlet. If time is negative, then it is being ignored.

Parameters:
time - finish time
Pre Condition:
time >= 0.0
Post Condition:
$none

getGridletFinishTime

public double getGridletFinishTime()
Gets the Gridlet's finish time

Returns:
finish time of a gridlet or -1.0 if it cannot finish in this hourly slot
Pre Condition:
$none
Post Condition:
$result >= -1.0

getGridlet

public Gridlet getGridlet()
Gets this Gridlet object

Returns:
gridlet object
Pre Condition:
$none
Post Condition:
$result != null

getGridletStatus

public int getGridletStatus()
Gets the Gridlet status

Returns:
Gridlet status
Pre Condition:
$none
Post Condition:
$none

GridSim 5.0 beta

The University of Melbourne, Australia, 2009